From 4b110c5b992f196ff37f7eb4d440e7fe43f3800d Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 28 Apr 2020 23:40:18 -0300 Subject: Forgive idlers, optional captcha mode 2/3 which displays warnings --- npc/functions/captcha.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'npc/functions') diff --git a/npc/functions/captcha.txt b/npc/functions/captcha.txt index 776501c57..cab6f869e 100644 --- a/npc/functions/captcha.txt +++ b/npc/functions/captcha.txt @@ -10,6 +10,10 @@ // CAPTCHA_OP$ => The operation, defaults to "+" // $@BOTCHECK_TARGET => The account ID of the char being probed // @captcha_cooldown => anti-flood +// $CAPTCHA (bitmask) +// 0 - Captcha Disabled +// 1 - Captcha Enabled +// 2 - Display warnings (@captcha_lastwarning/@captcha_lastwarningt) // CaptchName, names the number function script CaptchName { @@ -167,6 +171,12 @@ OnTimer5000: continue; } + // 2.1 Player is AFK for more than 30 seconds + if (checkidle() > 30) { + detachrid(); + continue; + } + // 3. This is a good target, lets do this .@g$=""; CaptchExample(); @@ -225,6 +235,18 @@ function captchaProbe { } // Nothing happened, lets wait + if ($CAPTCHA & 2) { + if (!@captcha_lastwarningt) + @captcha_lastwarningt=3; + if (!@captcha_lastwarning) + @captcha_lastwarning=gettimetick(2); + + if (@captcha_lastwarning < gettimetick(2)) { + dispbottom l("CAPTCHA: You have %s minute(s) remaining", CaptchName(@captcha_lastwarningt)); + @captcha_lastwarningt-=1; + @captcha_lastwarning+=60; + } + } return; } -- cgit v1.2.3-60-g2f50