
   /* AMX Mod script.
   *
   * Made by AssKicR
   *
   * This file is provided as is (no warranties).
   *
   * Desripion:
   * Give Players Unlimited Ammo.
   *
   * Commands:
   * amx_ammo <authid, nick, @team or #userid>   // Unlimited Ammo
   * amx_unammo <authid, nick, @team or #userid> // Reset to normal
   *
   * Cvars:
   * sv_dropwpn   - Drops his weapon when he gets more ammo
   * sv_oneround  - Removes unlimited ammo power every new round
   *
   * Eksamples:
   * Give AssKicR Unlimited Ammo            - amx_ammo AssKicR
   * Remove AssKicRs Unlimited Ammo         - amx_unammo AssKicR
   * Give all CT unlimited Ammo            - amx_ammo @CT
   * Remove unlimited Ammo from all Terrorists - amx_ammo @TERRORISTS
   * Give player #7 unlimited ammo            - amx_ammo #7
   *
   * Credits::
   * Psyko - The Idea
   *  {HOJ}  Batman  & AssKicR - For making the orignal code that i stole
   ^_^
   *
   *Changelog:
   *V 1.0 -- Original version
   *V 1.1 -- Added amx_ammo @ALL & amx_unammo @ALL
   *
   */
   #include <amxmod.inc>
   #include <amxmisc.inc>
   // VARIABLES
   new bool:AmmoMaster[33]
   //--------------------------------------------------------------------
   --------------------------
   public plugin_init() {
      register_event("CurWeapon","changeWeapon","be","1=1")
      register_plugin("Admin Ammo","1.0","AssKicR")
      register_concmd("amx_ammo","admin_ammo",ADMIN_LEVEL_A,"<authid,
   nick, @team or #userid>")
      register_concmd("amx_unammo","admin_unammo",ADMIN_LEVEL_A,"<authid,
   nick, @team or #userid>")
      if (!cvar_exists("sv_dropwpn")) register_cvar("sv_dropwpn", "0" )
   }
   //--------------------------------------------------------------------
   --------------------------
   public admin_ammo(id,level,cid) {
      if (!cmd_access(id,level,cid,2))
         return PLUGIN_HANDLED
      new arg[32], name2[32]
      get_user_name(id,name2,31)

      read_argv(1,arg,31)
      if ((arg[0]=='@') && (arg[1]!='A')) {
         new players[32], inum
         get_players(players,inum,"ae",arg[1])
         if (inum==0){
            console_print(id,"No clients in such team")
            return PLUGIN_HANDLED
         }
         for(new a=0;a<inum;++a)
            AmmoMaster[players[a]]=true
         switch(get_cvar_num("amx_show_activity"))   {
      case  2:   client_print(0,print_chat,"ADMIN  %s: set unlimited ammo
   on all %s",name2,arg[1])
      case  1:   client_print(0,print_chat,"ADMIN:  set unlimited ammo on
   all %s",arg[1])
         }
         console_print(id,"All clients on %s have unlimited ammo",arg[1])
      }
      else   if  ((arg[0]=='@')  &&  (arg[1]=='A')  &&  (arg[2]=='L')  &&
   (arg[2]=='L')) {
         new players[32], inum
         get_players(players,inum,"")

         for(new a=0;a<inum;++a)
            AmmoMaster[players[a]]=true
         switch(get_cvar_num("amx_show_activity"))   {
      case  2:   client_print(0,print_chat,"ADMIN  %s: set unlimited ammo
   on all players",name2)
      case  1:   client_print(0,print_chat,"ADMIN:  set unlimited ammo on
   all players")
         }
         console_print(id,"All clients have unlimited ammo")
      }
      else {
         new player = cmd_target(id,arg,7)
         if (!player) return PLUGIN_HANDLED
         AmmoMaster[player]=true
         new name[32]
         get_user_name(player,name,31)
         switch(get_cvar_num("amx_show_activity"))   {
      case  2:   client_print(0,print_chat,"ADMIN  %s: set unlimited ammo
   on %s",name2,name)
      case  1:   client_print(0,print_chat,"ADMIN:  set unlimited ammo on
   %s",name)
         }
         console_print(id,"Client ^"%s^" has unlimited ammo",name)
      }
      return PLUGIN_HANDLED
   }
   //--------------------------------------------------------------------
   --------------------------
   public admin_unammo(id,level,cid) {
      if (!cmd_access(id,level,cid,2))
         return PLUGIN_HANDLED
      new arg[32], name2[32]
      get_user_name(id,name2,31)
      read_argv(1,arg,31)
      if ((arg[0]=='@') && (arg[1]!='A')){
         new players[32], inum
         get_players(players,inum,"ae",arg[1])
         if (inum==0){
            console_print(id,"No clients in such team")
            return PLUGIN_HANDLED
         }
         for(new a=0;a<inum;++a)
            AmmoMaster[players[a]]=false
         switch(get_cvar_num("amx_show_activity"))   {
      case  2:   client_print(0,print_chat,"ADMIN  %s:  removed unlimited
   ammo from all %s",name2,arg[1])
      case  1:   client_print(0,print_chat,"ADMIN: Removed unlimited ammo
   from all %s",arg[1])
         }
         console_print(id,"No clients on %s have unlimited ammo",arg[1])
      }
      else   if  ((arg[0]=='@')  &&  (arg[1]=='A')  &&  (arg[2]=='L')  &&
   (arg[2]=='L')) {
         new players[32], inum
         get_players(players,inum,"")

         for(new a=0;a<inum;++a)
            AmmoMaster[players[a]]=false
         switch(get_cvar_num("amx_show_activity"))   {
      case  2:   client_print(0,print_chat,"ADMIN  %s:  removed unlimited
   ammo from all players",name2)
      case  1:   client_print(0,print_chat,"ADMIN: removed unlimited ammo
   from all players")
         }
         console_print(id,"No clients have unlimited ammo")
      }
      else {
         new player = cmd_target(id,arg,7)
         if (!player) return PLUGIN_HANDLED
         AmmoMaster[player]=false
         new name[32]
         get_user_name(player,name,31)
         switch(get_cvar_num("amx_show_activity"))   {
      case  2:   client_print(0,print_chat,"ADMIN  %s:  removed unlimited
   ammo from %s",name2,name)
      case  1:   client_print(0,print_chat,"ADMIN: Removed unlimited ammo
   from %s",name)
         }
         console_print(id,"Client    ^"%s^"    doesn't   have   unlimited
   ammo",name)
      }
      return PLUGIN_HANDLED
   }
   //--------------------------------------------------------------------
   --------------------------
   public changeWeapon(id)
   {
       if ( !AmmoMaster[id] ) return PLUGIN_CONTINUE
       new  clip, ammo
       new wpn_id=get_user_weapon(id, clip, ammo);
       new wpn[32]
       if   (   wpn_id==CSW_C4  ||  wpn_id==CSW_HEGRENADE  ||  wpn_id  ==
   CSW_SMOKEGRENADE  ||  wpn_id == CSW_FLASHBANG || wpn_id == CSW_KNIFE )
   return PLUGIN_CONTINUE

       // Never Run Out of Ammo!
       //server_print("STATUS  ID=%d  CLIP=%d, AMMO=%d WPN=%d", id, clip,
   ammo, wpn_id)
       if ( clip == 0 )
       {
         //server_print("INVOKING  PUNISHER  MODE! ID=%d CLIP=%d, AMMO=%d
   WPN=%d", id, clip, ammo, wpn_id)
         get_weaponname(wpn_id,wpn,31)
         //highly recommend dropping weapon - buggy without it!
         if ( get_cvar_num("sv_dropwpn")!=0 )
   engclient_cmd(id,"drop",wpn)  //TEST
         give_item(id,wpn)
         engclient_cmd(id, wpn )
         engclient_cmd(id,  wpn  )  //  Checking  to see if multple sends
   helps - sometimes this doesn't work... ;-(
         engclient_cmd(id,  wpn  )  //  Checking  to see if multple sends
   helps - sometimes this doesn't work... ;-(
       }
       return PLUGIN_CONTINUE
   }
   //--------------------------------------------------------------------
   --------------------------AMXMOD?>
