View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-14-2009 , 13:32   Re: Knife Distance by SchlumPF
Reply With Quote #28

Quote:
Well then i misunderstood global_get(). Does it return the last trace of a global scope, or does it return the last trace of a local function scope?
If on a global scope its matters, if not it doesn't.
The first but I was meant this :

In TraceAttack :

Code:
void CBasePlayer :: TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType) {     if ( pev->takedamage )     {         [...]         TraceBleed( flDamage, vecDir, ptr, bitsDamageType );     } }

ptr is passed into TraceBleed, right. But ptr is not modified. The next TraceLine uses another vars.

Code:
void CBaseEntity :: TraceBleed( float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType ) {     // make blood decal on the wall!     TraceResult Bloodtr;     [...]     for ( i = 0 ; i < cCount ; i++ )     {         [...]         UTIL_TraceLine( ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * -172, ignore_monsters, ENT(pev), &Bloodtr);         if ( Bloodtr.flFraction != 1.0 )         {             UTIL_BloodDecalTrace( &Bloodtr, BloodColor() );         }     } }

So, the original trace from TraceLine or TraceHull passed into TraceAttack() is not modified. So hooking TraceAttack() and using the trace result passed should be good.
Arkshine is offline