AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get aim origin -> trace line (https://forums.alliedmods.net/showthread.php?t=82864)

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(idpev_originorigin)
    
    
// 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_TraceLineorigintracetoIGNORE_MONSTERSenttrace)
    
    new 
Float:fraction
    get_tr2
(traceTR_flFractionfraction)
   
    return 
ent;


}

stock fm_get_aimorigin(indexFloat:origin[3])
{
    new 
Float:start[3], Float:view_ofs[3];
    
pev(indexpev_originstart);
    
pev(indexpev_view_ofsview_ofs);
    
xs_vec_add(startview_ofsstart);
    
    new 
Float:dest[3];
    
pev(indexpev_v_angledest);
    
engfunc(EngFunc_MakeVectorsdest);
    
global_get(glb_v_forwarddest);
    
xs_vec_mul_scalar(dest9999.0dest);
    
xs_vec_add(startdestdest);
    
    
engfunc(EngFunc_TraceLinestartdest0index0);
    
get_tr2(0TR_vecEndPosorigin);
    
    return 
1;


in reallity, I need to get each players(or 3-4) through the walls
so something like

PHP Code:

for(new 1get_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 ?


All times are GMT -4. The time now is 09:04.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.