
   /* AMX Mod script.
   *
   * (c) Copyright 2002, OLO
   * This file is provided as is (no warranties).
   *
   */
   #include <amxmod>
   #include <amxmisc>
   /*
   Protect your clan tag on your server!
   Example: open admins.cfg and add there lines
       amx_protclantag "mytag" "123142"
       amx_protclantag "mytag" "654645"
       amx_protclantag "mytag" "457457"
       amx_protclantag "anothertag" "9988989"
       amx_protclantag "anothertag" "23432"
       amx_protclantag "anothertag" "120032"
   */
   /* Max. number of entries */
   #define MAX_CLANTAGS 64
   new clantaglist[MAX_CLANTAGS][32]
   new authids[MAX_CLANTAGS][32]
   new num_clantags
   new bool:cancheck[33]
   public add_clantag(id,level,cid){
       if (!cmd_access(id,level,cid,3))
           return PLUGIN_HANDLED
       if (num_clantags >= MAX_CLANTAGS){
           console_print(id,"Max. number of %d entries reached. Can't add
   more clan tags",MAX_CLANTAGS)
           return PLUGIN_HANDLED
       }
       read_argv(1,clantaglist[num_clantags],31)
       read_argv(2,authids[num_clantags],31)
       console_print(id,"Protection      for      clan     tag     ^"%s^"
   set",clantaglist[   num_clantags++   ])
       return PLUGIN_HANDLED
   }
   // check authid with given clantag
   cant_use_tag(id,clantag[]){
       new authid[32]
       get_user_authid(id,authid,31)
       for (new i=0; i<num_clantags; ++i){
           if ( equal(clantag,clantaglist[i]) && equal(authid,authids[i])
   )
               return false
       }
       return true
   }
   check_name(id,name[]) {
       for (new i=0; i<num_clantags; ++i){
           if (containi(name,clantaglist[i]) != -1){
               if (cant_use_tag(id,clantaglist[i])){
                   client_cmd(id,"echo  ^"* Clan tag '%s' is protected on
   this server, you cannot use it!^";disconnect",clantaglist[i])
                   client_print(0,print_chat,"*  %s  kicked  from server,
   clan tag '%s' is protected", name,clantaglist[i])
                   cancheck[id] = false
                   return PLUGIN_HANDLED
               }
               break
           }
       }
       return PLUGIN_CONTINUE
   }
   /* catch clients connecting and check names & clan tags */
   public client_connect(id){
       cancheck[id] = true
       new name[32]
       get_user_name(id,name,31)
       return check_name(id,name)
   }
   /* detect name change against protected list */
   public client_infochanged(id){
       if  (cancheck[id]){  /*  to exclude double checking when player is
   dead and name is switched back by CS */
           new name[32]
           get_user_info(id,"name",name,31)
           return check_name(id,name)
       }
       return PLUGIN_CONTINUE
   }
   public plugin_init() {
      register_plugin("Clan Tag Protection","0.8.5","default")
      register_concmd("amx_protclantag","add_clantag",ADMIN_LEVEL_A,"<cla
   n tag> <authid>")
      return PLUGIN_CONTINUE
   }
