
   /*
   * AMX Mod script.
   *
   * King of the Hill v0.1.0 - (c) 2003 Dennis "Riedel" Vink
   *
   */
   #include <amxmod>
   new current_king = 0
   new has_spawned[32]
   public create_king()
   {
     new players[32], inum
     new name[32]
     get_players(players,inum,"a")
     if (current_king == 0) {
       while(current_king  ==  0 || get_user_health(current_king) == 0 ||
   has_spawned[current_king] == 0) {
         current_king = random_num(1, inum)
       }
       get_user_name(current_king, name, 32)
       set_hudmessage(0,  100,  200, 0.05, 0.50, 2, 0.1, 4.0, 0.02, 0.02,
   10)
       show_hudmessage(0,"[KING OF THE HILL] The new KING is %s", name)
     }
     set_user_health(current_king,150)
     make_king_glow()
     return PLUGIN_CONTINUE
   }
   public make_king_glow() {
     new red = random_num(50,255)
     new green = random_num(50,255)
     new blue = random_num(50,255)
     set_user_rendering(current_king,kRenderFxGlowShell,red,green,blue,kR
   enderNormal,16)
     return PLUGIN_CONTINUE
   }
   public i_see_dead_people(id)
   {
     new guilty_one = read_data(1)
     new unlucky_one = read_data(2)
     new deadone[32]
     new badone[32]
     if (unlucky_one == current_king) {
       get_user_name(unlucky_one, deadone , 32)
       if (!guilty_one || guilty_one == unlucky_one) {
         set_hudmessage(0, 100, 200, 0.05, 0.50, 2, 0.1, 4.0, 0.02, 0.02,
   10)
         show_hudmessage(0,"[KING  OF  THE  HILL] %s - THE KING - DIED!",
   deadone)
         current_king = 0
       }
       else {
         get_user_name(guilty_one, badone, 32)
         set_hudmessage(0, 100, 200, 0.05, 0.50, 2, 0.1, 4.0, 0.02, 0.02,
   10)
         show_hudmessage(0,"[KING  OF  THE HILL] %s SLAUGHTERED %s and is
   KING!", badone, deadone)
         current_king = guilty_one
         make_king_glow()
       }
     }
     return PLUGIN_CONTINUE
   }
   public client_disconnect(id)
   {
     new quitter[32]
     if (id == current_king) {
       get_user_name(id, quitter , 32)
       set_hudmessage(0,  100,  200, 0.05, 0.50, 2, 0.1, 4.0, 0.02, 0.02,
   10)
       show_hudmessage(0,"[KING  OF  THE  HILL]  THE  KING  %s  left  the
   house.", quitter)
       current_king = 0
     }
     return PLUGIN_CONTINUE
   }
   public user_respawn(id)
   {
     new kingname[32]
     has_spawned[id] = 1
     if (current_king != 0) {
       get_user_name(current_king, kingname , 32)
       set_hudmessage(id,  100, 200, 0.05, 0.50, 2, 0.1, 4.0, 0.02, 0.02,
   10)
       show_hudmessage(id,"[KING OF THE HILL] %s is the KING OF THE HILL!
   SLAUGHTER HIM!", kingname)
     }
   }
   public reset_spawn() {
     for(new i = 0 ; i < 33 ;++i) {
       has_spawned[i] = 0
     }
   }
   public plugin_init()
   {
     register_plugin("amx_kingofthehill","0.1.0","Riedel")
     register_event("ResetHUD","user_respawn","b")
     register_event("DeathMsg","i_see_dead_people","a")
     register_event("SendAudio","reset_spawn","a","2=%!MRAD_terwin","2=%!
   MRAD_ctwin","2=%!MRAD_rounddraw")
     register_event("SendAudio","create_king","bc","2=%!MRAD_GO","2=%!MRA
   D_MOVEOUT","2=%!MRAD_LETSGO","2=%!MRAD_LOCKNLOAD")
     return PLUGIN_CONTINUE
   }
