PDA

View Full Version : What is wrong?


Vechta
06-28-2010, 14:07
If zombies has X health it shows blood sprites on his body but it doesnt work..

/*============================================ ====================================

---------------------------------
-*- [ZP] Low HP Heartbeat 1.1 -*-
---------------------------------

~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~

This plugin plays a heartbeat sound on humans when their health
is under certain amount.

~~~~~~~~~
- CVARS -
~~~~~~~~~

* zp_heartbeat_hp <50> - Heartbeats start when HP is lower than this

~~~~~~~~~~~~~~
- Credits to -
~~~~~~~~~~~~~~

* ConnorMcLeod, AlexBreems: for the original plugin

============================================= ===================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

new cvar_heartbeathp

public plugin_init()
{
register_plugin("[ZP] 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("zp_heartbeat_hp", "50")
}

public event_damage(id)
{
if (get_user_health(id) > get_pcvar_num(cvar_heartbeathp) || !zp_get_user_zombie(id))
return;

set_task(1.0, "show_effect", id)
}

public show_effect(id)
{
if(is_user_alive(id) && zp_get_user_zombie(id))
{
set_task(1.0, "show_effect", id)

static Float:FOrigin3[3]
pev(id, pev_origin, FOrigin3)

engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, FOrigin3, 0)
write_byte(TE_PARTICLEBURST) // TE id
engfunc(EngFunc_WriteCoord, FOrigin3[0]) // x
engfunc(EngFunc_WriteCoord, FOrigin3[1]) // y
engfunc(EngFunc_WriteCoord, FOrigin3[2]) // z
write_short(50) // radius
write_byte(72) // color
write_byte(2) // duration (will be randomized a bit)
message_end()
}
return PLUGIN_HANDLED
}

Vechta
06-28-2010, 14:33
problem solved..