Working fine.
PHP Code:
public mine_explosion(toucher, touched)
{
if(!is_valid_ent(toucher) && !is_user_connected(touched))
return;
toucher_owner = entity_get_edict(toucher, EV_ENT_owner);
// Only crashing if this check is passed!
if(cs_get_user_team(touched) != cs_get_user_team(toucher_owner))
{
entity_get_vector(toucher, EV_VEC_origin, g_origin);
if(task_exist(toucher + TASK_EXPLODE))
{
set_task(0.5, "explode", toucher + TASK_EXPLODE);
}
}
}
But now i have another problem.
PHP Code:
set_user_health(target, get_user_health(target) - damage); // work!
ExecuteHamB(Ham_TakeDamage, target, toucher, toucher, damage, DMG_ALWAYSGIB); // doesn't work! (there are no errors, just don't take damage)
I prefer to use Ham_TakeDamage instead of set_user_health.