Registering/Logging in multiple times bug
#1

When a player enters the server, the view is set on LS, with the registration/logging in GUI, when he enters invalid password, the view switches to skin selection, and he can spawn using the arrows and spawn buttons below, while GUI is still asking for a password. He can spawn and move freely while the GUI is on the screen. How do i fix it ?
Code:
if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Please input your password below to login.", "Login", "Quit");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, COLOR_RED, "Wrong password.");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Please input your password below to login.", "Login", "Quit");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
            GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
            SendClientMessage(playerid,COLOR_WHITE, "SERVER: You have successfully logged in.");
        }
		return 1;
    }
Reply
#2

You could use TogglePlayerSpectating so that the player can't click the spawn button.
Reply
#3

When i put in the password it spawns me without requesting me to select a skin and :
"SERVER: You have successfully logged in."
Server closed the connection.
Reply
#4

Does that happens with wrong passwords or with the right password?

Also, when you toggle player spectating to 0 it will spawn you automatically, therefore you won't be able to select the skin during the class request.
Reply
#5

Errr. So how do i make it to allow to choose a skin ? If i toggle spectating on class request it spawns, if on player spawn, the player cant select the skin and is stuck.
Reply
#6

Use ForceClassSelection before toggling player spectating to 0.
Reply
#7

That fixed it. Also, now when the first time the password is wrong, i can spawn with the keys below again, but when the password is wrong the second and following times, i cant again.
Reply
#8

Did you use TogglePlayerSpectating after
Code:
if(udb_hash(inputtext) != tmp) {
?

If not, maybe try using it and see if it works.
Reply
#9

Thanks it works but yet another problem. If i press login when leaving the input area blank, the arrow keys are back
Reply
#10

Change
Code:
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Please input your password below to login.", "Login", "Quit");
to

Code:
if (!strlen(inputtext))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Please input your password below to login.", "Login", "Quit");
TogglePlayerSpectating(playerid, 1);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)