SA-MP Forums Archive
cnhange this.... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: cnhange this.... (/showthread.php?tid=82734)



cnhange this.... - Mowgli - 20.06.2009

how to i change this so that it detects if u [number] in ur name? so if ur name is '[4]Mowgli' or 'mowgli[6]' or somthing... u get kicked

Код:
public OnPlayerConnect(playerid)
{
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid,pName,sizeof(pName));
	if(strfind(pName,"_",true) == -1) { Kick(playerid); }
	return 1;
}



Re: cnhange this.... - Correlli - 20.06.2009

If you want something like [4]:
pawn Код:
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof(playerName));
strdel(playerName, 6, sizeof(playerName));
if(!strfind(playerName, "[4]", true))
{
// code
}



Re: cnhange this.... - yezizhu - 20.06.2009

pawn Код:
stock func(const pName[]){
  new
    start = strfind(pName,"[");
    end = strfind(pName,"]");
  if(start != -1 && end != -1 && start < end){
    while(start < end){
      if(pName[start] < '0' && pName[start] > '9') return false;
      start++;
    }
  }else return false;
  return true;
}