SA-MP Forums Archive
Player Name - 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: Player Name (/showthread.php?tid=144626)



Player Name - Sascha - 28.04.2010

How can I check on OnPlayerConnect if a player's name includes something like "shit"...
so that it kicks people like: Youareshit ...or Shitkid or so...



Re: Player Name - Correlli - 28.04.2010

https://sampwiki.blast.hk/wiki/GetPlayerName
https://sampwiki.blast.hk/wiki/Strfind


Re: Player Name - RyDeR` - 28.04.2010

At the top of ur script: >.>
pawn Код:
new
    BadNames[] =
    {
      "Ass",
      "YouAreShit",
      "ShitKid"
      // You can add more. Remember don't add a ',' at the last name, see above.
    }
;
And this is the code you can use to handle this: >.>
pawn Код:
new
    x,
    pName[MAX_PLAYER_NAME] = "YouAreShit" // I used = "YouAreShit" to test it.
;
do
{
    GetPlayerName(playerid, pName, sizeof(pName));
    if(strfind(BadNames[x], pName, true) != -1) return printf("%s has been kicked! (Bad Name)", pName);
    x++;
}
while((x != sizeof(BadNames)));