SA-MP Forums Archive
Can't get a dialog to show - 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: Can't get a dialog to show (/showthread.php?tid=549783)



Can't get a dialog to show - FreddeN93 - 08.12.2014

When a player connects failing to fulfill the name requirement they don't get DIALOG_INVALIDNAME. Instead the game skips the dialog and just kicks the player. How can I let players connecting with a bad name see this error dialog?

I have this on OnPlayerConnect:

pawn Код:
if(!IsValidName(playerid))
    {
        ShowPlayerDialog(playerid, DIALOG_INVALIDNAME, DIALOG_STYLE_MSGBOX, "ERROR", "Your name is invalid. Your name must be an Role Play name. Please quit and try again.", "Quit", "");
        Kick(playerid);
    }
The function:

pawn Код:
stock IsValidName(playerid)
{
    if (IsPlayerConnected(playerid))
    {
        new player[24];
        GetPlayerName(playerid,player,24);
        for(new n = 0; n < strlen(player); n++)
        {
            if (player[n] == '_') return 1;
            if (player[n] == ']' || player[n] == '[') return 0;
        }
    }
    return 0;
}
Thanks!


Re: Can't get a dialog to show - Schneider - 08.12.2014

Use a timer to delay the kick for a few seconds.

pawn Код:
SetTimerEx("DelayKick", 2000, 0, "d", playerid);
pawn Код:
forward DelayKick(playerid);
public DelayKick(playerid)
{
    Kick(playerid);
    return 1;
}



Re: Can't get a dialog to show - NullBot - 08.12.2014

#define DIALOG_INVALIDNAME 31125


the Max dialogid is 32767