Here is one realy badass non RP name Kicker
It kicks, who dont have _ in name, name lenght shorter than 6, if there will any number, or wont be name first letter capital and surname first letter capital.
pawn Код:
new username[24];
GetPlayerName(playerid,username,sizeof(username));
new name1 = strfind(username, "kill", true);
new name2 = strfind(username, "__", true);
new name3 = strfind(username, "123", true);
new name4 = strfind(username, "asd", true);
new name5 = strfind(username, "xx", true);
if(name1 != -1 || name2 != -1 || name3 != -1 || name4 != -1 || name5 != -1)
{
SendClientMessage(playerid,COLOR_WARN,"WARNING: You don't have valid Role Play Name, in SA:MP client change it to right format: Name_Surname.");
Kick(playerid);
return 1;
}
pawn Код:
IsValidRPName(rpname[])
{
if(strfind(rpname,"_",true) == -1) { return 0; }
if(strlen(rpname) < 6) { return 0; }
new pos;
while(pos <= strlen(rpname))
{
new str[5];
for(new lenght = 0; lenght < 10; lenght++)
{
format(str,sizeof(str),"%d",lenght);
if(strfind(rpname[pos],str,true) != -1)
{
return 0;
}
}
pos++;
}
new part[2][12];
new name,surname;
split(rpname,part,'_');
if(part[0][0] >= 'A' && part[0][0] <= 'Z')
{
name = 1;
}
if(part[1][0] >= 'A' && part[1][0] <= 'Z')
{
surname = 1;
}
if(name == 1 && surname == 1)
{
return 1;
}
else
{
return 0;
}
}
Example
pawn Код:
if(!IsValidRPName(username))
{
SendClientMessage(playerid,COLOR_WARN,"WARNING: You don't have valid Role Play Name, in SA:MP client change it to right format: Name_Surname.");
Kick(playerid);
return 1;
}