[Tutorial] Anti-Flood/Swear
#1

Hello there, a very simple Anti-flood system to keep Big Mouth and Rude players away from your server.

Okay, at the Top of your script before "main()" add this:
pawn Code:
new BadWords[][] = //You can add your words.
{
  "noob",
  "n00b",
  "fuck",
  "fucker",
  "ass",
  "dick"
};
Okay, for checking if the typed word is included in The Variable "BadWords" you need to use the Variable in OnPlayerText, so under OnPlayerText add this:
pawn Code:
public OnPlayerText(playerid, text[])
{
  for(new Words; Words < sizeof(BadWords); Words++) //Sets a loop as it checks the words one by one.
  {
     if(strfind(text,BadWords[Words],true) != -1 ) // Checks if the text includes any of the defined Swear Words or not
     {
        SendClientMessage(playerid, -1, "Using Swear Words is prohibited in the chat.");
        return 0; // return 0; to avoid sending the text in chat.
     }
  }
  return 1;
}
So that's it, hope you like it and i hope this was useful... Any Comments are welcome!
Reply


Messages In This Thread
Anti-Swear - by alinategh - 22.09.2013, 14:06
Re: Anti-Flood/Swear - by Inn0cent - 22.09.2013, 14:16
Re: Anti-Flood/Swear - by alinategh - 22.09.2013, 15:43
Re: Anti-Flood/Swear - by x96664 - 22.09.2013, 16:04
Re: Anti-Flood/Swear - by DanishHaq - 22.09.2013, 16:05
Re: Anti-Flood/Swear - by 2KY - 22.09.2013, 16:11
Re: Anti-Flood/Swear - by alinategh - 22.09.2013, 16:35
Re: Anti-Flood/Swear - by 2KY - 22.09.2013, 16:46
Re: Anti-Flood/Swear - by alinategh - 22.09.2013, 17:04

Forum Jump:


Users browsing this thread: 1 Guest(s)