
   /* AMX Mod Script.
   *
   * (c) Copyright 2002-2003, RAV
   * This file is provided as is (no warranties).
   *
   * Swearing will be filtered.
   *
   * Changelog:
   * 1.20 - Fixed some bugs
   * 1.10 - Initial Release
   */
   #include <amxmod>
   // max number of words in word list
   #define MAX_WORDS 64
   // Number of random messages.
   #define MESSAGES   4
   new g_messages[MESSAGES][] = {
   "ADMIN, I want to be punished for my foul mouth!",
   "ADMIN, please ban me for my bad language!",
   "All  these  years  in  school  and  I  can still only say four letter
   words!",
   "Someone please gag me for abusing chat!"}
   // file to read words from
   new g_wordList[] = "addons/amx/wordlist.ini"
   new g_swears[MAX_WORDS][32]
   new g_swearsNum
   public plugin_init()
   {
       register_plugin("SWEAR FILTER","0.9","Rav")
       register_clcmd("say","swearFilter")
       register_clcmd("say_team","swearFilter")

       if (file_exists(g_wordList))
       {
         new len, i = 0
         while( read_file(g_wordList,i++,g_swears[g_swearsNum],31,len) )
             if (len) ++g_swearsNum
       }
       else    log_message("[AMX]    Swear    file    not   found   (name
   ^"%s^")",g_wordList)
   }
   public swearFilter(id)
   {
      new said[128]
      read_args(said,127)
      for (new i=0; i<g_swearsNum; ++i)
      {
           if ( containi(said,g_swears[i]) != -1 )
           {
               engclient_cmd(id,"say",g_messages[
   random_num(0,MESSAGES-1) ])
               return PLUGIN_HANDLED
           }
      }

      return PLUGIN_CONTINUE
   }
