Login system not working - 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 system not working (
/showthread.php?tid=336038)
Login system not working -
nmader - 20.04.2012
Alright, so I have created a login script, but it does not appear to work, it saves the password, hashes it, but I think something may be wrong with my if statement that tells if the inputtext equals what is saved. But I cannot find the issue.
pawn Код:
case DIALOG_LOGIN:
{
if(!response) return pInfo[playerid][ForcedChange] = 1 && ShowPlayerDialog(playerid, DIALOG_NAMECHANGE, DIALOG_STYLE_INPUT, "Namechange...","Please select your new desired name","Select","Cancel");
if( response )
{
if(udb_hash(inputtext) == pInfo[playerid][pPass])
{
pInfo[playerid][pLogged] = 1;
SendClientMessage(playerid, -1, "You have been logged in!");
SpawnPlayer(playerid);
TogglePlayerControllable(playerid, 1);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login...", "Please Login, if this is not your account his 'Change'", "Enter","Change");
SendClientMessage(playerid, 0x5F5F5FFF, "ERROR: You have entered an invalid password!");
}
}
Re: Login system not working -
coole210 - 20.04.2012
Did you load pInfo[playerid][pPass] before the if statement?
Re: Login system not working -
Face9000 - 21.04.2012
You use Y_INI for saving/loading players accounts?
Use
pawn Код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
after
pawn Код:
SendClientMessage(playerid, -1, "You have been logged in!");