Quote:
Originally Posted by joropito
I don't know really but maybe get_user_aiming (what uses traceline with player entity as ignored entity ) can't detect entities within the same owner as the player (?).
Btw, you can use manually
- trace_line
- trace_hull
- EngFunc_TraceModel (this is the best way I think)
|
My method good, also it won't remove when damage goes < 1.0, it won't explode, I know the problem, but don't know how to fix, it's problem with SOLIDS :/
Also I don't want to change X Y Z origins in above code, becouse of
#23.
PHP Code:
// init
RegisterHam( Ham_TakeDamage, "info_target", "Fwd_DamageEnt" );
// forward
public Fwd_DamageEnt(ent, inflictor, attacker, Float:damage, damagebits)
{
if( !pev_valid(ent) || !is_user_connected(attacker) ) return HAM_IGNORED;
new Float:fOrigin[3], iOrigin[3], Float: Torigin[3], Float: Distance, Float: Damage;
entity_get_vector( ent, EV_VEC_origin, fOrigin);
new Classname[32];
entity_get_string( ent, EV_SZ_classname, Classname, charsmax(Classname) );
if( !equal (Classname, "PropItem") )
return HAM_IGNORED
if ( damagebits & DMG_HEGRENADE || get_user_weapon(attacker) == CSW_KNIFE )
{
SetHamParamFloat(4, 0.0);
return HAM_HANDLED;
}
if ( entity_get_float( ent, EV_FL_health) - damage < 1.0 )
{
iOrigin[0] = floatround(fOrigin[0])
iOrigin[1] = floatround(fOrigin[1])
iOrigin[2] = floatround(fOrigin[2])
message_begin(MSG_BROADCAST,SVC_TEMPENTITY, iOrigin)
write_byte(TE_EXPLOSION)
engfunc( EngFunc_WriteCoord,fOrigin[0])
engfunc( EngFunc_WriteCoord,fOrigin[1])
engfunc( EngFunc_WriteCoord,fOrigin[2])
write_short(explodespr)
write_byte(35)
write_byte(20)
write_byte(0)
message_end()
for(new enemy = 1; enemy <= g_max_clients; enemy++)
{
if ( is_user_alive(enemy) && get_user_team(attacker) != get_user_team(enemy) && attacker != enemy)
{
entity_get_vector( enemy, EV_VEC_origin, Torigin)
Distance = get_distance_f(fOrigin, Torigin)
if ( Distance <= get_pcvar_float(propane_explo_radius) )
{
Damage = (((Distance / get_pcvar_float(propane_explo_radius)) * get_pcvar_float(propane_explo_dmg)) - get_pcvar_float(propane_explo_dmg)) * -1.0;
if ( Damage > 0.0 )
{
ExecuteHam(Ham_TakeDamage, enemy, g_iGrenade, attacker, Damage, DMG_HEGRENADE);
}
}
}
}
}
return HAM_IGNORED;
}
__________________