Manual:DIL Manual/delete player()
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.