
   /* AMXMOD script.
   *
   *  (c)  Copyright  2000-2002,  Rich  - This file is provided as is (no
   warranties).
   *
   * Showdown 0.1 - Alpha Release
   *
   * - Everyone is issued with the same gun
   *
   * - Matrix style jumping with no fall damage
   *
   *  -  You  are  issued  with  10  guns, when you throw 1 away, you are
   instantly given a replacement.
   */
   #include <amxmod>
   #include <amxmisc>
   #include <xtrafun>
   new bool:battlemode
   new guncount[33]
   new bool:bcheck[33]
   new bool:gunreplace[33]
   public plugin_init()
   {
     register_plugin("Showdown", "0.1", "Rich")
     register_event("CurWeapon","change_gun","be","1=1")
     register_event("Damage", "take_damage", "b", "2!0")
     register_event("ResetHUD","player_spawn","be")
     register_clcmd("drop","drop_gun")
     register_clcmd("buy","stop_menu")
     register_concmd("amx_showdown","battle_switch")
     set_task(0.1,"checkbutton",0,"",0,"b")
   }
   public checkbutton()
   {
     if (!battlemode)
     {
       return PLUGIN_CONTINUE
     }
     for(new i = 1; i <= get_maxplayers(); ++i)
     {
       if (is_user_alive(i))
       {
         new velocity[3]
         get_user_velocity(i, velocity)
         if ((get_user_button(i)&IN_JUMP))
         {
           if (!bcheck[i])
           {
             velocity[0] = velocity[0] * 2
             velocity[1] = velocity[1] * 2
             velocity[2] += 400
             set_user_velocity(i, velocity)
             bcheck[i] = true
           }
         }
         else if (velocity[2] == 0)
         {
           bcheck[i] = false
         }
       }
     }
     return PLUGIN_CONTINUE
   }
   public take_damage(id)
   {
     if (!battlemode)
     {
       return PLUGIN_CONTINUE
     }
     new  weapon,  bodypart,  attacker  =  get_user_attacker(id,  weapon,
   bodypart)
     new health = get_user_health(id)
     if (attacker == id)
     {
       new damage = read_data(2)
       health += damage
       set_user_health(id,health)
     }
     else if (health <= 32000)
     {
       set_user_frags(id, get_user_frags(id) + 1)
       set_user_frags(attacker, get_user_frags(attacker) + 1)
       set_user_health(id, -1)
       if (bodypart != 1)
       {
         bodypart = 0
       }
       new weaponname[20]
       if (weapon == 21)
       {
         weaponname = "m3"
       }
       else if (weapon == 4)
       {
         weaponname = "grenade"
       }
       else if (weapon == 29)
       {
         weaponname = "knife"
       }
       message_begin(MSG_ALL, 85,{0,0,0},0)
       write_byte(attacker)
       write_byte(id)
       write_byte(bodypart)
       write_string(weaponname)
       message_end()
     }
     return PLUGIN_CONTINUE
   }
   public player_spawn(id)
   {
     if (!battlemode)
     {
        return PLUGIN_CONTINUE
     }
     new ida[1]
     ida[0] = id
     set_task(0.7,"give_stuff",0,ida,1)
     return PLUGIN_CONTINUE
   }
   public give_stuff(ida[])
   {
     if (!battlemode)
     {
       return PLUGIN_CONTINUE
     }
     guncount[ida[0]] = 10
     gunreplace[ida[0]] = false
     give_item(ida[0],"item_assaultsuit")
     give_item(ida[0],"weapon_m3")
     give_item(ida[0],"ammo_buckshot")
     set_user_health(ida[0], 32100)
     client_cmd(ida[0],"weapon_usp")
     client_cmd(ida[0],"weapon_glock18")
     return PLUGIN_CONTINUE
   }
   public drop_gun(id)
   {
     if (!battlemode)
     {
       return PLUGIN_CONTINUE
     }
     new clip, ammo, weapon = get_user_weapon(id, clip, ammo)
     if (weapon == 21 && guncount[id] > 0)
     {
       --guncount[id]
       client_print(id,print_chat,"%i Guns Left", guncount[id])
       gunreplace[id] = true
     }
     return PLUGIN_CONTINUE
   }
   public change_gun(id)
   {
     if (!battlemode)
     {
       return PLUGIN_CONTINUE
     }
     new weapon=read_data(2)
     if (gunreplace[id])
     {
       give_item(id,"weapon_m3")
       give_item(id,"ammo_buckshot")
       engclient_cmd(id,"weapon_m3")
       gunreplace[id] = false
     }
     else if (weapon != 29 && weapon != 21 )
     {
       engclient_cmd(id,"drop")
       engclient_cmd(id,"weapon_m3")  // Blocks Grenades
     }
     return PLUGIN_CONTINUE
   }
   public battle_switch(id)
   {
     if (battlemode)
     {
       battlemode = false
       server_cmd("amx_spawn_protect 1")
     }
     else
     {
       battlemode = true
       server_cmd("amx_spawn_protect 0")
       server_cmd("amx_gore abc")
       set_hudmessage(50, 50, 150, -1.0, 0.3, 0, 4.0, 5.0, 0.1, 0.0, 11)
       show_hudmessage(0,"SHOWDOWN MODE ENABLED - ALPHA TEST !")
       set_hudmessage(50, 50, 150, -1.0, 0.4, 0, 4.0, 5.0, 0.1, 0.0, 12)
       show_hudmessage(0,"- ONE GUN ONLY")
       set_hudmessage(50, 50, 150, -1.0, 0.5, 0, 4.0, 5.0, 0.1, 0.0, 13)
       show_hudmessage(0,"- SUPER JUMPING WITH NO FALL DAMAGE")
       set_hudmessage(50, 50, 150, -1.0, 0.6, 0, 4.0, 5.0, 0.1, 0.0, 14)
       show_hudmessage(0,"-  YOU  CARRY 10 GUNS WHICH YOU CAN DROP TO GET
   ANOTHER")
     }
     server_cmd("sv_restartround 4")
     return PLUGIN_HANDLED
   }
   public stop_menu(id)
   {
     if (!battlemode)
     {
       return PLUGIN_CONTINUE
     }
     client_cmd(id,"slot10")
     client_print(id,print_chat,"No Buying In Battle")
     return PLUGIN_CONTINUE
   }
