McNeri Posted November 14, 2012 Posted November 14, 2012 Hi, Help me guys.. Please edit this script, when players login in-game and he/she has not set the password of his/her account, the NPC will automatically pop-up and ask to set the password. Security_Manager.txt Sorry bad english. Quote
Bin4ry Posted November 14, 2012 Posted November 14, 2012 OnPCLoginEvent: if (!#AccountPW$) { mes "[security Manager]"; mes "Please set a 2nd password:"; next; input .@AccountPW$; next; set .@RandomFinalize,rand(100,999); mes "Are you sure you want to set your password to ^FF0000"+.@AccountPW$+"^000000? If your 100% sure type the number ^0000FF"+.@RandomFinalize+"^000000."; input .@Finalize; if(.@Finalize!=.@RandomFinalize) { next; mes "You really should set up a personal account password."; close; } set #AccountPW$,.@AccountPW$; next; mes "Your password has been set as ^FF0000"+#AccountPW$+"^000000."; close; } else { mes "[securty Manager]"; mes "Enter your personal account password."; input .@AccountPW$; if (.@AccountPW$ != #AccountPW$) { mes "[securty Manager]"; mes "Invalid password entry."; close2; atcommand "@kick "+strcharinfo(0); end; } next; mes "[securty Manager]"; mes "You password has been accepted."; close; } } Replace whole OnPCLoginEvent Quote
AnnieRuru Posted November 14, 2012 Posted November 14, 2012 if (!#AccountPW$) { [Error]: script:op_1: argument is not a number (op=C_LNOT) yeah rathena script engine sux ! operator only usable in integer value, cannot use for string btw this script ... is broken also ... [Debug]: npc_scriptcont: SecurityManager (sd->npc_id=110000212) is not 'UnknownNPC' (id=0). why the script start with next; command -.-" Quote
McNeri Posted November 14, 2012 Author Posted November 14, 2012 thanks darristan thanks darristan Quote
Bin4ry Posted November 14, 2012 Posted November 14, 2012 Well I'm just following his script adding a ! check, didn't know that doesn't work for $ Thanks for telling AnnieRuru. Quote
GmOcean Posted November 14, 2012 Posted November 14, 2012 (edited) You could however do something like this: if( !axtoi(#AccountPW$) ){do blah;} OR set .@var,axtoi(#AccountPW$); if(!.@var){do blah;} That'll turn your string into an interger, by assuming its a Hex value, this way, any Alpha-numeric combinations will be accepted, vs atoi (which only accepts strings consitant of only numbers). Edit: NVM, that wont work lol.. just realized hex only has A->F as letters lmao, but you CAN do this: if( !getstrlen(#AccountPW$) ){do blah;} Edited November 14, 2012 by GmOcean 1 Quote
Ryokem Posted November 15, 2012 Posted November 15, 2012 Edit: NVM, that wont work lol.. just realized hex only has A->F as letters lmao, but you CAN do this: 'ax'toi means a conversion in hexadecimal system, that has numbers from 0 to 9 and letters from A to F. Mostly used in web programming, eA and rA use it a lot for color flags. @GmOcean: if (str$ == "") That's a mere trick but still not the best as efficiency. Works only in rAthena of course as it has some sorto of direct string comparator. It will need the system to make some implicit conversions due to the odd coding to make it like it is. GmOcean's solution was more suitable and actually nicer for the CiC. if( !getstrlen(str$) ) 2 Quote
GmOcean Posted November 15, 2012 Posted November 15, 2012 @Euphy - I do know that is a possibility, however, I was merely trying to solve his !variable use lol. Also, i would normally use ( == " " ) Quote
AnnieRuru Posted November 15, 2012 Posted November 15, 2012 Ryokem post yeah, just a peak at script.c, our crappy script engine parse == C_EQ operator very ugly even C_LNOT + BUILDIN_FUNC(getstrlen) is much cleaner me also want to do like this from now on xD http://rathena.org/board/topic/73137-script-core-improvements/ remember to support this project XD Quote
Question
McNeri
Hi,
Help me guys.. Please edit this script, when players login in-game and he/she has not set the password of his/her account, the NPC will automatically pop-up and ask to set the password.
Security_Manager.txt
Sorry bad english.
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.