Jump to content
  • 0

H> Please edit this?


Question

9 answers to this question

Recommended Posts

Posted

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

Posted

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

Posted (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 by GmOcean
  • Upvote 1
Posted

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...