summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-11-06 16:04:38 -0300
committerJesusaves <cpntb1@ymail.com>2019-11-06 16:04:38 -0300
commitf7dc10cf26e1b746ba6524255bcf8713ded841b1 (patch)
treed311fc415ba9b4e3e07ed525bf2d577528a87d9e /npc/functions
parentfafc1246975e4e7306a6a1ff3adf10e9e77cc3af (diff)
downloadserverdata-f7dc10cf26e1b746ba6524255bcf8713ded841b1.tar.gz
serverdata-f7dc10cf26e1b746ba6524255bcf8713ded841b1.tar.bz2
serverdata-f7dc10cf26e1b746ba6524255bcf8713ded841b1.tar.xz
serverdata-f7dc10cf26e1b746ba6524255bcf8713ded841b1.zip
Function to delete char regs, and make both work on live chars
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/util.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index 1190714e7..f89c3a992 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -40,6 +40,36 @@ function script DelAccRegFromEveryPlayer {
query_sql("DELETE FROM `acc_reg_num_db` WHERE `key`='"+getarg(0)+"'");
query_sql("DELETE FROM `acc_reg_str_db` WHERE `key`='"+getarg(0)+"'");
+
+ // Del variables which SQL can't reach
+ .@c = getunits(BL_PC, .@players, MAX_CYCLE_PC);
+ for (.@i = 0; .@i < .@c; .@i++) {
+ if (compare(getarg(0), "$"))
+ setd(getarg(0), "");
+ else
+ setd(getarg(0), 0);
+ }
+ return;
+}
+
+// Delete an char_reg entry from all players. Full arrays only. Affect num and str db.
+// WARNING, irreversible and dangerous!
+// DelChrRegFromEveryPlayer( KEY )
+function script DelChrRegFromEveryPlayer {
+ if (getarg(0, "error") == "error")
+ return;
+
+ query_sql("DELETE FROM `char_reg_num_db` WHERE `key`='"+getarg(0)+"'");
+ query_sql("DELETE FROM `char_reg_str_db` WHERE `key`='"+getarg(0)+"'");
+
+ // Del variables which SQL can't reach
+ .@c = getunits(BL_PC, .@players, MAX_CYCLE_PC);
+ for (.@i = 0; .@i < .@c; .@i++) {
+ if (compare(getarg(0), "$"))
+ setd(getarg(0), "");
+ else
+ setd(getarg(0), 0);
+ }
return;
}