I would love the answer to this aswell! I tryed to get what the client was aiming at and the trace that model, but i only got crashes too....
This is what i tryed:
PHP Code:
public do_trace(id)
{
new iTarget, body
if(get_user_aiming(id, iTarget, body) == 0.0 || iTarget < 32)
return
new Float:start[3], Float:view_ofs[3]
pev(id, pev_origin, start)
pev(id, pev_view_ofs, view_ofs)
xs_vec_add(start, view_ofs, start)
new Float:dest[3]
pev(id, pev_v_angle, dest)
engfunc(EngFunc_MakeVectors, dest)
global_get(glb_v_forward, dest)
xs_vec_mul_scalar(dest, 9999.0, dest)
xs_vec_add(start, dest, dest)
new iTrace = create_tr2()
engfunc(EngFunc_TraceModel, start, dest, HULL_POINT, iTarget, iTrace)
new iEnt = get_tr2(iTrace, TR_pHit)
//client_print(id, 3, "iEnt %d", iEnt)
if(has_grenade_mdl(iEnt))
{
// Do something
}
free_tr2(iTrace)
}
Might be TOTALLY wrong. I havent used traceline much....
__________________