OnDialogRespond Login
#2

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.
PHP код:
    if(dialogid ==  DIALOG_LOGIN)
    {
        if(!
response)
        {
            
SCM(playeridCOLOR_WHITE"SERVER: You have been kicked out of the server because you failed to respond.");
            
Kick(playerid);
            return 
1;
        }
        new 
hashpass[129];
        
WP_Hash(hashpasssizeof(hashpass), inputtext);
        if(!
strcmp(hashpasspInfo[playerid][e_USER_PASSWORD], false))
        {
            
SetPVarInt(playerid"gLogged"1);
            
SCM(playeridCOLOR_WHITE"SERVER: You have successfully logged into your account.");
            
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra true, .extra playerid);
            
SetPlayerScore(playeridpInfo[playerid][e_USER_SCORES]);
            
GivePlayerMoney(playeridpInfo[playerid][e_USER_MONEY]);
        }
        else
        {
            new 
loginint GetPVarInt(playerid"FailedLoginAttempt");
            if(
loginint >= 3)
            {
                
DeletePVar(playerid"FailedLoginAttempt");
                
SCM(playeridCOLOR_RED"SERVER: You have used up all your login attempts, and hence got kicked.");
                
Kick(playerid);
            }
            else
            {
                new 
fstr[91], L_DIALOG[380];
                
format(fstrsizeof(fstr), "SERVER: The password you have entered is incorrect, please try again (%d/3 attempts used)."loginint 1);
                
SCM(playeridCOLOR_REDfstr);
                
SetPVarInt(playerid"FailedLoginAttempt"loginint 1);
                
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD,"Login:"L_DIALOG"Login""");
            }
        }
        return 
1
Reply


Messages In This Thread
OnDialogRespond Login - by Hunud - 17.02.2017, 15:00
Re: OnDialogRespond Login - by Threshold - 17.02.2017, 15:08
Re: OnDialogRespond Login - by Hunud - 17.02.2017, 15:26
Re: OnDialogRespond Login - by Threshold - 17.02.2017, 15:32
Re: OnDialogRespond Login - by Hunud - 17.02.2017, 15:34
Re: OnDialogRespond Login - by Hunud - 17.02.2017, 15:53

Forum Jump:


Users browsing this thread: 2 Guest(s)