diff options
author | Reid <reidyaro@gmail.com> | 2016-04-19 08:25:38 +0200 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2016-04-19 08:25:38 +0200 |
commit | 5b6d5abb7c25fce31cc818a5aa9dbb66aeec5f26 (patch) | |
tree | 820b0b38cc36bbb6814bf7615b7746e64e49f705 /npc | |
parent | fd76751277efbc16e662f968a4f45dad01839129 (diff) | |
download | serverdata-5b6d5abb7c25fce31cc818a5aa9dbb66aeec5f26.tar.gz serverdata-5b6d5abb7c25fce31cc818a5aa9dbb66aeec5f26.tar.bz2 serverdata-5b6d5abb7c25fce31cc818a5aa9dbb66aeec5f26.tar.xz serverdata-5b6d5abb7c25fce31cc818a5aa9dbb66aeec5f26.zip |
Add a new function called npctalkonce.
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/main.txt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt index cd71b8ea..12484f11 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -188,3 +188,35 @@ function script compareandsetq { } return false; } + +// Use a delay to prevent spams from NPC that display text without the +// use of (a) close/next function(s). +// Argument: +// 0 Text to display +// 1 Lock delay (default = 1) +// 2 Message function: (default = 0) +// 0 = npctalk3 +// 1 = npctalk +// 2 = message +function script npctalkonce { + if ((.@current_time = gettimetick(2)) < Repeat_NPC_lock) + { + return false; + } + Repeat_NPC_lock = .@current_time + getarg(1,1); + + if (getarg(2,0) == 0) + { + npctalk3 getarg(0); + } + else if (getarg(2,0) == 1) + { + npctalk getarg(0); + } + else if (getarg(2,0) == 2) + { + message strcharinfo(0), getarg(0); + } + + return true; +} |