summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/main.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index cf882f3a0..79f652c01 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -248,6 +248,26 @@ function script gf_accid {
return .@value[0];
}
+// Request pincode and validate it. Use any non-4-digits code to cancel. Failure will dc you.
+// Returns 1 if pin check is OK.
+function script validatepin {
+ mesc l("Please insert your pincode."), 1;
+ mesc l("WARNING: If you add a wrong pincode, you'll be disconnected.");
+ mesc l("Use @@ to cancel.", "##B-1##b");
+ mes "";
+ input .@pin$;
+ if (getstrlen(.@pin$) != 4)
+ return 0;
+ query_sql("SELECT userid FROM `login` WHERE account_id="+escape_sql(getcharid(3))+" AND pincode='"+escape_sql(.@pin$)+"' LIMIT 2", .@value$);
+ if (getarraysize(.@value$) != 1) {
+ atcommand "@kick "+strcharinfo(0);
+ return 0;
+ }
+ mesc l("Thanks, @@. We just wanted to be sure it was you.", .@value$);
+ mes "";
+ return 1;
+}
+
function script getquestlink {
return "[@@q" + getarg(0) + "|@@]";
}