Difference between revisions of "Manual:DIL Manual/delete player()"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="bpdp"></span>
+
= delete_player() =
 +
'''Procedure.''' Deletes a player character for good.
  
−
  '''Function:'''  <i><!--CODE-->delete_player( s : string ) ;</i><!--ENDCODE-->
+
  delete_player(pname : string)
  
−
<!--TERM-->  '''s'''
+
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.
−
<!--DEFINITION-->        the player name you want to delete
 
  
−
This function deletes a player but it doesn't check to see if it
+
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.
−
was deleted or if it even existed you will have to do that with 'isplayer'.
 
−
'''Example:'''
 
−
<i><!--CODE-->
 
−
---~---~---~---~---~---~---~---~---
 
  
−
dilbegin aware do_delete (arg:string);
+
== Parameters ==
−
var
+
{| class="wikitable"
−
        temp:string;
+
! Name !! Type !! Meaning
−
        err:integer;
+
|-
−
code
+
| pname || string || The character's name.
−
dilend
+
|}
−
 
 
−
 
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 
−
 
 
−
</i><!--ENDCODE-->
 
−
 
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 
−
<span id="bpdp"></span>
 
−
 
 
−
'''Function:'''  <i><!--CODE-->delete_player( s : string ) ;</i><!--ENDCODE-->
 
−
 
 
−
<!--TERM-->  '''s'''
 
−
<!--DEFINITION-->        the player name you want to delete
 
  
−
This function deletes a player but it doesn't check to see if it
+
== Notes ==
−
was deleted or if it even existed you will have to do that with 'isplayer'.
+
* It doesn't say whether there was such a player. Check with [[Manual:DIL Manual/isplayer()|isplayer()]] first if it matters.
−
'''Example:'''
+
* 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.
−
<i><!--CODE-->
+
* A program that deletes the player it runs on goes with the character: put nothing after it but <code>quit</code>.
−
---~---~---~---~---~---~---~---~---
 
  
−
dilbegin aware do_delete (arg:string);
+
== Example ==
−
var
+
<pre>
−
        temp:string;
+
dilbegin cmd_delete(arg : string);
−
        err:integer;
+
code
−
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
 
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]]
−
</i><!--ENDCODE-->
 
−
 
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 

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 delete command 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.

See also