I am trying to build a suicide bomb plugin for CTs. I can't get the suicide bomb to cause the damage it is supposed to. The task to initial the count down and the explosion is working fine. In the task I set:
PHP Code:
new Float:flOrigin[3];
get_user_origin(id, flOrigin, 0);
and I also call the function that is supposed to cause the damage
PHP Code:
fm_radius_damage(id, flOrigin, get_pcvar_float(g_pSuicideDamage), get_pcvar_float(g_pSuicideRadius));
PHP Code:
stock fm_radius_damage(id, orig[3], dmg , rad)
{
new Health;
static Ent
Ent = -1
while((Ent = engfunc(EngFunc_FindEntityInSphere, Ent, orig, rad)))
{
if(is_user_alive(Ent))
{
if(cs_get_user_team(Ent) == CS_TEAM_T)
{
Health = get_user_health(Ent);
Health -= dmg;
if(Health <= 0.0){
user_kill(Ent);
set_user_frags(Ent,get_user_frags(Ent) + 1);
}
else{
set_user_health(Ent, Health);
}
}
}
}
}
This is not working though. Sometime the other player might be standing right next to the suicide bomber and it wont even hurt him. Could anyone help me out? Thank you