Raised This Month: $ Target: $400
 0% 

get_user_aiming SOLID_TRIGGER problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 06-05-2013 , 10:49   Re: get_user_aiming SOLID_TRIGGER problem
Reply With Quote #1

Code from Grab+ plugin by ian.cammarata:

Code:
stock traceline( const Float:vStart[3], const Float:vEnd[3], const pIgnore, Float:vHitPos[3] ){     engfunc( EngFunc_TraceLine, vStart, vEnd, 0, pIgnore, 0 )     get_tr2( 0, TR_vecEndPos, vHitPos )     return get_tr2( 0, TR_pHit ) } stock get_view_pos( const id, Float:vViewPos[3] ){     new Float:vOfs[3]     pev( id, pev_origin, vViewPos )     pev( id, pev_view_ofs, vOfs )               vViewPos[0] += vOfs[0]     vViewPos[1] += vOfs[1]     vViewPos[2] += vOfs[2] } stock Float:vel_by_aim( id, speed = 1 ){     new Float:v1[3], Float:vBlah[3]     pev( id, pev_v_angle, v1 )     engfunc( EngFunc_AngleVectors, v1, v1, vBlah, vBlah )         v1[0] *= speed     v1[1] *= speed     v1[2] *= speed         return v1 } stock get_aiment(id){     new target     new Float:orig[3], Float:ret[3]     get_view_pos( id, orig )     ret = vel_by_aim( id, 9999 )         ret[0] += orig[0]     ret[1] += orig[1]     ret[2] += orig[2]         target = traceline( orig, ret, id, ret )         new movetype     if( target && pev_valid( target ) )     {         movetype = pev( target, pev_movetype )         if( !( movetype == MOVETYPE_WALK || movetype == MOVETYPE_STEP || movetype == MOVETYPE_TOSS ) )             return 0     }     else     {         target = 0         new ent = engfunc( EngFunc_FindEntityInSphere, -1, ret, 10.0 )         while( !target && ent > 0 )         {             movetype = pev( ent, pev_movetype )             if( ( movetype == MOVETYPE_WALK || movetype == MOVETYPE_STEP || movetype == MOVETYPE_TOSS )             && ent != id  )             target = ent             ent = engfunc( EngFunc_FindEntityInSphere, ent, ret, 10.0 )         }     }     if(0<target<=get_maxplayers())         return 0         new classname[32]     pev(target,pev_classname,classname,31)         return target }
__________________
The functional way is the right way
GordonFreeman (RU) is offline
Reply



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 16:22.


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