19.07.2010, 00:59
(
Last edited by Toni; 19/07/2010 at 01:43 AM.
)
How to create forbidden names
So, lots of people wonder about this, and some don't know how to do it, I'll show you how!First off, lets look at the callback OnPlayerConnect(playerid).
pawn Code:
public OnPlayerConnect(playerid)
{
return 1;
}
The parameters are:
strfind(const string[], const sub[], bool:ignorecase=false, pos=0)
- const string[] = The name string that you want to kick (e.g "Dick")
- const sub[] = The main key word in the const string
- bool:ignorecase = false/true Case sensitive if set to true (e.g LoL will kick lol as well)
- pos != -1 if the string is not found
pawn Code:
public OnPlayerConnect(playerid)
{
if(strfind("LOSER", "LOSER", true) != -1)
{
SendClientMessage(playerid, 0xFF0000FF, "SERVER: That name is not allowed here!");
SendClientMessage(playerid, 0xFF0000FF, "SERVER: You have kicked");
Kick(playerid);
}
return 1;
}
I hoped that helped.
-Toni