hey guys please help me with this i know you guys are good at this.. the compiling of this .sma won't stop..it even won't move a thng..what this plugin does is it emits a low hp hearbeat when you have less hp and also displays a sprite when you have low hp.the sound and sprite will only be shown/hear to those who have less hp like 30..
PHP Code:
================================================================================*/
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#define lowhp "mw2/mw2lowhp.spr
/*================================================================================
[Plugin Customization]
=================================================================================*/
// Constants
new const g_heartbeat[] = "player/heartbeat1.wav"
/*============================================================================*/
new cvar_heartbeathp
new time_show_set[5.0]
new spr_current[5.0]
public plugin_precache()
{
precache_sound(g_heartbeat)
}
public plugin_init()
{
register_plugin("MW2 Low Hp", "1.1", "RazielJohn619.")
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("heartbeat_hp", "25")
}
public event_damage(id)
{
if (get_user_health(id) > get_pcvar_num(cvar_heartbeathp) )
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)
if (get_user_health(id) > get_pcvar_num(cvar_heartbeathp) )
return
//client_cmd(id, "show_spr", spr_lowhp)
//show_spr(id, set_show_time(5), spr_lowhp)
set_task(0.1, "show_spr", id)
new show_spr(mw2lowhp)
new hide_spr
}
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 show_spr(id, idspr)
{
new sec_c = get_systime()
time_show_set[id] = sec_c
hide_spr(id, spr_current[id])
spr_current[id] = idspr
new spr_name[33]
if (idspr==1) spr_name = "mw2lowhp"
if(!(pev(id,pev_button) & FL_ONGROUND))
{
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
write_byte(1); // status (0=hide, 1=show, 2=flash)
write_string(spr_name); // sprite name
message_end();
spr_current[id] = 0
}
public hide_spr(id, idspr)
{
new spr_name[33]
if (idspr==1) spr_name = "mw2lowhp"
if(!(pev(id,pev_button) & FL_ONGROUND))
{
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
write_byte(0); // status (0=hide, 1=show, 2=flash)
write_string(spr_name); // sprite name
message_end();
spr_current[id] = 0
{
please guys i want this code to be fix and compiled without anything wrong..