Yes, my bad, then we can remove useless stuff.
Also, should consider that returning 9999 means there is a problem ;)
PHP Code:
Float:distance_to_ground( id )
{
new Float:start[3], Float:end[3];
entity_get_vector(id, EV_VEC_origin, start);
if( entity_get_int(id, EV_INT_flags) & FL_DUCKING )
{
start[2] += 18.0;
}
end[0] = start[0];
end[1] = start[1];
end[2] = start[2] - 9999.0;
new ptr = create_tr2();
engfunc(EngFunc_TraceHull, start, end, IGNORE_MONSTERS, HULL_HUMAN, id, ptr);
new Float:fraction;
get_tr2(ptr, TR_flFraction, fraction);
free_tr2(ptr);
return fraction * 9999.0;
}
__________________