Hey guys i'm a noob in scripting and i need some help. Here's the part of a code:
Code:
public damage_event(id) {
new arg[2]
arg[0] = get_user_attacker(id)
set_task(0.5, "loop_burn", id, arg[0], 0, "a", g_p_upg[attacker][UPG_FNADE] );
}
public loop_burn(id,arg[0]){
if(!is_user_alive(id) || pev(id, pev_flags)&FL_INWATER)
return;
static Float:originF[3];
pev(id, pev_origin, originF);
new rnd = random_num(5, 10);
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0);
write_byte(TE_SPRITE);
engfunc(EngFunc_WriteCoord, originF[0]+random_float(-5.0, 5.0));
engfunc(EngFunc_WriteCoord, originF[1]+random_float(-5.0, 5.0));
engfunc(EngFunc_WriteCoord, originF[2]+random_float(-10.0, 10.0));
write_short(g_flameSpr);
write_byte(rnd);
write_byte(200);
message_end();
new bool:death = (rnd>=float(get_user_health(id)))?true:false;
if( death )
{
new get_user_msgid_DeathMsg;
get_user_msgid_DeathMsg = get_user_msgid("DeathMsg");
set_msg_block(get_user_msgid_DeathMsg, BLOCK_ONCE);
user_kill(id);
make_deathmsg(arg[0], id, 0, "grenade")
}else{
set_user_health(id, get_user_health(id) - rnd);
}
}
Now i want to fully imitate a grenade death, but the problem is i can't seem to understand how to get the killer wich attacked. Using the method above gives me a client freeze upon death