summaryrefslogtreecommitdiff
path: root/world
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-04-12 15:28:25 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-12 15:28:25 -0400
commitd55ee9ec4a43cbc7d52619b6a473a4760bb9acdb (patch)
treece25b59dcb64068238be1c316859c74a2f66bf12 /world
parent641a0062bdde6d187a0c5bd5c7956ba47ed322cc (diff)
downloadserverdata-d55ee9ec4a43cbc7d52619b6a473a4760bb9acdb.tar.gz
serverdata-d55ee9ec4a43cbc7d52619b6a473a4760bb9acdb.tar.bz2
serverdata-d55ee9ec4a43cbc7d52619b6a473a4760bb9acdb.tar.xz
serverdata-d55ee9ec4a43cbc7d52619b6a473a4760bb9acdb.zip
add destroynpc command
Diffstat (limited to 'world')
-rw-r--r--world/map/npc/commands/_import.txt1
-rw-r--r--world/map/npc/commands/destroynpc.txt35
2 files changed, 36 insertions, 0 deletions
diff --git a/world/map/npc/commands/_import.txt b/world/map/npc/commands/_import.txt
index c0630138..d123d405 100644
--- a/world/map/npc/commands/_import.txt
+++ b/world/map/npc/commands/_import.txt
@@ -7,3 +7,4 @@ npc: npc/commands/changesex.txt
npc: npc/commands/class.txt
npc: npc/commands/pullrabbit.txt
npc: npc/commands/numa.txt
+npc: npc/commands/destroynpc.txt
diff --git a/world/map/npc/commands/destroynpc.txt b/world/map/npc/commands/destroynpc.txt
new file mode 100644
index 00000000..fcda52ef
--- /dev/null
+++ b/world/map/npc/commands/destroynpc.txt
@@ -0,0 +1,35 @@
+-|script|@destroynpc|32767
+{
+ callfunc "argv_splitter";
+ if (GM < get(.destroynpc, "GM") && GM < G_SYSOP)
+ goto L_GM;
+
+ set .@id, getnpcid(@argv$[0]);
+ if (@argv$[0] == "" || .@id < 1)
+ goto L_Failed;
+ if (gettimetick(2) - @destroynpc[0] > 300 || @destroynpc[1] != .@id)
+ goto L_Confirm;
+
+ gmlog "@destroynpc " + @args$;
+ message strcharinfo(0), "destroynpc : The operation succeeded.";
+ debugmes "!!! => npc destroyed: `"+@argv$[0]+"` ("+.@id+")";
+ if (1==1) destroy .@id; // FIXME: allow destroy to work as a non-terminator when arg0 is given
+ end;
+
+L_Confirm:
+ message strcharinfo(0), "destroynpc : ##BDANGER ZONE!##b This command permanently destroys a npc and its puppets (if any). Use the command again to confirm.";
+ setarray @destroynpc[0], gettimetick(2), .@id;
+ end;
+
+L_Failed:
+ message strcharinfo(0), "destroynpc : Impossible to find the target npc. Did you try putting the name in \"quotation marks\"? Some npcs also have an invisible postfix in their name, ie `#_M`.";
+ end;
+
+L_GM:
+ message strcharinfo(0), "destroynpc : GM command is level "+ get(destroynpc, "GM") +", but you are level " + GM;
+ end;
+
+OnInit:
+ registercmd chr(ATCMD_SYMBOL) + "destroynpc", strnpcinfo(0);
+ end;
+}