Not getting kicked when cancelling dialog
#1

So, I need my player to get kicked if he clicks the cancel button while on the login screen. Nothing happens.

My code:

pawn Код:
case DIALOG_LOGIN:
        {
            if (!response)
            return Kick(playerid);
            else // Pressed ENTER or clicked 'Login' button
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    if(PlayerInfo[playerid][pTutorialDone] == 0) return SetTimerEx("AgeSetup", 1000, false, "i", playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetSpawnInfo(playerid, 0, 26, -2210.7092,-2450.5549,30.4495, 52.1403, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
                    LoadFightingStyle(playerid);
                    FadeColorForPlayer(playerid,0,0,0,255,0,0,0,0,15,0);
                    SCM(playerid, COLOR_WHITE, "You have successfully logged in.");
                    TogglePlayerSpectating(playerid, false);
                    PlayerLogged[playerid] = true;
                    SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
                    new playername[24];
                    GetPlayerName(playerid, playername, sizeof(playername));

                    for(new i=1; i < MAX_DVEHICLES; i++)
                    {
                        if(VehicleCreated[i] == VEHICLE_PLAYER && strcmp(VehicleOwner[i], playername) == 0)
                        {
                            UpdateVehicle(i, 0);
                        }
                    }
                    if(PlayerInfo[playerid][pBanned] == 1)
                    {
                        SCM(playerid, COLOR_LIGHTRED, "AdmCmd: You have been banned for logging into a banned account.");
                        SetTimerEx("UnsetBan", 500, 0, "i", playerid);
                    }
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\n""Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
Reply
#2

Find the line defining the Dialog ID:
pawn Код:
#define DIALOG_LOGIN /*the number here*/
Change that number to something random, like 8192, compile and then try again. There might be conflicting dialogs? Tell me if that works first.
Reply
#3

That was sadly not the issue.
Reply
#4

pawn Код:
if (response)
 {
    //...
 }else Kick(playerid);
Reply
#5

Not working. :/
Reply
#6

Quote:
Originally Posted by Chrillzen
Посмотреть сообщение
So, I need my player to get kicked if he clicks the cancel button while on the login screen. Nothing happens.

My code:

pawn Код:
case DIALOG_LOGIN:
        {
            if (!response)
            return Kick(playerid);
            else // Pressed ENTER or clicked 'Login' button
            {
replace with


pawn Код:
case DIALOG_LOGIN:
        {
            if (!response) { Kick(playerid); } //Kicked!!!!!
            else // Pressed ENTER or clicked 'Login' button
            {
Reply
#7

Still not working. :/
Reply
#8

There nothing wrong with his initial code, thus why reply with crap?

Can you show us the ShowPlayerDialog, which displays this dialog?
Reply
#9

Sure.

pawn Код:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Welcome back to New Jersey Roleplay, please type in your password to log in.\nYou have 60 seconds to log in before you kicked.","Login","Quit");
Here's the whole thing:

pawn Код:
forward login_dialog(playerid);
public login_dialog(playerid)
{
    SetTimerEx("LoginTimer", 60000, false, "i", playerid);
    TextDrawShowForPlayer(playerid,Textdraw0);
    TextDrawShowForPlayer(playerid,Textdraw1);
    SetPlayerCameraPos(playerid, -2193.8313,-2481.8018,56.6954);
    SetPlayerCameraLookAt(playerid, -2148.7173,-2415.4434,55.6071);
    for( new i = 0; i <= 100; i ++ ) SCM(playerid, -1, "" );
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Welcome back to New Jersey Roleplay, please type in your password to log in.\nYou have 60 seconds to log in before you kicked.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Register","Welcome to New Jersey Roleplay.\nTo register an account please type in your desired password below.","Register","Quit");
    }
    return 1;
}
Reply
#10

Try this:
pawn Код:
case DIALOG_LOGIN:
        {
            if (!response)
            {
                Kick(playerid);
                return 1;
            }
            if(response) // Pressed ENTER or clicked 'Login' button
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    printf("Loading player stats..");
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    if(PlayerInfo[playerid][pTutorialDone] == 0) return SetTimerEx("AgeSetup", 1000, false, "i", playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetSpawnInfo(playerid, 0, 26, -2210.7092,-2450.5549,30.4495, 52.1403, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
                    LoadFightingStyle(playerid);
                    FadeColorForPlayer(playerid,0,0,0,255,0,0,0,0,15,0);
                    SCM(playerid, COLOR_WHITE, "You have successfully logged in.");
                    TogglePlayerSpectating(playerid, false);
                    PlayerLogged[playerid] = true;
                    SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
                    new playername[24];
                    GetPlayerName(playerid, playername, sizeof(playername));

                    for(new i=1; i < MAX_DVEHICLES; i++)
                    {
                        if(VehicleCreated[i] == VEHICLE_PLAYER && strcmp(VehicleOwner[i], playername) == 0)
                        {
                            UpdateVehicle(i, 0);
                        }
                    }
                    if(PlayerInfo[playerid][pBanned] == 1)
                    {
                        SCM(playerid, COLOR_LIGHTRED, "AdmCmd: You have been banned for logging into a banned account.");
                        SetTimerEx("UnsetBan", 500, 0, "i", playerid);
                    }
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\n""Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)