SA-MP Forums Archive
Help in dialog. - 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: Help in dialog. (/showthread.php?tid=522581)



Help in dialog. - iSkate - 28.06.2014

pawn Код:
case DIALOG_REGISTER:
            {
                if(!response)
                {
                    Kick(playerid);
                }
                if(response)
                {
                    if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                    new INI:File = INI_Open(UserPath(playerid));
                    INI_SetTag(File,"data");
                    INI_WriteInt(File,"Password",udb_hash(inputtext));
                    INI_WriteInt(File,"Cash",0);
                    INI_WriteInt(File,"Admin",0);
                    INI_WriteInt(File,"Kills",0);
                    INI_WriteInt(File,"Deaths",0);
                    INI_WriteInt(File,"Banned",0);
                    INI_Close(File);
                   
                    new pname[MAX_PLAYER_NAME], string[128];
                    GetPlayerName(playerid, pname, sizeof(pname));
                    format(string,256,""COL_GREEN"You have successfully registered the name "COL_WHITE"%s"COL_GREEN" with the password"COL_WHITE" %s.\n"COL_GREEN" Relog to save your stats.",pname, inputtext);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Registered",string,"Okay","");
                }
            }
When a player presses "Esc" button (!response), it does not kick him. There are 2 buttons in the dialog. Register and Quit. If someone presses the Quit button or the Esc button on their keyboard, it does not kick them but sends them the the class selection screen. Help please. Thanks in advance.

EDIT : Problem resolved. How : reason at page no. 2


Re: Help in dialog. - rickisme - 28.06.2014

change
Quote:

Kick(playerid);

to
Quote:

return Kick(playerid);

or
change
Quote:

if(response)

to
Quote:

else




Re: Help in dialog. - iSkate - 28.06.2014

Changed it but still the same.


Re: Help in dialog. - Rittik - 28.06.2014

Код:
case DIALOG_REGISTER:
            {
                if(response)
                {
                    if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                    new INI:File = INI_Open(UserPath(playerid));
                    INI_SetTag(File,"data");
                    INI_WriteInt(File,"Password",udb_hash(inputtext));
                    INI_WriteInt(File,"Cash",0);
                    INI_WriteInt(File,"Admin",0);
                    INI_WriteInt(File,"Kills",0);
                    INI_WriteInt(File,"Deaths",0);
                    INI_WriteInt(File,"Banned",0);
                    INI_Close(File);
                    
                    new pname[MAX_PLAYER_NAME], string[128];
                    GetPlayerName(playerid, pname, sizeof(pname));
                    format(string,256,""COL_GREEN"You have successfully registered the name "COL_WHITE"%s"COL_GREEN" with the password"COL_WHITE" %s.\n"COL_GREEN" Relog to save your stats.",pname, inputtext);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Registered",string,"Okay","");
                }
                else
                {
                    Kick(playerid);
                }
            }



Re: Help in dialog. - iSkate - 28.06.2014

Tried that already but doesn't work. Any other ideas.


Re: Help in dialog. - icra - 28.06.2014

Are you sure !response is being called?
Try this:

pawn Код:
if(!response) {
  printf("[DEBUG] Not response called for player %i.",playerid);
  return Kick(playerid);
}



Re: Help in dialog. - iSkate - 30.06.2014

No message in the server log. It means it is called for? Didn't really expect this problem to go this far.


Re: Help in dialog. - Faisal_khan - 30.06.2014

Is it kicking the player in icra's code?


Re: Help in dialog. - BroZeus - 30.06.2014

does it registers player correctly?


Re: Help in dialog. - iSkate - 30.06.2014

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Is it kicking the player in icra's code?
Nope.

When the player responds to the dialog, it registers him/her COMPLETELY. No errors/bugs but when he/she does not responds to it, it does not kick him/her.