
   //
   **********************************************************************
   *********
   // Admin Listen 2.1, Copyright 2003, Maxim. No warranties.
   // Props to Luke Sankey for the original AdminMod plugin (SankListen).
   // Inspired by PsychoListen by PsychoGuard
   // Props to tcquest78 for helping out with the colors.
   // And thanks goes to those in the Scripting Tech Support forum.
   // Vexd, you're just too awesome.
   //
   //  Allows  administrators  (with flag "n") to see all team chats, and
   dead chats.
   //
   //  Use  amx_adminlisten_voice  0|1  to turn off and on the hearing of
   voicecomms
   // In 2.0 the Chat Engine was totally rewritten from ground up,
   //  a  different,  more  efficent  method,  was  used  to  pick up say
   messages,
   // also fewer calculations and variables in this version.
   //
   // 2.1 - VoiceComm rewrite, fixed a few typos in the comments.
   //
   //
   **********************************************************************
   *********
   #include <amxmod>
   #include <Vexd_Utilities>
   new count[32][32]     //Counter for the SayText event.
   new g_voice_status[2]
   public catch_say(id){
      new reciever = read_data(0) //Reads the ID of the message recipient
      new  sender  =  read_data(1)   //Reads  the ID of the sender of the
   message
      new message[151]            //Variable for the message
      read_data(2,message,150)    //Reads  the  message  from the SayText
   event IE: "(DEAD)(TEAM) Maxim|PSK: i'm dead"
      //With  the  SayText  event,  the message is sent to the person who
   sent it last.
      //It's sent to everyone else before the sender recieves it.
      count[sender][reciever]  = 1          //Keeps count of who recieved
   the message
      if  (sender  == reciever){      //If current SayText message is the
   last then...
         new   player_count  =  get_playersnum()  //Gets  the  number  of
   players on the server
         new players[32] //Player IDs
         get_players(players, player_count, "c")
         for (new i = 0; i < player_count; i++) {
            if (get_user_flags(players[i]) & ADMIN_LEVEL_B){     //If the
   player is an admin then...
               if (count[sender][players[i]] != 1){              //If the
   player did not recieve the message then...
                  message_begin(MSG_ONE,
   get_user_msgid("SayText"),{0,0,0},players[i])
                  //Appends  the  ID of the sender to the message, so the
   engine knows what color to make the name.
                  write_byte(sender)
                  //Appends the message to the message.
                  write_string(message)
                  message_end()
               }
            }
            count[sender][players[i]]  = 0  //Set everyone's counter to 0
   so it's ready for the next SayText
         }
      }
      return PLUGIN_CONTINUE
   }
   public plugin_init(){
      register_plugin("AdminListen","2.1","Maxim")
      register_srvcmd("amx_adminlisten_voice","voice_status")
      register_event("SayText","catch_say","b")
      return PLUGIN_CONTINUE
   }
   // *********************
   // VoiceComm Stuff
   // *********************
   public client_infochanged(id)
   {
      if       ((get_user_flags(id)       &       ADMIN_LEVEL_B)       &&
   equal(g_voice_status,"1")) SetSpeak(id, 4)
   }
   public client_connect(id)
   {
      if       ((get_user_flags(id)       &       ADMIN_LEVEL_B)       &&
   equal(g_voice_status,"1")) SetSpeak(id, 4)
   }
   public voice_status(){
      read_argv(1,g_voice_status,1)
      new player_count = get_playersnum()
      new players[32] //Player IDs
      get_players(players, player_count, "c")
      for (new i = 0; i < player_count; i++) {
         if ((get_user_flags(players[i]) & ADMIN_LEVEL_B)){
            if (equal(g_voice_status,"0")) SetSpeak(players[i], 0)
            if (equal(g_voice_status,"1")) SetSpeak(players[i], 4)
         }
      }
   }
