Can't get a dialog to show
#1

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!
Reply
#2

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;
}
Reply
#3

#define DIALOG_INVALIDNAME 31125


the Max dialogid is 32767
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)