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)
 
(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)
  
−
<span id="bpdp"></span>
+
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.
  
−
'''Function:'''  <i><!--CODE-->delete_player( s : string ) ;</i><!--ENDCODE-->
+
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.
  
−
<!--TERM-->  '''s'''
+
== Parameters ==
−
<!--DEFINITION-->        the player name you want to delete
+
{| class="wikitable"
 +
! Name !! Type !! Meaning
 +
|-
 +
| pname || string || The character's name.
 +
|}
  
−
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
 +
</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.
  
−
if(self.type != UNIT_ST_PC) quit;
+
== See also ==
−
 
+
* [[Manual:DIL Manual/isplayer()|isplayer()]]
−
if (self.level>200)
+
* [[Manual:DIL Manual/set password()|set_password()]]
−
        goto admin_delete;
+
* [[Manual:DIL Manual/access|access]]
−
 
 
−
:char_delete:
 
−
        if (arg!="self forever")
 
−
                {
 
−
                sendtext ("To delete your char type:  'delete self forever'&amp;n",self);
 
−
                quit;
 
−
                }
 
−
 
 
−
err:=loadstr("delete.txt",temp);
 
−
 
 
−
if (err&lt;1)
 
−
        goto no_insure;
 
−
 
 
−
sendtext (temp,self);
 
−
 
 
−
sendtext ("If your sure you still want to delete your character, 'say delete me'&amp;n",self);
 
−
sendtext ("Doing anything else will abort the deletion.&amp;n",self);
 
−
 
 
−
wait (SFB_CMD, self==activator);
 
−
if (command ("say"))
 
−
 
 
−
        if (argument=="delete me")
 
−
        if (self.extra.[CLAN_RANK]!=null)
 
−
                exec ("cdefect",self);
 
−
                delete_player(self.name);
 
−
 
 
−
sendtext("Deletion aborted&amp;n",self);
 
−
 
 
−
quit;
 
−
 
 
−
        :no_insure:
 
−
                if (self.extra.[CLAN_RANK]!=null)
 
−
                exec ("cdefect",self);
 
−
                        delete_player(self.name);
 
−
 
 
−
quit;
 
−
        :admin_delete:
 
−
        if (arg=="self forever")
 
−
                goto char_delete;
 
−
if (arg==""){
 
−
sendtext("You must supply a characters name to delete one.&amp;n",self);
 
−
quit;
 
−
}
 
−
 
 
−
if (arg==self.name){
 
−
sendtext ("To delete self you need to type 'delete self forever'&amp;n",self);
 
−
quit;
 
−
}
 
−
 
 
−
if (not isplayer(arg))
 
−
        {
 
−
        sendtext (arg+" is not a character.&amp;n",self);
 
−
        quit;
 
−
        }
 
−
dilcopy ("god_delete@clans("+arg+")",self);
 
−
 
 
−
        sendtext (arg+" has been deleted.&amp;n",self);
 
−
quit;
 
−
}
 
−
dilend
 
−
 
 
−
 
 
−
 
 
−
---~---~---~---~---~---~---~---~---
 
−
 
 
−
</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