From 3d412a4b30a9f7c7f51ea6562e694315948bd3da Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 28 Nov 2018 16:00:02 +1300 Subject: cleaned up in short, the cheat and loader are now separate solutions. unused stuff was moved into the legacy solution in case anyone wants to compile it or whatever. i can change this back if you want to. also, i configured the loader to compile in x64, and have separate build types for linux and win64 --- cheat/internal_rewrite/player_manager.hpp | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 cheat/internal_rewrite/player_manager.hpp (limited to 'cheat/internal_rewrite/player_manager.hpp') diff --git a/cheat/internal_rewrite/player_manager.hpp b/cheat/internal_rewrite/player_manager.hpp new file mode 100644 index 0000000..440ddf3 --- /dev/null +++ b/cheat/internal_rewrite/player_manager.hpp @@ -0,0 +1,68 @@ +#pragma once +#include "sdk.hpp" + +namespace features +{ + constexpr int CHEATER_SIMTIME_THRESHOLD = 10; + constexpr int CHEATER_AA_THRESHOLD = 50; + constexpr int CHEATER_MAX_DETECTIONS = 200; + + class c_player_record { + float m_last_simtime; + int m_simtime_detections; + int m_aa_detections; + bool m_is_cheater; + + c_base_player* m_ent; + + void clear( ) { + m_last_simtime = { }; + m_simtime_detections = { }; + m_aa_detections = { }; + m_is_cheater = { }; + m_ent = { }; + } + + void update_simtime( ) { + if( !m_ent ) return; + + if( m_ent->m_flSimulationTime( ) == m_last_simtime ) { + m_simtime_detections += 2; + } + else if( m_simtime_detections > 0 ) { + m_simtime_detections--; + } + m_last_simtime = m_ent->m_flSimulationTime( ); + } + + void update_antiaim( ) { + if( !m_ent ) return; + + auto pitch = m_ent->m_angEyeAngles( ).x; + if( pitch > 75.f && m_aa_detections < CHEATER_MAX_DETECTIONS ) { + m_aa_detections++; + } + else if( m_aa_detections > 0 ) { + m_aa_detections--; + } + } + + void update_cheater( ) { + m_is_cheater = ( m_simtime_detections > CHEATER_SIMTIME_THRESHOLD + || m_aa_detections > CHEATER_AA_THRESHOLD ) + && m_simtime_detections; + } + + public: + c_player_record( ) { clear( ); } + bool is_cheater( ) const { return m_is_cheater; } + void update( int ent_index ); + }; + + class c_player_manager { + std::array< c_player_record, 65 > m_players; + public: + void frame_stage_notify( ); + bool is_cheater( int ent_index ); + }; +} \ No newline at end of file -- cgit v1.2.3