Difference between revisions of "Manual:DIL Manual/delete player()"
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
| + | = delete_player() = | ||
| + | '''Procedure.''' Deletes a player character for good. | ||
| + | delete_player(pname : string) | ||
| − | + | If the player is connected, the character is taken out of the game and the connection closed; otherwise any copy of the character still in the game (a link-dead one) is taken out. Then the player's file and saved inventory are deleted. The name is matched without regard to case. | |
| − | + | Only a program started in a zone with access level 0 (the fourth column of <code>vme/etc/zonelist</code>) can use it. What counts is the zone of the program's first template, the one that was <code>dilcopy</code>'d or run as a command. Elsewhere the zone log gets "attempt to violate system access security (delete_player)" and the program stops. | |
| − | + | == Parameters == | |
| − | + | {| class="wikitable" | |
| + | ! Name !! Type !! Meaning | ||
| + | |- | ||
| + | | pname || string || The character's name. | ||
| + | |} | ||
| − | + | == Notes == | |
| − | + | * It doesn't say whether there was such a player. Check with [[Manual:DIL Manual/isplayer()|isplayer()]] first if it matters. | |
| − | + | * Nothing is saved first, and nothing else is cleaned up: records elsewhere that name the player (a clan, for one) stay. The <code>delete</code> command in commands.zon makes the player leave the clan (<code>cdefect</code>) before deleting. | |
| − | + | * A program that deletes the player it runs on goes with the character: put nothing after it but <code>quit</code>. | |
| − | |||
| − | + | == Example == | |
| − | + | <pre> | |
| − | + | dilbegin cmd_delete(arg : string); | |
| − | + | code | |
| − | + | { | |
| − | + | if (self.type != UNIT_ST_PC) | |
| + | quit; | ||
| + | if (arg != "self forever") | ||
| + | { | ||
| + | sendtext("To delete your character type: delete self forever<br/>", self); | ||
| + | quit; | ||
| + | } | ||
| + | sendtext("If you are sure, say 'delete me'. Anything else aborts.<br/>", self); | ||
| + | wait(SFB_CMD, self == activator); | ||
| + | if (command("say") and (argument == "delete me")) | ||
| + | { | ||
| + | block; | ||
| + | delete_player(self.name); | ||
| + | quit; | ||
| + | } | ||
| + | sendtext("Deletion aborted.<br/>", self); | ||
| + | quit; | ||
| + | } | ||
| + | dilend | ||
| + | </pre> | ||
| + | A player command that deletes the player's own character after asking once more, as the <code>delete</code> command in commands.zon does. | ||
| − | + | == See also == | |
| − | + | * [[Manual:DIL Manual/isplayer()|isplayer()]] | |
| − | + | * [[Manual:DIL Manual/set password()|set_password()]] | |
| − | + | * [[Manual:DIL Manual/access|access]] | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 23:16, 14 November 2026
delete_player()
Procedure. Deletes a player character for good.
delete_player(pname : string)
If the player is connected, the character is taken out of the game and the connection closed; otherwise any copy of the character still in the game (a link-dead one) is taken out. Then the player's file and saved inventory are deleted. The name is matched without regard to case.
Only a program started in a zone with access level 0 (the fourth column of vme/etc/zonelist) can use it. What counts is the zone of the program's first template, the one that was dilcopy'd or run as a command. Elsewhere the zone log gets "attempt to violate system access security (delete_player)" and the program stops.
Parameters
| Name | Type | Meaning |
|---|---|---|
| pname | string | The character's name. |
Notes
- It doesn't say whether there was such a player. Check with isplayer() first if it matters.
- Nothing is saved first, and nothing else is cleaned up: records elsewhere that name the player (a clan, for one) stay. The
deletecommand in commands.zon makes the player leave the clan (cdefect) before deleting. - A program that deletes the player it runs on goes with the character: put nothing after it but
quit.
Example
dilbegin cmd_delete(arg : string);
code
{
if (self.type != UNIT_ST_PC)
quit;
if (arg != "self forever")
{
sendtext("To delete your character type: delete self forever<br/>", self);
quit;
}
sendtext("If you are sure, say 'delete me'. Anything else aborts.<br/>", self);
wait(SFB_CMD, self == activator);
if (command("say") and (argument == "delete me"))
{
block;
delete_player(self.name);
quit;
}
sendtext("Deletion aborted.<br/>", self);
quit;
}
dilend
A player command that deletes the player's own character after asking once more, as the delete command in commands.zon does.