Player Name
#1

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...
Reply
#2

https://sampwiki.blast.hk/wiki/GetPlayerName
https://sampwiki.blast.hk/wiki/Strfind
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)