PHP Code:
public Ham_Touch_pre(ent, other)
{
if(!is_valid_ent(ent))
return HAM_IGNORED;
if(is_user_alive(other))
{
new owner = entity_get_edict(ent, EV_ENT_owner);
//ExecuteHamB(Ham_Killed, other, owner, 0);
ExecuteHamB(Ham_TakeDamage, other, ent, owner, 300.0, (1 << 24));
}
emit_sound(ent, CHAN_AUTO, "player/pl_snow1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
static Float:origin[3];
entity_get_vector(ent, EV_VEC_origin, origin);
sw_effect(origin);
remove_entity(ent);
return HAM_SUPERCEDE;
}
Here is my code which was crashing. Which I discovered was that entity got removed or something like that and server crashed on remove_entity. After putting it in is_valid_ent check it worked fine. Don't know why that happened, but might be ham deleting my entity? Because it was crashing only when I hit player.
__________________