I think this is a better and easier way. Credits goes to VEN
Code:
public FW_TraceLine(Float:v1[3], Float:v2[3], noMonsters, id)
{
if(!is_user_connected(id) || !is_user_alive(id))
return FMRES_IGNORED
new victim = get_tr(TR_pHit)
if(!is_user_connected(victim) || !is_user_alive(victim))
return FMRES_IGNORED
if(!fm_is_ent_visible(id, victim)) {
set_tr(TR_flFraction, 1.0)
}
return FMRES_IGNORED
}
stock bool:fm_is_ent_visible(index, entity)
{
new Float:origin[3], Float:view_ofs[3], Float:eyespos[3]
pev(index, pev_origin, origin)
pev(index, pev_view_ofs, view_ofs)
xs_vec_add(origin, view_ofs, eyespos)
new Float:entpos[3]
pev(entity, pev_origin, entpos)
engfunc(EngFunc_TraceLine, eyespos, entpos, 0, index)
switch (pev(entity, pev_solid)) {
case SOLID_BBOX..SOLID_BSP: return global_get(glb_trace_ent) == entity
}
new Float:fraction
global_get(glb_trace_fraction, fraction)
if (fraction == 1.0)
return true
return false
}
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.