Login - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Login (
/showthread.php?tid=375871)
Login -
tyler12 - 08.09.2012
I can login with any pass, but if I /login again with the wrong pass, it says error, but if its right, I can login
pawn Код:
CMD:login(playerid,params[])
{
if(!fexist(Path(playerid))) return SendClientMessage(playerid,-1,"You are not registered.");
if(isnull(params)) return ShowUsageMessage(playerid,"/login [Pass]");
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),params);
if(strcmp(params,pInfo[playerid][Pass]))
{
SendClientMessage(playerid,-1,"ERROR: Wrong Pass");
}
else
{
pLogged[playerid] = 1;
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
}
return 1;
}
Any help?
Thanks, tyler
Re: Login - Glint - 08.09.2012
What about trying this
pawn Код:
CMD:login(playerid,params[])
{
if(!fexist(Path(playerid))) return SendClientMessage(playerid,-1,"You are not registered.");
if(isnull(params)) return ShowUsageMessage(playerid,"/login [Pass]");
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),params);
if(!strcmp(params,pInfo[playerid][Pass]))
{
pLogged[playerid] = 1;
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
}
else
{
SendClientMessage(playerid,-1,"ERROR: Wrong Pass");
}
return 1;
}
Re: Login -
tyler12 - 08.09.2012
strcmp returns 0 if the string matches, therefore it wouldnt work.
EDIT:I checked it anyway, dosent work.
Quote:
Originally Posted by Lexi'
What about trying this
pawn Код:
CMD:login(playerid,params[]) { if(!fexist(Path(playerid))) return SendClientMessage(playerid,-1,"You are not registered."); if(isnull(params)) return ShowUsageMessage(playerid,"/login [Pass]"); new hashpass[129]; WP_Hash(hashpass,sizeof(hashpass),params); if(!strcmp(params,pInfo[playerid][Pass])) { pLogged[playerid] = 1; INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid); SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in"); } else { SendClientMessage(playerid,-1,"ERROR: Wrong Pass"); } return 1; }
|
still nothing
Re: Login -
clarencecuzz - 08.09.2012
Well it would, because if(!strcmp is the same as if(strcmp... == 0).
Make sure you're using INI_ParseFile for loadaccount BEFORE they are able to login.
Re: Login -
tyler12 - 08.09.2012
Quote:
Originally Posted by clarencecuzz
Well it would, because if(!strcmp is the same as if(strcmp... == 0).
Make sure you're using INI_ParseFile for loadaccount BEFORE they are able to login.
|
holy facedesk and a half.
Im a noob. Thanks alot
repped both for helping!
EDIT:Just so you know, I was using plain text for testing purposes. Whirlpool added again.