
   /* AMX Mod script.
   *
   * AWP Limit 0.21
   *  by JustinHoMi
   *
   * Allows no more than 2 awps per team
   *
   */
   #include <amxmod>
   #define MAXAWPS 2
   new plist[32] = { 0, ... }    // 0 = no awp; 1 = carrying awp
   new awp_count[3]            // 1 = T; 2 = CT
   /* handles restricting the menu */
   public menu_awp(id,key) {
       new team = get_user_team(id)
       if(awp_count[team] >= MAXAWPS)
       {
           engclient_cmd(id,"menuselect","10")
           client_print(id,print_center,"Too  many  people  on  your team
   have awp")
           return PLUGIN_HANDLED
       }
       return PLUGIN_CONTINUE
   }
   /* handles when a player drops their weapon */
   public handle_drop(id) {
       if (plist[id] == 1)
       {
           new tmp1,tmp2
           new curweapon = get_user_weapon(id,tmp1,tmp2)
           if (curweapon == 18)
           {
               plist[id] = 0
               new team = get_user_team(id)
               awp_count[team]--
           }
       }
       return PLUGIN_CONTINUE
   }
   /* handles when a player picks up an awp */
   public handle_pickup(id) {
       new team = get_user_team(id)
       if (awp_count[team] >= MAXAWPS)
       {
           new id_s[3]
           numtostr(id,id_s,3)
           set_task(0.1,"delayed_drop",0,id_s,3)
       }
       else
       {
           plist[id] = 1
           awp_count[team]++
       }
   }
   /*  delays  the drop slightly to give the server time to register that
   they picked up an awp */
   public delayed_drop(id_s[])
   {
       new idx = strtonum(id_s)
       client_print(idx,print_center,"Too  many  people on your team have
   awp")
       engclient_cmd(idx,"drop")
   }
   /* removes awp when player dies */
   public handle_death() {
       new idx = read_data(2)
       if(plist[idx] == 1)
       {
           new team = get_user_team(idx)
           awp_count[team]--
           plist[idx] = 0
       }
   }
   /* clear vars when player connects */
   public client_connect(id) {
       plist[id] = 0 // just to make sure
   }
   /* clear vars when player disconnects */
   public client_disconnect(id) {
       if (plist[id] == 1)
       {
           new team = get_user_team(id)
           awp_count[team]--
       }
       plist[id] = 0
   }
   public plugin_init(){
       register_plugin("AWP Limit","0.21","JustinHoMi")
       register_menucmd(-31,1<<5,"menu_awp")
       register_clcmd("drop","handle_drop")
       register_event("WeapPickup","handle_pickup","b","1=18")
       register_event("DeathMsg","handle_death","a")
       return PLUGIN_CONTINUE
   }
