
   /*
   NVG Mode 0.4
   Copydown AssKicR
   2003
   Thanks to Myself :)
   for ideas and stuff.
     VERSIONS
     ========
     0.1         First version
     0.2         Updated to work with the change in Vexd_utilities
     0.3         Updated to automaticly give & activate nightvision
     0.4         Updated to disable Toggling of NVG when NVGMode is on
     REQUREMENTS
     ===========
     The following modules is needed for NVG Mode to function

     - Fun
     - Vexd_Utilities
     NVG MODE
     ========
     When NVG Mode is enabled, everything is pitch black
     and you will be given Nightvision at beginning of map.
     Now find the enemy and Kill Them :P
     COMMANDS
     ========
     amx_nvgmode = Switch NVGMode between ON and OFF
     INSTALLATION
     ============
     1) Put compiled nvgmode.amx in your amx/plugins directory.
     2) To amx/plugins/plugins.ini, add a line containing
        "nvgmode.amx", but without the quotes.
     3) Restart map/server.
     4) Admin will have to activate NVG mode by typing amx_nvgmode
        in console. (NVG Mode is off at map start by default,
        you can put a line with "amx_nvgmode" (without the quotes)
        in your server.cfg to have this enabled by default.
     5) Have fun!
      - AssKicR
   */
   #include <amxmod>
   #include <amxmisc>
   #include <Vexd_Utilities>
   new bool:nvgmode
   new gNvgRun[33]
   public nvgmodetoggle(id,level,cid) {
      if (!cmd_access(id,level,cid,1)) {
         return PLUGIN_HANDLED
      }
      if (read_argc() == 2) {
         new argument[10]
         read_argv(1,argument,9)
         if (equal(argument,"on")) {
            if (nvgmode)
               return PLUGIN_HANDLED
            else
               nvgmode = true
         }
         else if (equal(argument,"off")) {
            if (!nvgmode)
               return PLUGIN_HANDLED
            else
               nvgmode = false
         }
      }
      else {
         nvgmode = !nvgmode
      }
      if (nvgmode) {
         set_hudmessage(0,  100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1,
   2)
         show_hudmessage(0,"nvgmode Enabled!")
         client_print(id,print_console,"[AMX] nvgmode was Enabled!!")
         server_print("[AMX] nvgmode was Enabled!!")
         SetLights("a")

      }
      else {
         set_hudmessage(0,  100, 0, -1.0, 0.65, 2, 0.02, 10.0, 0.01, 0.1,
   2)
         show_hudmessage(0,"nvgmode disabled!")
         client_print(id,print_console,"[AMX] nvgmode was disabled!")
         server_print("[AMX] nvgmode was disabled!")
         SetLights("#OFF")
      }
      // Collect all alive players and give'm NVG
      new playersList[32]
      new playersFound
      get_players(playersList,playersFound,"a")
      for (new i = 0;i < playersFound;i++) {
         if (nvgmode) NVGcmd(playersList[i],1)
         else NVGcmd(playersList[i],0)
      }
      return PLUGIN_HANDLED
   }
   public newround(id) {
      if (nvgmode) {
         new idx[1]
         idx[0]=id
         set_task(float(1),"new_round",0,idx,1)
      }
      return PLUGIN_CONTINUE
   }
   public new_round(idx[1]) {
         NVGcmd(idx[0],1)
         engclient_cmd(idx[0],"nightvision")
         return PLUGIN_CONTINUE
   }
   public handle(id) {
       if (get_cvar_num("mp_nvgtoggle")!=1) {
           if (nvgmode) {
               client_print(id,print_center,"You  can't  toggle  NVGs  in
   NVGmode")
               return PLUGIN_HANDLED
           }
       } else {
           if (gNvgRun[id]) {
               NVGcmd(id,0)
               return PLUGIN_HANDLED
           } else {
               NVGcmd(id,1)
               return PLUGIN_HANDLED
           }
       }
       return PLUGIN_CONTINUE
   }
   public NVGcmd(id,state) {
       message_begin(MSG_ONE, get_user_msgid("NVGToggle"), {0,0,0}, id)
       write_byte( state )
       message_end()
       if (nvgmode) {
           message_begin(MSG_ONE, get_user_msgid("HudText"), {0,0,0}, id)
           write_string("#Hint_use_nightvision")
           write_byte(1)
           message_end()
       }
       //client_print(id,print_chat,"[AMX]   NVG   is   now  %s",state  ?
   "on":"off")
   }
   public plugin_init() {
      register_plugin("NVG Mode","0.4","AssKicR")
      register_event("ResetHUD","newround","b")
      register_clcmd("nightvision","handle")
      register_clcmd("amx_nvgmode","nvgmodetoggle",ADMIN_LEVEL_H,":
   toggles NVG Mode on/off")
      register_cvar("mp_nvgtoggle","0")
      nvgmode = false
      return PLUGIN_CONTINUE
   }
