SA-MP Forums Archive
Dialogs keep popping up on login. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialogs keep popping up on login. (/showthread.php?tid=577644)



Dialogs keep popping up on login. - DarkLored - 13.06.2015

So I have made a few dialogs that will show up if a player tries to avoid them upon register now even if I complete them after checking if it is 0 they keep popping up and I have made sure everything is being saved correctly.

this is my code

pawn Код:
public OnPlayerConnect(playerid)
{
    for( new i; i < _: USER_DATA; ++i ) pInfo[ playerid ][ USER_DATA: i ] = 0;
   
    TogglePlayerSpectating(playerid, true);
    GetPlayerName(playerid, pInfo[playerid][USER_NAME], MAX_PLAYER_NAME);
   
    new Query[256], DBResult:Result;
    format(Query, sizeof(Query), "SELECT password FROM users WHERE username = '%s' LIMIT 0,1", DB_Escape(pInfo[playerid][USER_NAME]));
    Result = db_query(Database, Query);
    if(db_num_rows(Result))
    {
        if(pInfo[playerid][USER_PASSEDQUIZ] == 0)
        {
            ShowPlayerDialog(playerid, quizinfo, DIALOG_STYLE_MSGBOX, "Quiz","Before you start playing please take a quick roleplay quit\nThe quiz is based off 10 questions if you get 3 questions wrong you'll have to re take the quiz.", "Okay", "Quit");
            return 1;
        }
        if(pInfo[playerid][USER_BIRTHPLACE] == 0)
        {
            ShowPlayerDialog(playerid, selectbirthplace, DIALOG_STYLE_INPUT, "Where is your character from?", "Write the location of the place your character was born below.", "Sumbit", "");
            return 1;
        }
        if(pInfo[playerid][USER_AGE] == 0)
        {
            ShowPlayerDialog(playerid, selectage, DIALOG_STYLE_INPUT, "Select an age", "Select the age of your character you can choose 1 to 100.", "Sumbit", "");
            return 1;
        }
        if(pInfo[playerid][USER_CULTURE] == 0)
        {
            ShowPlayerDialog(playerid, selectculture, DIALOG_STYLE_INPUT, "What is your character's culture?", "Write the culture that your character will be roleplaying (Ex.American).", "Sumbit", "");
            return 1;
        }
        if(pInfo[playerid][USER_RACE] == 0)
        {
            ShowPlayerDialog(playerid, selectrace, DIALOG_STYLE_LIST, "Select your character's race", "White\nHispanic\nBlack\nAsian", "Select", "");
            return 1;
        }
        if(pInfo[playerid][USER_SKIN] == 0)
        {
            ShowPlayerDialog(playerid, selectskin, DIALOG_STYLE_INPUT, "Select your skin!", "Write the ID of the skin you desire.", "Sumbit", "");
            return 1;
        }
        db_get_field_assoc(Result, "password", pInfo[playerid][USER_PASSWORD], 129);
        ShowPlayerDialog(playerid, dlogin, DIALOG_STYLE_PASSWORD, "Login", "Write your password to login.", "Login", "Quit");
    }
    else ShowPlayerDialog(playerid, dregister, DIALOG_STYLE_PASSWORD, "Register", "Write your password to register", "Register", "Quit");
    db_free_result(Result);
    return 1;
}



Re: Dialogs keep popping up on login. - Konstantinos - 13.06.2015

You directly check if those variables are equal to 0 in order to show the dialogs and you have reset them to 0 right before. Without any loading if you save them, it won't work.

You can also remove the second button when those dialogs appear upon the register so the player cannot do anything else other than typing and responding to the dialog.


Re: Dialogs keep popping up on login. - DarkLored - 15.06.2015

Sorry for bumping this but I have brainstorming on possibilities of how to do this but I haven't found any can you give me any advice in any chance?