17.02.2017, 15:08
Your password is not being loaded correctly. Meaning 'pInfo[playerid][e_USER_PASSWORD]' is empty.
Strcmp returns 0 if either of the two strings being compared are empty/null.
EDIT: And please learn to indent your code... otherwise you will end up making simple but stupid mistakes.
Strcmp returns 0 if either of the two strings being compared are empty/null.
EDIT: And please learn to indent your code... otherwise you will end up making simple but stupid mistakes.
PHP код:
if(dialogid == DIALOG_LOGIN)
{
if(!response)
{
SCM(playerid, COLOR_WHITE, "SERVER: You have been kicked out of the server because you failed to respond.");
Kick(playerid);
return 1;
}
new hashpass[129];
WP_Hash(hashpass, sizeof(hashpass), inputtext);
if(!strcmp(hashpass, pInfo[playerid][e_USER_PASSWORD], false))
{
SetPVarInt(playerid, "gLogged", 1);
SCM(playerid, COLOR_WHITE, "SERVER: You have successfully logged into your account.");
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
SetPlayerScore(playerid, pInfo[playerid][e_USER_SCORES]);
GivePlayerMoney(playerid, pInfo[playerid][e_USER_MONEY]);
}
else
{
new loginint = GetPVarInt(playerid, "FailedLoginAttempt");
if(loginint >= 3)
{
DeletePVar(playerid, "FailedLoginAttempt");
SCM(playerid, COLOR_RED, "SERVER: You have used up all your login attempts, and hence got kicked.");
Kick(playerid);
}
else
{
new fstr[91], L_DIALOG[380];
format(fstr, sizeof(fstr), "SERVER: The password you have entered is incorrect, please try again (%d/3 attempts used).", loginint + 1);
SCM(playerid, COLOR_RED, fstr);
SetPVarInt(playerid, "FailedLoginAttempt", loginint + 1);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login:", L_DIALOG, "Login", "");
}
}
return 1;