потому что надо через трейс делать
Всеравно не ворк
#include "CTriggerBot.hpp"
#include <Windows.h>
#include <CS2/SDK/SDK.hpp>
#include <CS2/SDK/Interface/CGameEntitySystem.hpp>
#include <CS2/SDK/Interface/IEngineToClient.hpp>
#include <CS2/SDK/Types/CEntityData.hpp>
#include <CS2/SDK/Update/CUserCmd.hpp>
#include <AndromedaClient/Settings/Settings.hpp>
#include <GameClient/CL_Players.hpp>
#include <GameClient/CL_VisibleCheck.hpp>
#include <GameClient/CL_Trace.hpp>
#include <GameClient/CL_Bypass.hpp>
static CTriggerBot g_CTriggerBot{};
auto CTriggerBot::OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void
{
if ( !Settings::TriggerBot::Active )
return;
if ( !pUserCmd )
return;
if ( !SDK::Interfaces::EngineToClient()->IsInGame() )
return;
PerformTriggerBot( pInput , pUserCmd );
}
auto CTriggerBot::PerformTriggerBot( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void
{
if ( !pUserCmd )
return;
auto* pLocalPlayerPawn = GetCL_Players()->GetLocalPlayerPawn();
if ( !pLocalPlayerPawn )
return;
auto* pLocalPlayerController = GetCL_Players()->GetLocalPlayerController();
if ( !pLocalPlayerController )
return;
auto [boneHash, pHitEntity] = GetCL_Trace()->TraceToBoneEntity( pInput , nullptr , nullptr );
if ( !pHitEntity )
return;
if ( !pHitEntity->IsPlayerPawn() )
return;
auto* pEnemyPawn = reinterpret_cast<C_CSPlayerPawn*>( pHitEntity );
if ( !pEnemyPawn->IsAlive() )
return;
const int32_t localTeam = pLocalPlayerController->m_iTeamNum();
const int32_t enemyTeam = pEnemyPawn->m_iTeamNum();
if ( localTeam == enemyTeam )
return;
pUserCmd->button_states.buttonstate1 |= IN_ATTACK;
Sleep( 1 );
pUserCmd->button_states.buttonstate1 &= ~IN_ATTACK;
}
auto GetTriggerBot() -> CTriggerBot*
{
return &g_CTriggerBot;
}