-
Автор темы
- #1
so im trying to fix this cheat, i fixed everything except the ragebot. whenever i turn it on its just not doing anything.
heres code:
heres code:
Код:
/* ragebot main part */
void C_RageBot::Instance( )
{
/* make previous aimbot target invalid */
m_ScanData.m_AimTarget.m_Player = NULL;
/* reset recurse state */
m_bIsRecursed = false;
/* check conditions */
if ( g_Globals->m_LocalPlayer->IsFrozen( ) || !g_SettingsManager->B[ _S( "ragebot.enable" ) ] )
{
memset( m_ScanData.m_BadPlayers.data( ), 0, m_ScanData.m_BadPlayers.size( ) );
return;
}
/* get weapon and check it */
C_BaseCombatWeapon* pWeapon = g_Globals->m_LocalPlayer->m_hActiveWeapon( );
if ( !pWeapon )
{
memset( m_ScanData.m_BadPlayers.data( ), 0, m_ScanData.m_BadPlayers.size( ) );
return;
}
/* has no ammo */
if ( pWeapon->m_iClip1( ) <= 0 )
{
memset( m_ScanData.m_BadPlayers.data( ), 0, m_ScanData.m_BadPlayers.size( ) );
return;
}
/* get weapon data */
const C_CSWeaponData* pWeaponData = pWeapon->GetWeaponData( );
if ( !pWeaponData )
{
memset( m_ScanData.m_BadPlayers.data( ), 0, m_ScanData.m_BadPlayers.size( ) );
return;
}
/* setup default ragebot accuracy */
float flDefaultInaccuracy = 0.0f;
if ( g_Globals->m_LocalPlayer->m_bDucked( ) || g_Globals->m_LocalPlayer->m_fFlags( ) & FL_DUCKING )
{
if ( pWeapon->m_nWeaponMode( ) != 0 )
flDefaultInaccuracy = pWeaponData->m_flInaccuracyCrouchAlt;
else
flDefaultInaccuracy = pWeaponData->m_flInaccuracyCrouch;
}
else
{
if ( pWeapon->m_nWeaponMode( ) != 0 )
flDefaultInaccuracy = pWeaponData->m_flInaccuracyStandAlt;
else
flDefaultInaccuracy = pWeaponData->m_flInaccuracyStand;
}
m_CachedData.m_flDefaultAccuracy = flDefaultInaccuracy;
/* cache accuracy seeds */
if ( m_CachedData.m_bShouldBeCached )
{
/* setup hitchance seeds */
for ( int nSeed = 0; nSeed < 256; nSeed++ )
{
/* set random seed */
g_Utils->RandomSeed( nSeed + 1 );
/* generate random */
m_CachedData.m_Seeds.m_Theta0[ nSeed ] = g_Utils->RandomFloat( 0.0f, pi / 0.5f );
m_CachedData.m_Seeds.m_Theta1[ nSeed ] = g_Utils->RandomFloat( 0.0f, pi / 0.5f );
m_CachedData.m_Seeds.m_Spread[ nSeed ] = g_Utils->RandomFloat( 0.0f, 1.0f );
m_CachedData.m_Seeds.m_flInaccuracy = g_Utils->RandomFloat( 0.0f, 1.0f );
}
/* setup accuracy sin/cos */
for ( int nSeed = 0; nSeed < 8; nSeed++ )
{
/* calcualte direction cos/sin */
float flDirCos, flDirSin;
DirectX::XMScalarSinCos( &flDirCos, &flDirSin, DirectX::XM_2PI * ( ( float ) ( nSeed ) / 8.0f ) );
/* push the pair of direction sin/cos */
m_CachedData.m_AccuracyBoost.m_Iterations[ nSeed ] = std::make_pair( flDirCos, flDirSin );
}
/* do not cache data twice */
m_CachedData.m_bShouldBeCached = false;
}
/* force scope function */
auto ForceWeaponZoom = [ & ] ( )
{
/* we cannot zoom and attack at the same time */
g_Globals->m_Packet.m_pCmd->m_nButtons |= IN_ATTACK2;
g_Globals->m_Packet.m_pCmd->m_nButtons &= ~IN_USE;
g_Globals->m_Packet.m_pCmd->m_nButtons &= ~IN_ATTACK;
/* force repredict due to forced zoom */
g_EnginePrediction->RePredict( );
};
/* handle accuracy failure */
auto HandleAccuracyFailure = [ & ] ( )
{
/* check autoscope */
if ( !m_Settings.m_bAutoScope )
return;
/* hitchance has been failed. we can increase accuracy in the next tick in some cases */
if ( pWeapon->IsSniper( ) )
{
/* if we are already scoped, then we can't do anything. So, if we ain't scoped then we have to force it */
if ( pWeapon->m_nWeaponMode( ) == CSWeaponMode::Primary_Mode )
{
/* get distance to player */
float flDistanceToPlayer = g_Globals->m_LocalPlayer->m_vecOrigin( ).DistTo( m_ScanData.m_AimTarget.m_Record.m_vecOrigin );
/* check distance for a weapon isn't auto-sniper */
if ( pWeapon->m_nItemID( ) != WEAPON_SCAR20 && pWeapon->m_nItemID( ) != WEAPON_G3SG1 )
{
/* distance is too long and we'll need to zoom and repredict */
if ( flDistanceToPlayer > 200.0f )
ForceWeaponZoom( );
}
else if ( flDistanceToPlayer > 500.0f )
ForceWeaponZoom( );
}
}
};
if ( pWeapon->m_nItemID( ) == WEAPON_REVOLVER )
g_Revolver->OnCreateMove( );
/* get shoot position */
Vector vecShootPosition = g_LocalAnimations->GetShootPosition( );
/* continue state */
bool bContinueRageBot = true;
/* run ragebot */
if ( pWeapon->m_nItemID( ) == WEAPON_TASER )
{
// g_RageBot->TaserBot( );
}
else if ( pWeapon->IsKnife( ) )
{
// g_RageBot->KnifeBot( );
}
else if ( pWeapon->IsGun( ) )
{
/* can fire check */
bool bCanFire = g_Globals->m_Packet.m_bCanFire;
if ( pWeaponData->m_flCycleTimeAlt > 0.2f )
if ( !bCanFire )
return;
/* find target and check it */
g_RageBot->FindTarget( vecShootPosition );
if ( bCanFire && m_ScanData.m_AimTarget.m_Player )
{
if ( pWeapon->m_nItemID( ) == WEAPON_REVOLVER && !g_Globals->m_Packet.m_bCanFireRev )
{
g_Globals->m_Packet.m_pCmd->m_nButtons |= IN_ATTACK;
return;
}
/* store buttons */
int nButtons = g_Globals->m_Packet.m_pCmd->m_nButtons;
/* auto-scope if needed */
HandleAccuracyFailure( );
/* did we scope */
if ( nButtons != g_Globals->m_Packet.m_pCmd->m_nButtons )
bContinueRageBot = false;
/* continue ragebot only if we has no failures at previous checks */
if ( bContinueRageBot )
{
/* now we'll have to check hitchance */
float flHitChance = g_RageBot->GetHitchance( );
if ( flHitChance < ( float ) ( m_Settings.m_nHitChance ) )
{
/* hitchance has been failed. we can increase accuracy in the next tick in some cases */
HandleAccuracyFailure( );
/* do not continue */
bContinueRageBot = false;
}
/* if we have good accuracy then run ragebot */
if ( bContinueRageBot )
{
/* calculate aimbot angles */
QAngle angAimbotAngles = Math::CalcAngle( vecShootPosition, m_ScanData.m_AimTarget.m_Point.m_vecPoint );
/* compensate recoil if we have it turned on */
const float flWeaponRecoilScale = SDK::EngineData::m_ConvarList[ CheatConvarList::WeaponRecoilScale ]->GetFloat( );
if ( flWeaponRecoilScale > 0.0f )
angAimbotAngles -= g_Globals->m_LocalPlayer->m_aimPunchAngle( ) * flWeaponRecoilScale;
/* calculate player tick */
int nTickCount = g_Utils->TimeToTicks( m_ScanData.m_AimTarget.m_Record.m_flSimulationTime + g_LagCompensation->GetLerpTime( ) );
/* set tick */
g_Globals->m_Packet.m_pCmd->m_nTickCount = nTickCount;
/* force attack */
g_Globals->m_Packet.m_pCmd->m_nButtons &= ~IN_USE;
g_Globals->m_Packet.m_pCmd->m_nButtons |= IN_ATTACK;
/* set angles */
g_Globals->m_Packet.m_pCmd->m_angViewAngles = angAimbotAngles;
/* force sendpacket */
if ( !g_Globals->m_Packet.m_bFakeDucking )
*g_Globals->m_Packet.m_bSendPacket = true;
/* get records */
auto& Records = g_LagCompensation->GetPlayerRecords( m_ScanData.m_AimTarget.m_Player );
/* Handle Ragebot fire */
RageShot_t* RageShot = &g_ShotSystem->m_RageShots.emplace_front( );
RageShot->m_Target = m_ScanData.m_AimTarget;
RageShot->m_nTickCount = g_Networking->GetServerTick( );
RageShot->m_nEstimate = g_Networking->GetServerTick( ) + g_Utils->TimeToTicks( g_Networking->GetLatency( ) ) + MAX_SIMULATION_TICKS;
RageShot->m_flWeaponDamage = static_cast < float > ( pWeaponData->m_iDamage );
RageShot->m_vecShootPosition = g_LocalAnimations->GetShootPosition( );
RageShot->m_nTrackedTicks = g_Utils->TimeToTicks( Records.back( ).m_flSimulationTime - m_ScanData.m_AimTarget.m_Record.m_flSimulationTime );
#ifdef OVERSEE_DEV
auto GetHitboxNameFromId = [ & ] ( int id ) -> std::string
{
switch ( id )
{
case HITBOX_HEAD:
return _S( "head" );
case HITBOX_CHEST:
return _S( "chest" );
case HITBOX_STOMACH:
return _S( "stomach" );
case HITBOX_PELVIS:
return _S( "pelvis" );
case HITBOX_RIGHT_UPPER_ARM:
case HITBOX_RIGHT_FOREARM:
case HITBOX_RIGHT_HAND:
return _S( "left arm" );
case HITBOX_LEFT_UPPER_ARM:
case HITBOX_LEFT_FOREARM:
case HITBOX_LEFT_HAND:
return _S( "right arm" );
case HITBOX_RIGHT_THIGH:
case HITBOX_RIGHT_CALF:
return _S( "left leg" );
case HITBOX_LEFT_THIGH:
case HITBOX_LEFT_CALF:
return _S( "right leg" );
case HITBOX_RIGHT_FOOT:
return _S( "left foot" );
case HITBOX_LEFT_FOOT:
return _S( "right foot" );
}
};
PlayerInfo_t Data;
SDK::Interfaces::EngineClient->GetPlayerInfo( m_ScanData.m_AimTarget.m_Player->EntIndex( ), &Data );
const Vector shootpos = g_LocalAnimations->GetShootPosition( );
/* build console message */
std::string szConsoleMessage =
( std::string ) ( _S( "[ RageBot ] Fired shot at " ) )
+
Data.m_strName
+
_S( " | ACC: " ) + std::to_string( ( int ) ( flHitChance ) )
+
_S( " | Lethal: " ) + std::to_string( ( int ) ( m_ScanData.m_AimTarget.m_Point.m_flDamage >= m_ScanData.m_AimTarget.m_Player->m_iHealth( ) ) )
+
_S( " | Safe: " ) + std::to_string( ( int ) ( this->IsSafePoint( m_ScanData.m_AimTarget.m_Player, &m_ScanData.m_AimTarget.m_Record, g_LocalAnimations->GetShootPosition( ), m_ScanData.m_AimTarget.m_Point.m_vecPoint, m_ScanData.m_AimTarget.m_Point.m_HitboxData ) ) )
+
_S( " | Velocity: " ) + std::to_string( ( int ) ( m_ScanData.m_AimTarget.m_Record.m_flAnimationVelocity ) )
+
_S( " | Backtrack: " ) + std::to_string( RageShot->m_nTrackedTicks )
+
_S( " | Damage: " ) + std::to_string( m_ScanData.m_AimTarget.m_Point.m_flDamage )
+
_S( " | Hitbox: " ) + GetHitboxNameFromId( m_ScanData.m_AimTarget.m_Point.m_HitboxData.m_nHitbox )
+
_S( "\n" );
/* print console msg */
SDK::Interfaces::CVar->ConsolePrintf( szConsoleMessage.c_str( ) );
#endif
/* Capture matrix for on shot chams */
g_ShotChams->OnRageBotFire( m_ScanData.m_AimTarget.m_Player, m_ScanData.m_AimTarget.m_Record.m_Matricies[ EBoneMatrix::Visual ].data( ), m_ScanData.m_AimTarget.m_Record.m_vecAbsOrigin );
}
}
else
{
/* force weapon zoom */
HandleAccuracyFailure( );
}
}
}
}