Raised This Month: $ Target: $400
 0% 

Detecting if aiming to a grenade


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-03-2010 , 06:23   Re: Detecting if aiming to a grenade
Reply With Quote #2

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 
iTargetbody
    
if(get_user_aiming(idiTargetbody) == 0.0 || iTarget 32)
        return
    
    new 
Float:start[3], Float:view_ofs[3]
    
pev(idpev_originstart)
    
pev(idpev_view_ofsview_ofs)
    
xs_vec_add(startview_ofsstart)
    
    new 
Float:dest[3]
    
pev(idpev_v_angledest)
    
engfunc(EngFunc_MakeVectorsdest)
    
global_get(glb_v_forwarddest)
    
xs_vec_mul_scalar(dest9999.0dest)
    
xs_vec_add(startdestdest)
    
    new 
iTrace create_tr2()
    
engfunc(EngFunc_TraceModelstartdestHULL_POINTiTargetiTrace)
    
    new 
iEnt get_tr2(iTraceTR_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....
__________________
Dr.G is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:48.


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