Help with a code[REP+]
#1

Hello Guys.How i can restrict a lastname?That can be used from a person only,or a gang.Thanks in advance.
Reply
#2

Only the lastname like _Kingston.
Reply
#3

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
Reply
#4

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)