Jump to content
  • 0

H> Please edit this?


McNeri

Question


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  98
  • Reputation:   2
  • Joined:  01/24/12
  • Last Seen:  

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.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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 -.-"

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

Well I'm just following his script adding a ! check, didn't know that doesn't work for $ :P

Thanks for telling AnnieRuru.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

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 by GmOcean
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

@GmOcean:

if (str$ == "")

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

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$) ) 

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

@Euphy - I do know that is a possibility, however, I was merely trying to solve his !variable use lol. Also, i would normally use ( == " " )

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

rep_up.png 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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...