PDA

View Full Version : PartNameKick


rocketbunny
12/07/2019, 07:23 AM
I want to kick a player when using a nickname like "[PRO] boi" onplayerconnect
new ForbiddenPartName[] =
{
"[","]","(",")","-","=","$","@","."
};

public OnPlayerConnect(playerid)
{
new string[128];
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);

if(strfind(PlayerName, ForbiddenPart, true) == -1) {
SendClientMessage(playerid,red, "ATTENTION: Your name is not Allowed on this server, you have been Kicked!.");
format(string,sizeof(string),"|- Player %s (Id:%d) has been Automatically Kicked. | Reason: Forbidden Name -|",PlayerName,playerid);
SendClientMessageToAll(red, string); print(string);
return Kick(playerid);
}
return 1;
}

Mugala
12/07/2019, 08:04 AM
strfind returns the starting integer from string, so there must be != -1 instead of == -1