ESC allows player to join with no password
#7

Just add a check under OnPlayerRequestSpawn just in case they manage to get around this. Make a variable that detects whether a player is logged in or not.

pawn Код:
new LoggedIn[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    LoggedIn[playerid] = 0;
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == login)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(strcmp(hashpass, pInfo[playerid][Pass], false) == 0)
            {
                INI_ParseFile(Path(playerid),"loadaccount_user",.b Extra = true, .extra = playerid);
                SetPlayerScore(playerid,pInfo[playerid][Scores]);
                GivePlayerMoney(playerid,pInfo[playerid][Money]);
                SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
                LoggedIn[playerid] = 1; //Player is logged in
            }
            else
            {
                ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT ,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
                return 1;
            }
        }
    }
    return 0;
}

public OnPlayerRequestSpawn(playerid)
{
    if(LoggedIn[playerid] == 0) //if they're not logged in
    {
        ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT ,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nYou must login before spawning!","Login","Quit");
        return 0;
    }
    return 1;
}
Your login part was only a little wrong, you just need to check case sensitivity in people's passwords.
EDIT: Overthinking it, I don't think Whirlpool uses uppercase and lowercase mixtures of letters...
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)