diff options
Diffstat (limited to 'npc/functions')
-rw-r--r-- | npc/functions/util.txt | 30 |
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; } |