summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-07-16 22:11:26 -0300
committerJesusaves <cpntb1@ymail.com>2018-07-16 22:11:26 -0300
commitf56a2ead75722610497428ec269d6436d5cf2a01 (patch)
treeee548da41fd7b1ce7a6c878261d2dd395d9a45a2
parenta8dbb8d4d91d454027c85a01455e8f8937392e1e (diff)
downloadserverdata-f56a2ead75722610497428ec269d6436d5cf2a01.tar.gz
serverdata-f56a2ead75722610497428ec269d6436d5cf2a01.tar.bz2
serverdata-f56a2ead75722610497428ec269d6436d5cf2a01.tar.xz
serverdata-f56a2ead75722610497428ec269d6436d5cf2a01.zip
[UNSAFE] Function to validate pincode
-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) + "|@@]";
}