I will not tell u how to use this? omg...
Code:
/************************************************************************/
/* */
/************************************************************************/
#ifndef _C_AUTOWALL_H_
#define _C_AUTOWALL_H_
class CAutoWall
{
private:
void DisableBulletImpacts( );
void DisableBulletTrails( );
void EnableBulletImpacts( );
void EnableBulletTrails( );
void SetupBulletTrace( bulletTrace_t* btr, vec3_t start, vec3_t end, int skipNum );
public:
CAutoWall( );
~CAutoWall( );
bool GetRemainingPower( vec3_t vieworg, centity_t* cent, vec3_t origin, float* remainingPower );
};
extern CAutoWall AutoWall;
#endif
Code:
CAutoWall::CAutoWall( )
{
}
// ----------------------------------------------------------------------
CAutoWall::~CAutoWall( )
{
}
void CAutoWall::SetupBulletTrace( bulletTrace_t* btr, vec3_t start, vec3_t end, int skipNum )
{
btr->worldEntNum = 1022;
btr->skipNum = skipNum;
btr->power = 1.0f;
btr->bulletType = 1;
VectorCopy( cg->refdef.Vieworg, btr->vieworg );
VectorCopy( start, btr->start );
VectorCopy( end, btr->end );
vec3_t delta;
VectorSubtract( end, start, delta );
vec3_t angles;
Math.vectoangles( delta, angles );
Math.AngleVectors( angles, btr->viewDirection, NULL, NULL );
}
void DrawBulletTrajectory( centity_t* cent, int a2, bulletTrace_t* bulletTrace, weapon_t* weapon, vec3_t vieworg, int serverTimeDelta )
{
DWORD dwCallAddr = 0x00455A80;
__asm
{
push [ serverTimeDelta ];
push [ vieworg ];
push [ weapon ];
push [ bulletTrace ];
push [ a2 ];
mov edi, [ cent ];
call [ dwCallAddr ];
add esp, 0x14;
}
}
void PatchBytes( void * lpAddress, const char * szBytes, int nLen )
{
// Needed by VirtualProtect.
DWORD dwBack = 0;
VirtualProtect( lpAddress, nLen, PAGE_READWRITE, &dwBack );
// Write Byte-After-Byte.
for( int i = 0; i < nLen; i++ )
*( BYTE * )( ( DWORD )lpAddress + i ) = szBytes[ i ];
// Restore old protection.
VirtualProtect( lpAddress, nLen, dwBack, &dwBack );
}
void CAutoWall::DisableBulletImpacts( )
{
PatchBytes( ( void* )0x00455A20, "\xC3", 1 );
}
// ----------------------------------------------------------------------
void CAutoWall::DisableBulletTrails( )
{
PatchBytes( ( void* )0x00458110, "\xC3", 1 );
}
// ----------------------------------------------------------------------
void CAutoWall::EnableBulletImpacts( )
{
PatchBytes( ( void* )0x00455A20, "\x8B", 1 );
}
// ----------------------------------------------------------------------
void CAutoWall::EnableBulletTrails( )
{
PatchBytes( ( void* )0x00458110, "\x83", 1 );
}
// ----------------------------------------------------------------------
weapon_t** cg_weapons2 = ( weapon_t** )0x00736DB8;
bool CAutoWall::GetRemainingPower( vec3_t vieworg, centity_t* cent, vec3_t origin, float* remainingPower )
{
bulletTrace_t bulletTrace;
SetupBulletTrace( &bulletTrace, vieworg, origin, 0 );
int serverTimeDelta = cg->nextSnap->serverTime - cg->snap->serverTime;
if ( serverTimeDelta < 0 )
serverTimeDelta = 0;
DisableBulletImpacts( );
DisableBulletTrails( );
DrawBulletTrajectory( &cg->predictedPlayerEntity, 0, &bulletTrace, cg_weapons2[ cg->predictedPlayerState.weapon ], vieworg, serverTimeDelta );
EnableBulletImpacts( );
EnableBulletTrails( );
if ( bulletTrace.skipNum == cent->clientNum )
{
*remainingPower = bulletTrace.power;
return true;
}
else
{
*remainingPower = 0.0f;
return false;
}
}