22.08.2012, 08:07
Hello Guys.How i can restrict a lastname?That can be used from a person only,or a gang.Thanks in advance.
//OnPlayerConnect
new name[MAX_PLAYER_NAME;
GetPlayerName(playerid, name, sizeof(name));
if(strfind(name, "_Kingston", true) != -1 && //check if he's in a gang or not, not sure on your enums
{
Kick(playerid);
}
stock GetPlayerLastName(playerid)
{
new name[24];
GetPlayerName(playerid,name,24);
new pos = strfind(name,"_");
if(pos != -1)
{
strdel(name,0,pos+1);
}
return name;
}
CMD:lastname(playerid)
{
new str[128];
format(str,sizeof(str),"Your last name is %s",GetPlayerLastName(playerid));
SendClientMessage(playerid,0xFFFFFFFF,str);
return 1;
}
stock GetLastName(fullname[])
{
new str[24];
new pos = strfind(fullname,"_");
if(pos != -1)
{
strdel(fullname,0,pos+1);
}
format(str,sizeof(str),"%s",fullname);
return str;
}