PHP Code:
void (*CG_Trace)(Trace* Trace, vec3_t Start, vec3_t End, int skipNumber, int mask, int a6, int a7) = (void (__cdecl *)(Trace* , vec3_t , vec3_t , int , int , int , int ))0x00438A60;
struct Trace
{
char z_crap[16];
float fraction;
char z_crap2[8];
WORD solid;
WORD allsolid;
int entityNum;
int unknow;
char z_crap3[68];
};
int (__cdecl *k_AttackOn)() = (int (__cdecl *)())0x7FCF60;
int (__cdecl *k_AttackOff)() = (int (__cdecl *)())0x7FD030;
Trace crosshair_trace;
int CAimbot::ScanCrosshairEntity( )
{
vec3_t angle, end;
VectorCopy( cg->refdef.Location, angle);
VectorMA( angle, 131072, cg->refdef.ViewAxis[0], end );
CG_Trace( &crosshair_trace, angle, end, 0, 0x280B001, 0, 0 );
if(crosshair_trace.entityNum < 32 )
{
return crosshair_trace.entityNum;
}
return -1;
}
bool CAimbot::TrigerBot( )
{
int CrosshairClient = ScanCrosshairEntity( );
static int lastShotTime = 0;
int GetTick = GetTickCount( );
if(ClientInfo[CrosshairClient].Team != ClientInfo[ PlayerSnap->clientNum ].Team || ClientInfo[CrosshairClient].Team == TEAM_FREE)
{
if ( !lastShotTime && CrosshairClient >=0 )
{
lastShotTime = GetTick;
k_AttackOn( );
return true;
}
else if(GetTick - lastShotTime > 100 )
{
lastShotTime = 0;
k_AttackOff( );
return false;
}
else if (lastShotTime != 0)
{
return true;
}
}
return false;
}
Credits:
King-Orgy - source
Tamimego/idtech3 sdk