
/*
* AMX Mod script. 
* This file is provided as is (no warranties). 
* 
* Announces HE Kills (Suicide & Normal HE Kills) 
*  by ToT|V!PER (viper@totclan.de)
*
* Homepage: http://www.totclan.de
* IRC-Chan: #totclan @ irc.de.quakenet.org
*
* ------------------------------------------------
*
* Changelog:
*
* V0.7 : Updated to the newest AMX
* V0.51: Added some more features
* V0.5 : First Public Release
* 
* ------------------------------------------------
*
*  Put in server.cfg: 
* 
*   hekill_announce_mode < flags > 
*   "a" - show normal HE-Kill in hud 
*   "b" - show suicide HE-Kill in hud 
*   "c" - play sound on HE-Kill
* 
*   set hekill_announce_mode "" to disable plugin 
* 
*   default hekill_announce_mode is "abc" 
*/ 

#include <amxmod> 

#define HEMESSAGES   4 			/* Number of Random Messages for Normal HE Kills */
#define HESMESSAGES  4 			/* Number of Random Messages for Suicide HE Kills */

new he_messages[HEMESSAGES][] = { 
"%s sends a little gift to %s",  
"%s throws a small present to %s",  
"%s made a precision throw to %s",  
"%s got a big explosion for %s"}  		/* Random Messages for Normal HE Kills */

new hes_messages[HESMESSAGES][] = { 
"%s detonated himself with a grenade",  
"%s trys the effect of a HE Grenade",  
"%s kicked a grenade into his own ass",  
"%s explodes!"}  				/* Random Messages for Suicide HE Kills */


public he_kills(){ 
   new killer_id = read_data(1) 
   new victim_id = read_data(2) 
   new killer_name[32], victim_name[32] 
    
   get_user_name(killer_id,killer_name,32) 
   get_user_name(victim_id,victim_name,32) 

   new hekmode[8] 
   get_cvar_string("hekill_announce_mode",hekmode,8) 
   new hekmode_bit = read_flags(hekmode) 

   if (hekmode_bit & 1) { 
    if (victim_id != killer_id) 
     {
      set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) 
      show_hudmessage(0,he_messages[ random_num(0,HEMESSAGES-1)],killer_name,victim_name) 
     }
   } 

   if (hekmode_bit & 2) { 
    if (victim_id == killer_id)
     {    
      set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1) 
      show_hudmessage(0,hes_messages[ random_num(0,HESMESSAGES-1) ],victim_name) 
     } 
   }

   if (hekmode_bit & 4) { 
     client_cmd(killer_id,"spk misc/perfect") 
   }
}


public plugin_init() { 
   register_plugin("HE-Kill Announcer","0.7","viper@totclan.de") 
   register_event("DeathMsg","he_kills","a","4&gren") 
   register_cvar("hekill_announce_mode","abc") 
   return PLUGIN_CONTINUE 
}

