PHP Code:
/* Copyright © 2008, Khristofer Whelan
Low Hp Breathe is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Low Hp Breathe; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#define SOUND_BREATHE_ON "player/breathe1.wav"
#define SOUND_BREATHE_OFF "player/none.wav"
new g_pcvarLowHp
public plugin_precache()
{
precache_sound(SOUND_BREATHE_ON)
precache_sound(SOUND_BREATHE_OFF)
}
public plugin_init()
{
register_plugin("Low Hp Breathe", "1.0", "Khristofer Whelan")
g_pcvarLowHp = register_cvar("amx_low_breathe", "30")
register_event("Damage", "e_Damage", "be", "2>0")
register_event("DeathMsg", "e_DeathMsg", "a")
}
public e_Damage(id)
{
if(get_user_health(id) > get_pcvar_num(g_pcvarLowHp) )
return
emit_sound(id, CHAN_STATIC, SOUND_BREATHE_ON, 0.0, ATTN_NONE, SND_STOP, 0)
client_cmd(id, "spk %s", SOUND_BREATHE_ON)
}
public e_DeathMsg()
{
new victim = read_data(2)
emit_sound(victim, CHAN_STATIC, SOUND_BREATHE_OFF, 0.0, ATTN_NONE, SND_STOP, 0)
client_cmd(victim, "spk %s", SOUND_BREATHE_OFF)
}
__________________