
   /*
   ======================================================================
   ==========
   AMX Mod Plugin
   http://amxmod.net
   ----------------------------------------------------------------------
   ----------
   Name    : Alien Vision
   Version : 1.1
   Author  : Freecode <Freecode@hotmail.com>
   ----------------------------------------------------------------------
   ----------
   Alien Vision v 1.1
       Created by Freecode
       Alien Vision
       ===========
       Changes persons regular vision to alien vision(how is in the movie
   and in the game  )
       USAGE
       =====

       * amx_alien <name/id/wonid/@CT/@TERRORIST>
       * amx_unalien <name/id/wonid/@CT/@TERRORIST>

       Releases:
       ========
       2003-08-26    version 1.0
       2003-09-12    version  1.1 - Fixed the bug with chickenmod.(Tnx to
   T(+)rget)
       TO DO
       =====
       Nothing Yet
   ----------------------------------------------------------------------
   ----------
   Installation :
   - Extract file alienvision.amx to directory addons/amx/plugins
   - Open addons/amx/plugins/plugins.ini
   - Add a line containing : alienvision.amx
   ====================================================================
   */
   #include <amxmod>
   #include <amxmisc>
   new gmsgSetFOV
   new AlienFlag[33]
   //--------------------------------------------------------------------
   --------------------------
   public alien(id, level, cid) {
      if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED
      new arg[32]
      read_argv(1, arg, 31)
      if(arg[0] == '@') {
         new users[32], inum
         get_players(users, inum, "ae", arg[1])
         if(inum == 0) {
            console_print(id, "No users in such team")
            return PLUGIN_HANDLED
         }
         for(new i = 0; i < inum; ++i) {
            new Vision=get_cvar_num("alien_vision")
            message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, users[i])
            write_byte(Vision)
            message_end()
         }
         new name1[33]
         get_user_name(id,name1,32)
         switch(get_cvar_num("amx_show_activity"))    {
            case  2:    client_print(0,print_chat,"ADMIN  %s: Has changed
   %s's vision into aliens vision",name1,arg)
            case  1:    client_print(0,print_chat,"ADMIN: Change all %s's
   visions with alien vision",arg)
         }
         console_print(id,"All   clients   on  the  %s  team  have  alien
   vision",arg)
      } else {
         new uid = cmd_target(id, arg, 5)
         new Vision=get_cvar_num("alien_vision")
         if(!uid) return PLUGIN_HANDLED
         message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, uid)
         write_byte(Vision)
         message_end()
         new name1[33],name2[33]
         get_user_name(id,name1,32)
         get_user_name(uid,name2,32)
         switch(get_cvar_num("amx_show_activity"))    {
            case  2:    client_print(0,print_chat,"ADMIN  %s: Has changed
   %s's vision to alien vision",name1,name2)
            case   1:    client_print(0,print_chat,"ADMIN:   Change  %s's
   vision to alien vision",name2)
         }
         console_print(id,"Client %s has alien vision",name2)
         AlienFlag[uid] = true
      }
      return PLUGIN_HANDLED
      }
   //--------------------------------------------------------------------
   --------------------------
      public unalien(id, level, cid) {
      if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED
      new arg[32]
      read_argv(1, arg, 31)
      if(arg[0] == '@') {
         new users[32], inum
         get_players(users, inum, "ae", arg[1])
         if(inum == 0) {
            console_print(id, "No users in such team")
            return PLUGIN_HANDLED
         }
         for(new i = 0; i < inum; ++i) {
            message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, users[i])
            write_byte(90)
            message_end()
         }
         new name1[33]
         get_user_name(id,name1,32)
         switch(get_cvar_num("amx_show_activity"))    {
            case  2:    client_print(0,print_chat,"ADMIN  %s: changed the
   vision back to all %s's",name1,arg)
            case  1:    client_print(0,print_chat,"ADMIN: Chnage back the
   vision to all %s's",arg)
         }
         console_print(id,"All   clients  on  the  %s  team  have  Normal
   vision",arg)
      } else {
         new uid = cmd_target(id, arg, 5)
         if(!uid) return PLUGIN_HANDLED
         message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, uid)
         write_byte(90)
         message_end()
         new name1[33],name2[33]
         get_user_name(id,name1,32)
         get_user_name(uid,name2,32)
         switch(get_cvar_num("amx_show_activity"))    {
            case  2:    client_print(0,print_chat,"ADMIN  %s: changed the
   vision back for %s",name1,name2)
            case  1:    client_print(0,print_chat,"ADMIN:  Change  vision
   back for %s",name2)
         }
         console_print(id,"Client %s has Normal vision",name2)
         AlienFlag[uid] = false
      }
      return PLUGIN_HANDLED
   }
   //--------------------------------------------------------------------
   --------------------------
   public check_fov(id)
   {
      if(AlienFlag[id])
      {
         message_begin(MSG_ONE, gmsgSetFOV, {0,0,0}, id)
         write_byte(get_cvar_num("alien_vision"))
         message_end()
      }
   }
   //--------------------------------------------------------------------
   --------------------------
   public plugin_init() {
      register_plugin("Alien Vision", "1.0", "Freecode")
      register_clcmd("amx_alien",  "alien",  ADMIN_SLAY,  "<nick, authid,
   #userid, @team> - changes peoples vision")
      register_clcmd("amx_unalien",    "unalien",   ADMIN_SLAY,   "<nick,
   authid, #userid, @team> - changes back to normal vision")
      register_cvar("alien_vision", "160")
      gmsgSetFOV = get_user_msgid("SetFOV")
      register_event("SetFOV", "check_fov", "be", "1<91")
   }
