08.12.2014, 19:25
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:
The function:
Thanks!
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);
}
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;
}