PHP Code:
/*================================================================================
---------------------------------
-*- [Biohazard] Low HP Heartbeat 1.1 -*-
---------------------------------
~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~
This plugin plays a heartbeat sound on humans when their health
is under certain amount.
~~~~~~~~~
- CVARS -
~~~~~~~~~
* bio_heartbeat_hp <50> - Heartbeats start when HP is lower than this
~~~~~~~~~~~~~~
- Credits to -
~~~~~~~~~~~~~~
* ConnorMcLeod, AlexBreems: for the original plugin
================================================================================*/
#include <amxmodx>
#include <biohazard>
/*================================================================================
[Plugin Customization]
=================================================================================*/
// Sounds
new const g_heartbeat[] = "player/heartbeat1.wav"
/*============================================================================*/
new cvar_heartbeathp
public plugin_precache()
{
precache_sound(g_heartbeat)
}
public plugin_init()
{
register_plugin("[Biohazard] Low HP Heartbeat", "1.1", "ConnorMcLeod/MeRcyLeZZ")
register_event("Damage", "event_damage", "be", "2>0")
register_event("DeathMsg", "event_deathmsg", "a")
register_event("ResetHUD", "event_resethud", "be")
register_event("Spectator", "event_spectator", "a")
cvar_heartbeathp = register_cvar("bio_heartbeat_hp", "50")
}
public event_damage(id)
{
if (get_user_health(id) > get_pcvar_num(cvar_heartbeathp) || is_user_zombie(id))
return;
// * Replaced with emit_sound so players near us can hear it too *
//client_cmd(id, "spk %s", g_heartbeat)
//emit_sound(id, CHAN_STATIC, g_heartbeat, 0.0, 0.0, SND_STOP, PITCH_NORM)
emit_sound(id, CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
public event_deathmsg()
{
emit_sound(read_data(2), CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
public event_resethud(id)
{
emit_sound(id, CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
public event_spectator()
{
emit_sound(read_data(1), CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
public is_user_infected(id, infector)
{
emit_sound(id, CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
I edited this plugin from Zp (Zombie Plague) to work with Biohazard Mod
So,when you have under 50 Hp you will hear a beat.
bio_heartbeat_hp <50> - Heartbeats start when HP is lower than this
If you don`t have the sound
Download heartbeat1.wav and put on sound/player/
You prefer another beat sound ?Change it from .sma
new const g_heartbeat[] = "player/heartbeat1.wav"
If you have problems with your compiler ,try my compiler (is upper)
Original Plugin
http://forums.alliedmods.net/showpos...postcount=1299