
/*
* AMX Mod script. 
* 
* Announces HE Suicides 
*  by ToT|V!PER (viper@totclan.de)
*
* Homepage: http://www.totclan.de
* IRC-Chan: #totclan @ irc.de.quakenet.org
*
* ------------------------------------------------
*
* Changelog:
* V0.51: Added switches
* V0.5 : First Public Release
* 
* ------------------------------------------------
*
*  Put in server.cfg: 
* 
*   hekill_announce_mode < flags > 
*   "a" - show suicide HE-Kill in hud 
*   "b" - play sound on HE-Kill
* 
*   set hekill_announce_mode "" to disable plugin 
* 
*   default hesuicide_announce_mode is "ab" 
*/ 

#include <amxmod> 

#define MESSAGES   4 

new messages[MESSAGES][] = { 
"detonated himself with a grenade",  
"trys the effect of a HE Grenade",  
"kicked a grenade into his own ass",  
"explodes!"}  

public he_suicide(){ 
   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 hesmode[2] 
   get_cvar_string("hesuicide_announce_mode",hesmode,2) 
   new hesmode_bit = read_flags(hesmode) 

   if (hesmode_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,"%s %s",victim_name,messages[ random_num(0,MESSAGES-1) ]) 
     }
   }
   if (hesmode_bit & 2) {
      client_cmd(0,"spk misc/perfect") 
   }
}

public plugin_init() { 
   register_plugin("HE Suicide","0.51","viper@totclan.de") 
   register_event("DeathMsg","he_suicide","a","4&gren") 
   register_cvar("hesuicide_announce_mode","ab") 
   return PLUGIN_CONTINUE 
}

