Quote:
Originally Posted by spiderbites
ah ok..btw i found a bug..if a player defuse bomb, and if he fails and die in the bomb explosion, the next time he respawns he can hear the heartbeat sound until he dies in that round
|
Try this:
PHP Code:
/* AMX Mod X Plugin
*
* (c) Copyright 2008, ConnorMcLeod
* This file is provided as is (no warranties).
*
*/
#include <amxmodx>
new const g_heartbeat[] = "player/heartbeat1.wav"
new g_pcvarLowHp
public plugin_precache()
{
precache_sound(g_heartbeat)
}
public plugin_init()
{
register_plugin("Low Hp Heart Beat", "0.12", "ConnorMcLeod, AlexBreems")
g_pcvarLowHp = register_cvar("heartbeat_hp", "25")
register_event("Damage", "e_Damage", "be", "2>0")
register_event("DeathMsg", "e_DeathMsg", "a")
register_event("ResetHUD", "onPlayerSpawn", "be")
register_event("Spectator", "onSpectate", "a")
}
public e_Damage(id)
{
if( get_user_health(id) > get_pcvar_num(g_pcvarLowHp) )
return
emit_sound(id, CHAN_STATIC, g_heartbeat, 0.0, 0.0, SND_STOP, PITCH_NORM)
client_cmd(id, "spk %s", g_heartbeat)
}
public e_DeathMsg()
{
emit_sound(read_data(2), CHAN_STATIC, g_heartbeat, 0.0, 0.0, SND_STOP, PITCH_NORM)
}
public onPlayerSpawn(id)
{
emit_sound(id, CHAN_STATIC, g_heartbeat, 0.0, 0.0, SND_STOP, PITCH_NORM)
}
public onSpectate()
{
emit_sound(read_data(1), CHAN_STATIC, g_heartbeat, 0.0, 0.0, SND_STOP, PITCH_NORM)
}
__________________