From f56a2ead75722610497428ec269d6436d5cf2a01 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 16 Jul 2018 22:11:26 -0300 Subject: [UNSAFE] Function to validate pincode --- npc/functions/main.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'npc') 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) + "|@@]"; } -- cgit v1.2.3-70-g09d2