Help with a code[REP+] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with a code[REP+] (
/showthread.php?tid=371047)
Help with a code[REP+] -
Strech - 22.08.2012
Hello Guys.How i can restrict a lastname?That can be used from a person only,or a gang.Thanks in advance.
Re: Help with a code[REP+] -
Strech - 22.08.2012
Only the lastname like _Kingston.
Re: Help with a code[REP+] -
CentyPoo - 22.08.2012
pawn Код:
//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);
}
Untested but I think it should work.
https://sampwiki.blast.hk/wiki/Strfind
Re: Help with a code[REP+] - HuSs3n - 22.08.2012
pawn Код:
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;
}
or
pawn Код:
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;
}