| steve139 |
12-31-2008 06:19 |
get aim origin -> trace line
Hello,
I want to draw a line to player aim but,
I want to through wall so get_user_origin(player,origin[3],3) cant work ...
so I need a trace line certenly
(e.g. in this picture : http://www.ts-x.eu/files/line2.JPG )
but not exactly this position the as far away as possible ...
PHP Code:
public draw_line(id) { // get the origin of the player. new Float:origin[3] pev(id, pev_origin, origin) // We want to trace down to the floor, if it's there. new Float:traceto[3] // how to get that :/ ? fm_get_aimorigin(id,traceto) // maybe with using that its can be extended new trace = 0 // Draw the traceline. engfunc(EngFunc_TraceLine, origin, traceto, IGNORE_MONSTERS, ent, trace) new Float:fraction get_tr2(trace, TR_flFraction, fraction) return ent;
}
stock fm_get_aimorigin(index, Float:origin[3]) { new Float:start[3], Float:view_ofs[3]; pev(index, pev_origin, start); pev(index, pev_view_ofs, view_ofs); xs_vec_add(start, view_ofs, start); new Float:dest[3]; pev(index, 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); engfunc(EngFunc_TraceLine, start, dest, 0, index, 0); get_tr2(0, TR_vecEndPos, origin); return 1; }
in reallity, I need to get each players(or 3-4) through the walls
so something like
PHP Code:
for(new i = 1; i < get_maxplayers(); i++) { // or while(etc etc) new target = draw_line(id) user_silentkill(target) // well not really good way to do but I need to get the trace line correctly }
can you help me please ?
|