
   // PsychoListen, Copyright 2002, PsychoGuard. No warranties.
   // Props to Luke Sankey for the original AdminMod plugin.
   //
   // Allows admins to listen to otherwise invisible conversations.
   // Admins need admin level B to be able to listen.
   //
   // Cvars:
   //   pd_listen_mode
   //   a - admins can hear otherwise invisible says
   //   b - dead players can hear alive players
   #include <amxmod>
   get_mode() {
       new mode[4];
       get_cvar_string("pd_listen_mode", mode, 3);
       return read_flags(mode);
   }
   public handle_say(id) {
       new mode = get_mode();
       if (! mode) {
           // completely disabled
           return PLUGIN_CONTINUE;
       }
       new is_alive = is_user_alive(id);
       new team = get_user_team(id);
       new command[17];
       read_argv(0, command, 16);
       new is_team_msg = ! equal(command, "say");
       new player_count = get_playersnum();
       new players[32];
       get_players(players, player_count, "c");
       new message[129];
       read_argv(1, message, 128);
       new name[33];
       get_user_name(id, name, 32);
       for (new i = 0; i < player_count; i++) {
           if ((mode & 2) && ! is_user_alive(players[i]) && is_alive &&
               (! is_team_msg || team == get_user_team(players[i]))) {
               //  The  current  player is dead and the talking player is
   alive
               client_print(players[i],  print_chat,  "%s :    %s", name,
   message);
           }  else  if  ((mode  &  1)  &&  (get_user_flags(players[i])  &
   ADMIN_LEVEL_B)) {
               if ((is_user_alive(players[i]) && ! is_alive) ||
                   (is_team_msg && team != get_user_team(players[i]))) {
                   client_print(players[i],   print_chat,  "PsychoListen:
   %s%s%s :    %s",
                                is_team_msg ? "(TEAM) " : "",
                                is_alive   ?   ""   :  "(DEAD)  ",  name,
   message);
               }
           }
       }
       return PLUGIN_CONTINUE;
   }
   public plugin_init() {
       register_plugin("PsychoListen", "0.8.6b", "PsychoGuard");
       register_clcmd("say", "handle_say");
       register_clcmd("say_team", "handle_say");
       register_cvar("pd_listen_mode", "ab");
       return PLUGIN_CONTINUE;
   }
