diff options
| author | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
|---|---|---|
| committer | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
| commit | 3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch) | |
| tree | 26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /cheat/gmod/player_manager.hpp | |
| parent | e4729e4393d90271a3814c7a79950a660c48325a (diff) | |
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
Diffstat (limited to 'cheat/gmod/player_manager.hpp')
| -rw-r--r-- | cheat/gmod/player_manager.hpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/cheat/gmod/player_manager.hpp b/cheat/gmod/player_manager.hpp new file mode 100644 index 0000000..6a89b36 --- /dev/null +++ b/cheat/gmod/player_manager.hpp @@ -0,0 +1,67 @@ +#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;
+ }
+
+ 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 |
