From 579b4b6f58a47c370eb6664a7f6655e1f5bd1699 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sun, 29 Jul 2018 14:53:08 +0300 Subject: [PATCH] stuff --- include/globals.h | 3 - include/hacks/AntiAntiAim.hpp | 12 ++ include/hacks/AutoJoin.hpp | 1 + include/hacks/Backtrack.hpp | 2 + include/hacks/CMakeLists.txt | 1 + include/localplayer.hpp | 1 + include/settings/Bool.hpp | 13 +- include/settings/Float.hpp | 6 +- include/settings/Int.hpp | 6 +- include/settings/Key.hpp | 8 +- include/settings/Rgba.hpp | 8 +- include/settings/Settings.hpp | 6 +- include/settings/String.hpp | 8 +- include/visual/EventLogging.hpp | 1 + src/hack.cpp | 4 +- src/hacks/AntiAim.cpp | 2 +- src/hacks/AntiAntiAim.cpp | 92 +++++++++ src/hacks/AutoHeal.cpp | 4 +- src/hacks/AutoJoin.cpp | 6 + src/hacks/Backtrack.cpp | 9 +- src/hacks/CMakeLists.txt | 1 + src/hacks/ESP.cpp | 24 +-- src/hacks/FollowBot.cpp | 4 +- src/hacks/Radar.cpp | 14 +- src/hacks/SkinChanger.cpp | 10 +- src/hacks/Trigger.cpp | 24 ++- src/hacks/UberSpam.cpp | 2 +- src/hacks/Walkbot.cpp | 52 ++--- src/hacks/ac/aimbot.cpp | 4 +- src/hacks/ac/antiaim.cpp | 2 +- src/hooks/CreateMove.cpp | 305 +++++------------------------ src/hooks/FireGameEvent.cpp | 5 +- src/hooks/GetFriendPersonaName.cpp | 10 +- src/hooks/LevelInit.cpp | 44 +---- src/hooks/LevelShutdown.cpp | 6 +- src/hooks/Paint.cpp | 5 +- src/hooks/Shutdown.cpp | 15 +- src/prediction.cpp | 2 +- src/visual/EventLogging.cpp | 4 + 39 files changed, 300 insertions(+), 426 deletions(-) create mode 100644 include/hacks/AntiAntiAim.hpp create mode 100644 src/hacks/AntiAntiAim.cpp diff --git a/include/globals.h b/include/globals.h index e7966115..70ccc567 100644 --- a/include/globals.h +++ b/include/globals.h @@ -23,12 +23,9 @@ extern ConVar *cl_interp; extern ConVar *cl_interpolate; extern bool *bSendPackets; -extern char *force_name_newlined; extern bool need_name_change; extern int last_cmd_number; -extern char *disconnect_reason_newlined; - extern time_t time_injected; struct brutestruct { diff --git a/include/hacks/AntiAntiAim.hpp b/include/hacks/AntiAntiAim.hpp new file mode 100644 index 00000000..d7ac11ce --- /dev/null +++ b/include/hacks/AntiAntiAim.hpp @@ -0,0 +1,12 @@ +/* + Created on 29.07.18. +*/ + +#pragma once + +namespace hacks::shared::anti_anti_aim +{ + +void createMove(); + +} \ No newline at end of file diff --git a/include/hacks/AutoJoin.hpp b/include/hacks/AutoJoin.hpp index 08e67e60..7a32e171 100755 --- a/include/hacks/AutoJoin.hpp +++ b/include/hacks/AutoJoin.hpp @@ -13,4 +13,5 @@ namespace hacks::shared::autojoin void resetQueueTimer(); void update(); void updateSearch(); +void onShutdown(); } diff --git a/include/hacks/Backtrack.hpp b/include/hacks/Backtrack.hpp index 5adb045b..72ec0044 100644 --- a/include/hacks/Backtrack.hpp +++ b/include/hacks/Backtrack.hpp @@ -60,4 +60,6 @@ extern BestTickData sorted_ticks[66]; bool isBacktrackEnabled(); float getLatency(); int getTicks(); +// FIXME +int getTicks2(); } diff --git a/include/hacks/CMakeLists.txt b/include/hacks/CMakeLists.txt index f7d8c62e..cf3677eb 100644 --- a/include/hacks/CMakeLists.txt +++ b/include/hacks/CMakeLists.txt @@ -9,6 +9,7 @@ target_sources(cathook PRIVATE "${CMAKE_CURRENT_LIST_DIR}/Aimbot.hpp" "${CMAKE_CURRENT_LIST_DIR}/Announcer.hpp" "${CMAKE_CURRENT_LIST_DIR}/AntiAim.hpp" + "${CMAKE_CURRENT_LIST_DIR}/AntiAntiAim.hpp" "${CMAKE_CURRENT_LIST_DIR}/AntiBackstab.hpp" "${CMAKE_CURRENT_LIST_DIR}/AntiCheat.hpp" "${CMAKE_CURRENT_LIST_DIR}/AntiDisguise.hpp" diff --git a/include/localplayer.hpp b/include/localplayer.hpp index fdbd7e1b..5eea4e46 100755 --- a/include/localplayer.hpp +++ b/include/localplayer.hpp @@ -8,6 +8,7 @@ #pragma once #include +#include class CachedEntity; diff --git a/include/settings/Bool.hpp b/include/settings/Bool.hpp index ef9f1fd5..70134dc9 100644 --- a/include/settings/Bool.hpp +++ b/include/settings/Bool.hpp @@ -36,31 +36,32 @@ public: setInternal(true); } - Variable& operator=(const std::string& string) + inline Variable& operator=(const std::string& string) { fromString(string); } - const std::string &toString() override + inline const std::string &toString() override { return string; } - explicit operator bool() const + inline explicit operator bool() const { return value; } - Variable& operator=(bool next) + + inline Variable& operator=(bool next) { setInternal(next); } - const bool &operator*() override + inline const bool &operator*() override { return value; } - void flip() + inline void flip() { setInternal(!value); } diff --git a/include/settings/Float.hpp b/include/settings/Float.hpp index 66564ff1..3629fad1 100644 --- a/include/settings/Float.hpp +++ b/include/settings/Float.hpp @@ -29,17 +29,17 @@ public: set(next); } - Variable& operator=(const std::string& string) + inline Variable& operator=(const std::string& string) { fromString(string); } - Variable& operator=(const float& next) + inline Variable& operator=(const float& next) { set(next); } - explicit operator bool() const + inline explicit operator bool() const { return value != 0.0f; } diff --git a/include/settings/Int.hpp b/include/settings/Int.hpp index 535bd035..97d4d0b2 100644 --- a/include/settings/Int.hpp +++ b/include/settings/Int.hpp @@ -29,17 +29,17 @@ public: set(result); } - Variable& operator=(const std::string& string) + inline Variable& operator=(const std::string& string) { fromString(string); } - Variable& operator=(const int& next) + inline Variable& operator=(const int& next) { set(next); } - explicit operator bool() const + inline explicit operator bool() const { return value != 0; } diff --git a/include/settings/Key.hpp b/include/settings/Key.hpp index 6bf7b89b..addaafef 100644 --- a/include/settings/Key.hpp +++ b/include/settings/Key.hpp @@ -82,22 +82,22 @@ public: setInternal(k); } - const Key &operator*() override + inline const Key &operator*() override { return value; } - const std::string &toString() override + inline const std::string &toString() override { return string; } - explicit operator bool() const + inline explicit operator bool() const { return value.mouse || value.scan; } - bool isKeyDown() const + inline bool isKeyDown() const { if (value.mouse) { diff --git a/include/settings/Rgba.hpp b/include/settings/Rgba.hpp index b449654b..87ff641a 100644 --- a/include/settings/Rgba.hpp +++ b/include/settings/Rgba.hpp @@ -50,21 +50,21 @@ public: setInternal(next); } - Variable& operator=(const glez::rgba& rgba) + inline Variable& operator=(const glez::rgba& rgba) { setInternal(rgba); } - Variable& operator=(const std::string& string) + inline Variable& operator=(const std::string& string) { fromString(string); } - const std::string &toString() override + inline const std::string &toString() override { return string; } - const glez::rgba &operator*() override + inline const glez::rgba &operator*() override { return value; } diff --git a/include/settings/Settings.hpp b/include/settings/Settings.hpp index a2132dfb..ed87bf3d 100644 --- a/include/settings/Settings.hpp +++ b/include/settings/Settings.hpp @@ -94,15 +94,15 @@ class ArithmeticVariable: public VariableBase public: ~ArithmeticVariable() override = default; - explicit operator T() const + explicit inline operator T() const { return value; } - const std::string &toString() override + const inline std::string &toString() override { return string; } - const T &operator*() override + const inline T &operator*() override { return value; } diff --git a/include/settings/String.hpp b/include/settings/String.hpp index 37d29522..dd778e0b 100644 --- a/include/settings/String.hpp +++ b/include/settings/String.hpp @@ -26,23 +26,23 @@ public: value = string; } - const std::string &toString() override + inline const std::string &toString() override { return value; } - Variable& operator=(const std::string& string) + inline Variable& operator=(const std::string& string) { fireCallbacks(std::string(string)); value = string; } - const std::string &operator*() override + inline const std::string &operator*() override { return value; } - explicit operator bool() const + inline explicit operator bool() const { return !value.empty(); } diff --git a/include/visual/EventLogging.hpp b/include/visual/EventLogging.hpp index 1f60f47b..3cb4f5ef 100644 --- a/include/visual/EventLogging.hpp +++ b/include/visual/EventLogging.hpp @@ -6,4 +6,5 @@ namespace event_logging { +bool isEnabled(); } \ No newline at end of file diff --git a/src/hack.cpp b/src/hack.cpp index 81d1e757..e2b0d16b 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -352,7 +352,7 @@ free(logname);*/ #endif #if not LAGBOT_MODE // FIXME [MP] - hacks::shared::killsay::Init(); + hacks::shared::killsay::init(); hacks::shared::announcer::init(); hacks::tf2::killstreak::init(); #endif @@ -435,7 +435,7 @@ void hack::Shutdown() ConVar_Unregister(); #if not LAGBOT_MODE logging::Info("Shutting down killsay..."); - hacks::shared::killsay::Shutdown(); + hacks::shared::killsay::shutdown(); hacks::shared::announcer::shutdown(); #endif logging::Info("Success.."); diff --git a/src/hacks/AntiAim.cpp b/src/hacks/AntiAim.cpp index 3816c68e..27fd56bd 100644 --- a/src/hacks/AntiAim.cpp +++ b/src/hacks/AntiAim.cpp @@ -619,7 +619,7 @@ void ProcessUserCmd(CUserCmd *cmd) FakeCrouch(cmd); } -bool antiaim::isEnabled() +bool isEnabled() { return *enable; } diff --git a/src/hacks/AntiAntiAim.cpp b/src/hacks/AntiAntiAim.cpp new file mode 100644 index 00000000..c282e5c0 --- /dev/null +++ b/src/hacks/AntiAntiAim.cpp @@ -0,0 +1,92 @@ +/* + Created on 29.07.18. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +static settings::Bool enable{ "anti-anti-aim.enable", "false" }; + +void hacks::shared::anti_anti_aim::createMove() +{ + if (!enable) + return; + if (CE_BAD(LOCAL_E)) + return; + + IClientEntity *entity{ nullptr }; + for (int i = 0; i < g_IEngine->GetMaxClients(); i++) + { + if (i == g_IEngine->GetLocalPlayer()) + continue; + entity = g_IEntityList->GetClientEntity(i); + if (entity && !entity->IsDormant() && !NET_BYTE(entity, netvar.iLifeState)) + { + float quotat = 0; + float quotaf = 0; + if (!g_Settings.brute.choke[i].empty()) + for (auto it : g_Settings.brute.choke[i]) + { + if (it) + quotat++; + else + quotaf++; + } + float quota = quotat / quotaf; + Vector &angles = NET_VECTOR(entity, netvar.m_angEyeAngles); + static bool brutepitch = false; + if (g_Settings.brute.brutenum[i] > 5) + { + g_Settings.brute.brutenum[i] = 0; + brutepitch = !brutepitch; + } + angles.y = fmod(angles.y + 180.0f, 360.0f); + if (angles.y < 0) + angles.y += 360.0f; + angles.y -= 180.0f; + if (quota < 0.8f) + switch (g_Settings.brute.brutenum[i]) + { + case 0: + break; + case 1: + angles.y += 180.0f; + break; + case 2: + angles.y -= 90.0f; + break; + case 3: + angles.y += 90.0f; + break; + case 4: + angles.y -= 180.0f; + break; + case 5: + angles.y = 0.0f; + break; + } + if (brutepitch || quota < 0.8f) + switch (g_Settings.brute.brutenum[i] % 4) + { + case 0: + break; + case 1: + angles.x = -89.0f; + break; + case 2: + angles.x = 89.0f; + break; + case 3: + angles.x = 0.0f; + break; + } + } + } +} + diff --git a/src/hacks/AutoHeal.cpp b/src/hacks/AutoHeal.cpp index c976605e..fd94ecf1 100644 --- a/src/hacks/AutoHeal.cpp +++ b/src/hacks/AutoHeal.cpp @@ -451,8 +451,8 @@ void CreateMove() current_user_cmd->buttons |= IN_ATTACK; /*if (m_iNewTarget || !(g_GlobalVars->tickcount % 300)) { if (silent) g_pLocalPlayer->bUseSilentAngles = true; - AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd); - g_pUserCmd->buttons |= IN_ATTACK; + AimAt(g_pLocalPlayer->v_Eye, out, current_user_cmd); + current_user_cmd->buttons |= IN_ATTACK; }*/ if (IsVaccinator() && CE_GOOD(target) && auto_vacc) { diff --git a/src/hacks/AutoJoin.cpp b/src/hacks/AutoJoin.cpp index 2e815202..b4a7f0db 100644 --- a/src/hacks/AutoJoin.cpp +++ b/src/hacks/AutoJoin.cpp @@ -133,4 +133,10 @@ void resetQueueTimer() queuetime.update(); } +void onShutdown() +{ + if (auto_queue) + tfmm::startQueue(); +} + } diff --git a/src/hacks/Backtrack.cpp b/src/hacks/Backtrack.cpp index 45c665e7..2a3cf342 100644 --- a/src/hacks/Backtrack.cpp +++ b/src/hacks/Backtrack.cpp @@ -158,7 +158,7 @@ void Run() BestTickData{ headPositions[iBestTarget][t].tickcount, t }; } std::sort(sorted_ticks, sorted_ticks + getTicks()); - int tickus = (*latency > 800 || *latency < 200) ? 12 : 24; + int tickus = getTicks2(); for (int t = 0; t < getTicks(); ++t) { bool good_tick = false; @@ -214,7 +214,7 @@ void Draw() return; if (!shouldDrawBt) return; - int tickus = (*latency > 800 || *latency < 200.0f) ? 12 : 24; + int tickus = getTicks2(); for (int i = 0; i < g_IEngine->GetMaxClients(); i++) { for (int j = 0; j < getTicks(); j++) @@ -304,4 +304,9 @@ int getTicks() { return max(min(*latency / 15, 65), 12); } + +int getTicks2() +{ + return (*latency > 800 || *latency < 200) ? 12 : 24; +} } diff --git a/src/hacks/CMakeLists.txt b/src/hacks/CMakeLists.txt index ea0f57f0..6ea8f41e 100644 --- a/src/hacks/CMakeLists.txt +++ b/src/hacks/CMakeLists.txt @@ -9,6 +9,7 @@ if(NOT LagbotMode) "${CMAKE_CURRENT_LIST_DIR}/Aimbot.cpp" "${CMAKE_CURRENT_LIST_DIR}/Announcer.cpp" "${CMAKE_CURRENT_LIST_DIR}/AntiAim.cpp" + "${CMAKE_CURRENT_LIST_DIR}/AntiAntiAim.cpp" "${CMAKE_CURRENT_LIST_DIR}/AntiBackstab.cpp" "${CMAKE_CURRENT_LIST_DIR}/AntiCheat.cpp" "${CMAKE_CURRENT_LIST_DIR}/AntiDisguise.cpp" diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 456661be..20a89af1 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -76,6 +76,8 @@ static settings::Bool online_support{ "esp.online.enable", "true" }; static settings::Bool online_groups{ "esp.online.groups", "true" }; static settings::Bool online_software{ "esp.online.software", "true" }; +static settings::Bool v9mode{ "esp.v952-mode", "false" }; + namespace hacks::shared::esp { @@ -232,7 +234,7 @@ std::unordered_map bonelist_map{}; // Function called on draw void Draw() { - if (!enabled) + if (!enable) return; std::lock_guard esp_lock(threadsafe_mutex); for (auto &i : entities_need_repaint) @@ -249,7 +251,7 @@ void CreateMove() { // Check usersettings if enabled - if (!enabled) + if (!enable) return; // Something @@ -341,14 +343,14 @@ void _FASTCALL emoji(CachedEntity *ent) if (draw::WorldToScreen(hit->center, head_scr)) { float size = emoji_esp_scaling ? fabs(hbm.y - hbx.y) - : float(emoji_esp_size); + : *emoji_esp_size; if (v9mode) size *= 1.4; - if (!size || !float(emoji_min_size)) + if (!size || !emoji_min_size) return; - if (emoji_esp_scaling && (size < float(emoji_min_size))) - size = float(emoji_min_size); - player_info_s info; + if (emoji_esp_scaling && (size < *emoji_min_size)) + size = *emoji_min_size; + player_info_s info{}; unsigned int steamID; unsigned int steamidarray[32]{}; bool hascall = false; @@ -797,11 +799,11 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) // Used to process entities from CreateMove void _FASTCALL ProcessEntity(CachedEntity *ent) { - if (!enabled) + if (!enable) return; // Esp enable check if (CE_BAD(ent)) return; // CE_BAD check to prevent crashes - if (max_dist && ent->m_flDistance() > (float) max_dist) + if (max_dist && ent->m_flDistance() > *max_dist) return; int classid = ent->m_iClassID(); // Entity esp @@ -1410,7 +1412,7 @@ void BoxCorners(int minx, int miny, int maxx, int maxy, const rgba_t &color, { const rgba_t &black = transparent ? colors::Transparent(colors::black) : colors::black; - const int size = box_corner_size; + const int size = *box_corner_size; // Black corners // Top Left @@ -1470,7 +1472,7 @@ bool GetCollide(CachedEntity *ent) // If user setting for box expnad is true, spread the max and mins if (esp_expand) { - const float &exp = (float) esp_expand; + const float exp = *esp_expand; maxs.x += exp; maxs.y += exp; maxs.z += exp; diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 5153dc7c..a9c31134 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -424,7 +424,7 @@ void WorldTick() DistanceToGround({ breadcrumbs[0].x, breadcrumbs[0].y, breadcrumbs[0].z + 5 }) > 47)) { - g_pUserCmd->buttons |= IN_JUMP; + current_user_cmd->buttons |= IN_JUMP; lastJump.update(); } // Check if still moving. 70 HU = Sniper Zoomed Speed @@ -511,7 +511,7 @@ void WorldTick() void DrawTick() { #if ENABLE_VISUALS - if (!followbot || !draw_crumb) + if (!enable || !draw_crumb) return; if (breadcrumbs.size() < 2) return; diff --git a/src/hacks/Radar.cpp b/src/hacks/Radar.cpp index ae53ef26..856ce866 100644 --- a/src/hacks/Radar.cpp +++ b/src/hacks/Radar.cpp @@ -17,7 +17,7 @@ static settings::Bool radar_enabled{ "radar.enable", "false" }; static settings::Int size{ "radar.size", "300" }; static settings::Float zoom{ "radar.zoom", "20" }; static settings::Bool healthbar{ "radar.healthbar", "true" }; -static settings::Bool enemis_over_teammates{ "radar.enemies-over-teammates", "true" }; +static settings::Bool enemies_over_teammates{ "radar.enemies-over-teammates", "true" }; static settings::Int icon_size{ "radar.icon-size", "20" }; static settings::Int radar_x{ "radar.x", "100" }; static settings::Int radar_y{ "radar.y", "100" }; @@ -146,7 +146,7 @@ void DrawEntity(int x, int y, CachedEntity *ent) (int) icon_size, 4, colors::black, 0.5f); glez::draw::rect(x + wtr.first + 1, y + wtr.second + (int) icon_size + 1, - ((float) icon_size - 2.0f) * healthp, 2, clr); + (*icon_size - 2.0f) * healthp, 2, clr); } } else if (ent->m_Type() == ENTITY_BUILDING) @@ -179,8 +179,8 @@ void DrawEntity(int x, int y, CachedEntity *ent) { const auto &wtr = WorldToRadar(ent->m_vecOrigin().x, ent->m_vecOrigin().y); - float sz = float(icon_size) * 0.15f * 0.5f; - float sz2 = float(icon_size) * 0.85; + float sz = *icon_size * 0.15f * 0.5f; + float sz2 = *icon_size * 0.85; tx_items[0].draw(x + wtr.first + sz, y + wtr.second + sz, sz2, sz2, colors::white); } @@ -190,8 +190,8 @@ void DrawEntity(int x, int y, CachedEntity *ent) { const auto &wtr = WorldToRadar(ent->m_vecOrigin().x, ent->m_vecOrigin().y); - float sz = float(icon_size) * 0.15f * 0.5f; - float sz2 = float(icon_size) * 0.85; + float sz = *icon_size * 0.15f * 0.5f; + float sz2 = *icon_size * 0.85; tx_items[1].draw(x + wtr.first + sz, y + wtr.second + sz, sz2, sz2, colors::white); } @@ -214,7 +214,7 @@ void Draw() x = (int) radar_x; y = (int) radar_y; - int radar_size = size; + int radar_size = *size; int half_size = radar_size / 2; outlineclr = GUIColor(); diff --git a/src/hacks/SkinChanger.cpp b/src/hacks/SkinChanger.cpp index 08930729..1334b68e 100644 --- a/src/hacks/SkinChanger.cpp +++ b/src/hacks/SkinChanger.cpp @@ -195,7 +195,7 @@ void FrameStageNotify(int stage) if (stage != FRAME_NET_UPDATE_POSTDATAUPDATE_START) return; - if (!enabled) + if (!enable) return; if (CE_BAD(LOCAL_E)) return; @@ -253,9 +253,9 @@ void DrawText() { CAttributeList *list; - if (!enabled) + if (!enable) return; - if (!show_debug_info) + if (!debug) return; if (CE_GOOD(LOCAL_W)) { @@ -417,7 +417,7 @@ void patched_weapon_cookie::Update(int entity) ent = g_IEntityList->GetClientEntity(entity); if (!ent || ent->IsDormant()) return; - if (show_debug_info) + if (debug) logging::Info("Updating cookie for %i", entity); // FIXME DEBUG LOGS! list = (CAttributeList *) ((uintptr_t) ent + netvar.AttributeList); attrs = list->m_Attributes.Size(); @@ -482,7 +482,7 @@ void def_attribute_modifier::Apply(int entity) NET_INT(ent, netvar.iItemDefinitionIndex) != defidx_redirect) { NET_INT(ent, netvar.iItemDefinitionIndex) = defidx_redirect; - if (show_debug_info) + if (debug) logging::Info("Redirect -> %i", NET_INT(ent, netvar.iItemDefinitionIndex)); GetModifier(defidx_redirect).Apply(entity); diff --git a/src/hacks/Trigger.cpp b/src/hacks/Trigger.cpp index a13a4b9d..eb0a5052 100644 --- a/src/hacks/Trigger.cpp +++ b/src/hacks/Trigger.cpp @@ -43,7 +43,7 @@ bool CanBacktrack() { int target = hacks::shared::backtrack::iBestTarget; int tickcnt = 0; - int tickus = (float(hacks::shared::backtrack::latency) > 800.0f || float(hacks::shared::backtrack::latency) < 200.0f) ? 12 : 24; + int tickus = hacks::shared::backtrack::getTicks2(); for (auto i : hacks::shared::backtrack::headPositions[target]) { bool good_tick = false; @@ -90,8 +90,8 @@ bool CanBacktrack() Vector &angles = NET_VECTOR(RAW_ENT(tar), netvar.m_angEyeAngles); float &simtime = NET_FLOAT(RAW_ENT(tar), netvar.m_flSimulationTime); angles.y = i.viewangles; - g_pUserCmd->tick_count = i.tickcount; - g_pUserCmd->buttons |= IN_ATTACK; + current_user_cmd->tick_count = i.tickcount; + current_user_cmd->buttons |= IN_ATTACK; return false; } } @@ -119,7 +119,7 @@ void CreateMove() CachedEntity *ent = FindEntInSight(EffectiveTargetingRange()); // Check if can backtrack, shoot if we can - if (!CanBacktrack() || hacks::shared::backtrack::enable) + if (!CanBacktrack() || hacks::shared::backtrack::isBacktrackEnabled()) return; // Check if dormant or null to prevent crashes @@ -144,16 +144,15 @@ void CreateMove() { if (g_GlobalVars->curtime - float(delay) >= target_time) { - g_pUserCmd->buttons |= IN_ATTACK; + current_user_cmd->buttons |= IN_ATTACK; } } } else { - g_pUserCmd->buttons |= IN_ATTACK; + current_user_cmd->buttons |= IN_ATTACK; } } - return; } // The first check to see if the player should shoot in the first place @@ -161,7 +160,7 @@ bool ShouldShoot() { // Check for +use - if (g_pUserCmd->buttons & IN_USE) + if (current_user_cmd->buttons & IN_USE) return false; // Check if using action slot item @@ -183,7 +182,7 @@ bool ShouldShoot() // If zoomed only is on, check if zoomed if (zoomed_only && g_pLocalPlayer->holding_sniper_rifle) { - if (!g_pLocalPlayer->bZoomed && !(g_pUserCmd->buttons & IN_ATTACK)) + if (!g_pLocalPlayer->bZoomed && !(current_user_cmd->buttons & IN_ATTACK)) return false; } // Check if player is taunting @@ -223,7 +222,7 @@ bool ShouldShoot() // Check if player is zooming if (g_pLocalPlayer->bZoomed) { - if (!(g_pUserCmd->buttons & (IN_ATTACK | IN_ATTACK2))) + if (!(current_user_cmd->buttons & (IN_ATTACK | IN_ATTACK2))) { if (!CanHeadshot()) return false; @@ -554,8 +553,7 @@ bool UpdateAimkey() if (trigger_key && trigger_key_mode) { // Grab whether the aimkey is depressed - bool key_down = - g_IInputSystem->IsButtonDown((ButtonCode_t)(int) trigger_key); + bool key_down = trigger_key.isKeyDown(); // Switch based on the user set aimkey mode switch ((int) trigger_key_mode) { @@ -599,7 +597,7 @@ float EffectiveTargetingRange() return 200.0f; // If user has set a max range, then use their setting, if (max_range) - return (float) max_range; + return *max_range; // else use a pre-set range else return 8012.0f; diff --git a/src/hacks/UberSpam.cpp b/src/hacks/UberSpam.cpp index eb36532f..7c963403 100755 --- a/src/hacks/UberSpam.cpp +++ b/src/hacks/UberSpam.cpp @@ -25,7 +25,7 @@ TextFile custom_lines; static CatCommand custom_file_reload( "uberspam_file_reload", "Reload Ubercharge Spam File", - []() { custom_lines.Load(std::string(custom_file.GetString())); }); + []() { custom_lines.Load(*custom_file); }); const std::vector *GetSource() { diff --git a/src/hacks/Walkbot.cpp b/src/hacks/Walkbot.cpp index 8a4c764e..a650302d 100644 --- a/src/hacks/Walkbot.cpp +++ b/src/hacks/Walkbot.cpp @@ -24,10 +24,10 @@ static settings::Bool draw_indices{ "walkbot.draw.indices", "false" }; static settings::Bool draw_connection_flags{ "walkbot.draw.connection-flags", "true" }; static settings::Bool free_move{ "walkbot.free-move", "true" }; -static settings::Bool spawn_distance{ "walkbot.edit.node-spawn-distance", "54" }; -static settings::Bool max_distance{ "walkbot.node-max-distance", "100" }; -static settings::Bool reach_distance{ "walkbot.node-reach-distance", "32" }; -static settings::Bool force_slot{ "walkbot.force-slot", "0" }; +static settings::Int spawn_distance{ "walkbot.edit.node-spawn-distance", "54" }; +static settings::Int max_distance{ "walkbot.node-max-distance", "100" }; +static settings::Int reach_distance{ "walkbot.node-reach-distance", "32" }; +static settings::Int force_slot{ "walkbot.force-slot", "0" }; static settings::Bool leave_if_empty{ "walkbot.leave-if-empty", "false" }; namespace hacks::shared::walkbot @@ -212,7 +212,7 @@ walkbot_node_s *closest() // Global state EWalkbotState state{ WB_DISABLED }; -// g_pUserCmd->buttons state when last node was recorded +// current_user_cmd->buttons state when last node was recorded int last_node_buttons{ 0 }; // Set to true when bot is moving to nearest node after dying/losing its active @@ -516,7 +516,7 @@ CatCommand c_delete_node("wb_delete", "Delete node", CatCommand c_create_node("wb_create", "Create node", []() { index_t node = CreateNode(g_pLocalPlayer->v_Origin); auto &n = state::nodes[node]; - if (g_pUserCmd->buttons & IN_DUCK) + if (current_user_cmd->buttons & IN_DUCK) n.flags |= NF_DUCK; if (state::node_good(state::closest_node)) { @@ -883,14 +883,14 @@ index_t SelectNextNode() // Release Sticky if > chargetime if ((chargetime >= 0.1f) && begansticky > 3) { - g_pUserCmd->buttons &= ~IN_ATTACK; + current_user_cmd->buttons &= ~IN_ATTACK; hacks::shared::antiaim::SetSafeSpace(3); begansticky = 0; } // Else just keep charging else { - g_pUserCmd->buttons |= IN_ATTACK; + current_user_cmd->buttons |= IN_ATTACK; begansticky++; } } @@ -924,9 +924,9 @@ void UpdateSlot() if (re::C_BaseCombatWeapon::IsBaseCombatWeapon(weapon)) { int slot = re::C_BaseCombatWeapon::GetSlot(weapon); - if (slot != int(force_slot) - 1) + if (slot != *force_slot - 1) { - hack::ExecuteCommand(format("slot", int(force_slot))); + hack::ExecuteCommand(format("slot", *force_slot)); } } } @@ -936,7 +936,7 @@ void UpdateWalker() free_move_used = false; if (free_move) { - if (g_pUserCmd->forwardmove != 0.0f or g_pUserCmd->sidemove != 0.0f) + if (current_user_cmd->forwardmove != 0.0f or current_user_cmd->sidemove != 0.0f) { free_move_used = true; return; @@ -946,7 +946,7 @@ void UpdateWalker() static int jump_ticks = 0; if (jump_ticks > 0) { - g_pUserCmd->buttons |= IN_JUMP; + current_user_cmd->buttons |= IN_JUMP; jump_ticks--; } bool timeout = std::chrono::duration_cast( @@ -963,15 +963,15 @@ void UpdateWalker() { auto &l = state::nodes[state::last_node]; if (l.flags & NF_DUCK) - g_pUserCmd->buttons |= IN_DUCK; + current_user_cmd->buttons |= IN_DUCK; } float dist = distance_2d(n.xyz()); - if (dist > float(max_distance)) + if (dist > *max_distance) { state::active_node = FindNearestNode(true); state::recovery = true; } - if (dist < float(reach_distance)) + if (dist < *reach_distance) { state::recovery = false; index_t last = state::active_node; @@ -982,8 +982,8 @@ void UpdateWalker() { if (state::nodes[state::active_node].flags & NF_JUMP) { - g_pUserCmd->buttons |= IN_DUCK; - g_pUserCmd->buttons |= IN_JUMP; + current_user_cmd->buttons |= IN_DUCK; + current_user_cmd->buttons |= IN_JUMP; jump_ticks = 6; } } @@ -1003,17 +1003,17 @@ bool ShouldSpawnNode() return true; bool was_jumping = state::last_node_buttons & IN_JUMP; - bool is_jumping = g_pUserCmd->buttons & IN_JUMP; + bool is_jumping = current_user_cmd->buttons & IN_JUMP; if (was_jumping != is_jumping and is_jumping) return true; - if ((state::last_node_buttons & IN_DUCK) != (g_pUserCmd->buttons & IN_DUCK)) + if ((state::last_node_buttons & IN_DUCK) != (current_user_cmd->buttons & IN_DUCK)) return true; auto &node = state::nodes[state::active_node]; - if (distance_2d(node.xyz()) > float(spawn_distance)) + if (distance_2d(node.xyz()) > *spawn_distance) { return true; } @@ -1025,9 +1025,9 @@ void RecordNode() { index_t node = CreateNode(g_pLocalPlayer->v_Origin); auto &n = state::nodes[node]; - if (g_pUserCmd->buttons & IN_DUCK) + if (current_user_cmd->buttons & IN_DUCK) n.flags |= NF_DUCK; - if (g_pUserCmd->buttons & IN_JUMP) + if (current_user_cmd->buttons & IN_JUMP) n.flags |= NF_JUMP; if (state::node_good(state::active_node)) { @@ -1037,7 +1037,7 @@ void RecordNode() logging::Info("[wb] Node %u auto-linked to node %u at (%.2f %.2f %.2f)", node, state::active_node, c.x, c.y, c.z); } - state::last_node_buttons = g_pUserCmd->buttons; + state::last_node_buttons = current_user_cmd->buttons; state::active_node = node; } @@ -1222,7 +1222,7 @@ void Move() case WB_RECORDING: { UpdateClosestNode(); - if (active_recording and ShouldSpawnNode()) + if (recording_key.isKeyDown() and ShouldSpawnNode()) { RecordNode(); } @@ -1253,7 +1253,7 @@ void Move() } } } - prevlvlname = g_IEngine->GetLevelName(); + /*prevlvlname = g_IEngine->GetLevelName(); std::string prvlvlname(prevlvlname); if (boost::contains(prvlvlname, "pl_") || boost::contains(prvlvlname, "cp_")) @@ -1274,7 +1274,7 @@ void Move() hacks::shared::followbot::roambot = 0; hacks::shared::followbot::followcart = false; } - } + }*/ if (nodes.size() == 0) return; if (force_slot) diff --git a/src/hacks/ac/aimbot.cpp b/src/hacks/ac/aimbot.cpp index ee633329..265c5dd9 100644 --- a/src/hacks/ac/aimbot.cpp +++ b/src/hacks/ac/aimbot.cpp @@ -37,7 +37,7 @@ void Init() void Update(CachedEntity *player) { - if (not enabled) + if (!enable) return; auto &data = data_table[player->m_IDX - 1]; auto &am = amount[player->m_IDX - 1]; @@ -97,7 +97,7 @@ void Update(CachedEntity *player) void Event(KeyValues *event) { - if (not enabled) + if (!enable) return; if (!strcmp(event->GetName(), "player_death") || !strcmp(event->GetName(), "player_hurt")) diff --git a/src/hacks/ac/antiaim.cpp b/src/hacks/ac/antiaim.cpp index bedbc173..4872e330 100644 --- a/src/hacks/ac/antiaim.cpp +++ b/src/hacks/ac/antiaim.cpp @@ -33,7 +33,7 @@ void Init() void Update(CachedEntity *player) { - if (!enabled) + if (!enable) return; int amount[32]; auto &am = amount[player->m_IDX - 1]; diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 6ec84a01..aa2a18fc 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -10,9 +10,19 @@ #include "MiscTemporary.hpp" #include #include +#include +#include #include "HookedMethods.hpp" +static settings::Bool minigun_jump{ "misc.minigun-jump-tf2c", "false" }; +static settings::Bool nolerp{ "misc.no-lerp", "false" }; +static settings::Button roll_speedhack{ "misc.roll-speedhack", "false" }; +static settings::Bool engine_pred{ "misc.engine-prediction", "false" }; +static settings::Bool debug_projectiles{ "debug.projectiles", "false" }; +static settings::Int semiauto{ "misc.semi-auto", "0" }; +static settings::Int fakelag_amount{ "misc.fakelag", "0" }; + class CMoveData; #if LAGBOT_MODE CatCommand set_value("set", "Set value", [](const CCommand &args) { @@ -66,7 +76,7 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd) g_GlobalVars->frametime = g_GlobalVars->interval_per_tick; *g_PredictionRandomSeed = - MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF; + MD5_PseudoRandom(current_user_cmd->command_number) & 0x7FFFFFFF; g_IGameMovement->StartTrackPredictionErrors( reinterpret_cast(ent)); oSetupMove(g_IPrediction, ent, ucmd, NULL, pMoveData); @@ -91,6 +101,9 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd) #endif const char *cmds[7] = { "use", "voicecommand", "spec_next", "spec_prev", "spec_player", "invprev", "invnext" }; + +static int attackticks = 0; + namespace hooked_methods { @@ -116,8 +129,8 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, firstcm = false; } tickcount++; - g_pUserCmd = cmd; -#if not LAGBOT_MODE + current_user_cmd = cmd; +#if !LAGBOT_MODE IF_GAME(IsTF2C()) { if (CE_GOOD(LOCAL_W) && minigun_jump && @@ -137,7 +150,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, return ret; } - if (!cathook) + if (!isHackActive()) { g_Settings.is_create_move = false; return ret; @@ -152,12 +165,12 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, // PROF_BEGIN(); - if (g_pUserCmd && g_pUserCmd->command_number) - last_cmd_number = g_pUserCmd->command_number; + if (current_user_cmd && current_user_cmd->command_number) + last_cmd_number = current_user_cmd->command_number; /**bSendPackets = true; if (hacks::shared::lagexploit::ExploitActive()) { - *bSendPackets = ((g_pUserCmd->command_number % 4) == 0); + *bSendPackets = ((current_user_cmd->command_number % 4) == 0); //logging::Info("%d", *bSendPackets); }*/ @@ -167,82 +180,9 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, time_replaced = false; curtime_old = g_GlobalVars->curtime; - hacks::tf2::global::runcfg(); - static IClientEntity *enti; - if (resolver && cathook && CE_GOOD(LOCAL_E)) - { - for (int i = 0; i < g_IEngine->GetMaxClients(); i++) - { - if (i == g_IEngine->GetLocalPlayer()) - continue; - enti = g_IEntityList->GetClientEntity(i); - if (enti && !enti->IsDormant() && - !NET_BYTE(enti, netvar.iLifeState)) - { - float quotat = 0; - float quotaf = 0; - if (!g_Settings.brute.choke[i].empty()) - for (auto it : g_Settings.brute.choke[i]) - { - if (it) - quotat++; - else - quotaf++; - } - float quota = quotat / quotaf; - Vector &angles = NET_VECTOR(enti, netvar.m_angEyeAngles); - static bool brutepitch = false; - if (g_Settings.brute.brutenum[i] > 5) - { - g_Settings.brute.brutenum[i] = 0; - brutepitch = !brutepitch; - } - angles.y = fmod(angles.y + 180.0f, 360.0f); - if (angles.y < 0) - angles.y += 360.0f; - angles.y -= 180.0f; - if (quota < 0.8f) - switch (g_Settings.brute.brutenum[i]) - { - case 0: - break; - case 1: - angles.y += 180.0f; - break; - case 2: - angles.y -= 90.0f; - break; - case 3: - angles.y += 90.0f; - break; - case 4: - angles.y -= 180.0f; - break; - case 5: - angles.y = 0.0f; - break; - } - if (brutepitch || quota < 0.8f) - switch (g_Settings.brute.brutenum[i] % 4) - { - case 0: - break; - case 1: - angles.x = -89.0f; - break; - case 2: - angles.x = 89.0f; - break; - case 3: - angles.x = 0.0f; - break; - } - } - } - } if (nolerp) { - // g_pUserCmd->tick_count += 1; + // current_user_cmd->tick_count += 1; if (sv_client_min_interp_ratio->GetInt() != -1) { // sv_client_min_interp_ratio->m_nFlags = 0; @@ -289,82 +229,24 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, } g_Settings.bInvalid = false; - hacks::shared::autojoin::Update(); + hacks::shared::autojoin::update(); + + { + PROF_SECTION(CM_AAA); + hacks::shared::anti_anti_aim::createMove(); + } #if ENABLE_IPC -#if not LAGBOT_MODE - static int team_joining_state = 0; - static float last_jointeam_try = 0; - CachedEntity *found_entity, *ent; - - if (hacks::shared::followbot::followbot) +#if !LAGBOT_MODE + if (hacks::shared::followbot::isEnabled()) { hacks::shared::followbot::WorldTick(); - if (g_GlobalVars->curtime < last_jointeam_try) - { - team_joining_state = 0; - last_jointeam_try = 0.0f; - } - - if (!g_pLocalPlayer->team || (g_pLocalPlayer->team == TEAM_SPEC)) - { - // if (!team_joining_state) logging::Info("Bad team, trying to - // join..."); - team_joining_state = 1; - } - else - { - if (team_joining_state) - { - logging::Info("Trying to change CLASS"); - g_IEngine->ExecuteClientCmd( - format("join_class ", joinclass.GetString()).c_str()); - } - team_joining_state = 0; - } - - if (team_joining_state) - { - found_entity = nullptr; - for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) - { - ent = ENTITY(i); - if (CE_BAD(ent)) - continue; - if (ent->player_info.friendsID == - hacks::shared::followbot::steamid) - { - found_entity = ent; - break; - } - } - - if (found_entity && CE_GOOD(found_entity)) - { - if (jointeam && - (g_GlobalVars->curtime - last_jointeam_try) > 1.0f) - { - last_jointeam_try = g_GlobalVars->curtime; - switch (CE_INT(found_entity, netvar.iTeamNum)) - { - case TEAM_RED: - logging::Info("Trying to join team RED"); - g_IEngine->ExecuteClientCmd("jointeam red"); - break; - case TEAM_BLU: - logging::Info("Trying to join team BLUE"); - g_IEngine->ExecuteClientCmd("jointeam blue"); - break; - } - } - } - } } #endif #endif if (CE_GOOD(g_pLocalPlayer->entity)) { -#if not LAGBOT_MODE +#if !LAGBOT_MODE IF_GAME(IsTF2()) { UpdateHoovyList(); @@ -383,7 +265,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, #endif if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) { -#if not LAGBOT_MODE +#if !LAGBOT_MODE { PROF_SECTION(CM_walkbot); hacks::shared::walkbot::Move(); @@ -414,7 +296,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, } if (engine_pred) engine_prediction::RunEnginePrediction(RAW_ENT(LOCAL_E), - g_pUserCmd); + current_user_cmd); { PROF_SECTION(CM_backtracc); hacks::shared::backtrack::Run(); @@ -423,22 +305,21 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, PROF_SECTION(CM_aimbot); hacks::shared::aimbot::CreateMove(); } - static int attackticks = 0; - if (g_pUserCmd->buttons & IN_ATTACK) + if (current_user_cmd->buttons & IN_ATTACK) ++attackticks; else attackticks = 0; if (semiauto) - if (g_pUserCmd->buttons & IN_ATTACK) - if (attackticks % int(semiauto) < int(semiauto) - 1) - g_pUserCmd->buttons &= ~IN_ATTACK; + if (current_user_cmd->buttons & IN_ATTACK) + if (attackticks % *semiauto < *semiauto - 1) + current_user_cmd->buttons &= ~IN_ATTACK; static int fakelag_queue = 0; if (CE_GOOD(LOCAL_E)) if (fakelag_amount) { - *bSendPackets = int(fakelag_amount) == fakelag_queue; + *bSendPackets = *fakelag_amount == fakelag_queue; fakelag_queue++; - if (fakelag_queue > int(fakelag_amount)) + if (fakelag_queue > *fakelag_amount) fakelag_queue = 0; } { @@ -489,7 +370,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, Prediction_CreateMove(); #endif } -#if not LAGBOT_MODE +#if !LAGBOT_MODE { PROF_SECTION(CM_misc); hacks::shared::misc::CreateMove(); @@ -501,9 +382,9 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, #endif { PROF_SECTION(CM_spam); - hacks::shared::spam::CreateMove(); + hacks::shared::spam::createMove(); } -#if not LAGBOT_MODE +#if !LAGBOT_MODE { PROF_SECTION(CM_AC); hacks::shared::anticheat::CreateMove(); @@ -513,19 +394,11 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, if (time_replaced) g_GlobalVars->curtime = curtime_old; g_Settings.bInvalid = false; -#if not LAGBOT_MODE +#if !LAGBOT_MODE { PROF_SECTION(CM_chat_stack); chat_stack::OnCreateMove(); } - { - PROF_SECTION(CM_healarrow); - hacks::tf2::healarrow::CreateMove(); - } - { - PROF_SECTION(CM_lagexploit); - hacks::shared::lagexploit::CreateMove(); - } #endif // TODO Auto Steam Friend @@ -541,14 +414,12 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, } } #endif -#if not LAGBOT_MODE +#if !LAGBOT_MODE hacks::shared::backtrack::UpdateIncomingSequences(); if (CE_GOOD(g_pLocalPlayer->entity)) { speedapplied = false; - if (roll_speedhack && - g_IInputSystem->IsButtonDown( - (ButtonCode_t)((int) roll_speedhack)) && + if (roll_speedhack.isKeyDown() && !(cmd->buttons & IN_ATTACK)) { speed = cmd->forwardmove; @@ -587,8 +458,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, } if (cmd && (cmd->buttons & IN_ATTACK || - !(hacks::shared::antiaim::enabled && - float(hacks::shared::antiaim::yaw_mode) >= 9 && !*bSendPackets))) + !(hacks::shared::antiaim::isEnabled() && !*bSendPackets))) g_Settings.brute.last_angles[LOCAL_E->m_IDX] = cmd->viewangles; for (int i = 0; i < g_IEngine->GetMaxClients(); i++) { @@ -614,88 +484,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, } } #endif - int nextdata = 0; - NET_StringCmd senddata(cmds[nextdata]); - INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo(); - senddata.SetNetChannel(ch); - senddata.SetReliable(false); - if (servercrash && DelayTimer.check((int) delay * 1000)) - { - for (int i = 0; i < 7800; i += sizeof(cmds[nextdata])) - { - senddata.m_szCommand = cmds[nextdata]; - ch->SendNetMsg(senddata); - if (nextdata == 6) - nextdata = 0; - else - nextdata++; - } - ch->Transmit(); - } - if (serverlag_amount || (votelogger::active && - !votelogger::antikick.check(antikick_time * 1000))) - { - if (adjust && !votelogger::active) - { - if ((int) serverlag_amount == 1) - serverlag_amount = (int) serverlag_amount + 10; - if (ch->GetAvgData(FLOW_INCOMING) == prevflow) - { - if (prevflowticks > 66 * (int) adjust) - serverlag_amount = (int) serverlag_amount - 1; - prevflowticks++; - } - if (ch->GetAvgData(FLOW_INCOMING) != prevflow) - { - if (prevflowticks < 66 * (int) adjust) - serverlag_amount = (int) serverlag_amount + 4; - prevflowticks = 0; - } - } - if (votelogger::active && - !votelogger::antikick.check(antikick_time * 1000)) - { - static int additionallag = 1; - if (ch->GetAvgData(FLOW_INCOMING) == prevflow) - { - prevflowticks++; - } - else - prevflowticks = 0; - if (prevflowticks <= 10) - additionallag *= 0.1f; - for (int i = 0; i < 7800 + additionallag; - i += sizeof(cmds[nextdata])) - { - senddata.m_szCommand = cmds[nextdata]; - ch->SendNetMsg(senddata, false); - if (nextdata == 6) - nextdata = 0; - else - nextdata++; - } - ch->Transmit(); - } - else if (!votelogger::active && serverlag_amount && - DelayTimer.check((int) delay * 1000)) - { - for (int i = 0; i < (int) serverlag_amount; i++) - { - senddata.m_szCommand = cmds[nextdata]; - if (nextdata == 6) - nextdata = 0; - else - nextdata++; - ch->SendNetMsg(senddata, false); - } - ch->Transmit(); - } - prevflow = ch->GetAvgData(FLOW_INCOMING); - } - else if (votelogger::active && - votelogger::antikick.test_and_set(antikick_time * 1000)) - votelogger::active = false; // PROF_END("CreateMove"); if (!(cmd->buttons & IN_ATTACK)) { @@ -716,9 +505,9 @@ void Start() { IClientEntity* player = RAW_ENT(LOCAL_E); // CPredictableId::ResetInstanceCounters(); *(reinterpret_cast(reinterpret_cast(player) + 1047)) = -g_pUserCmd; o_curtime = g_GlobalVars->curtime; o_frametime = +current_user_cmd; o_curtime = g_GlobalVars->curtime; o_frametime = g_GlobalVars->frametime; *g_PredictionRandomSeed = -MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF; g_GlobalVars->curtime +MD5_PseudoRandom(current_user_cmd->command_number) & 0x7FFFFFFF; g_GlobalVars->curtime = CE_INT(LOCAL_E, netvar.nTickBase) * g_GlobalVars->interval_per_tick; g_GlobalVars->frametime = g_GlobalVars->interval_per_tick; diff --git a/src/hooks/FireGameEvent.cpp b/src/hooks/FireGameEvent.cpp index ffc5a916..45f53a6d 100644 --- a/src/hooks/FireGameEvent.cpp +++ b/src/hooks/FireGameEvent.cpp @@ -3,6 +3,7 @@ Copyright (c) 2018 nullworks. All rights reserved. */ +#include #include "HookedMethods.hpp" namespace hooked_methods @@ -13,7 +14,8 @@ DEFINE_HOOKED_METHOD(FireGameEvent, void, void *this_, IGameEvent *event) const char *name = event->GetName(); if (name) { - if (event_log) +#if ENABLE_VISUALS + if (event_logging::isEnabled()) { if (!strcmp(name, "player_connect_client") || !strcmp(name, "player_disconnect") || @@ -23,6 +25,7 @@ DEFINE_HOOKED_METHOD(FireGameEvent, void, void *this_, IGameEvent *event) } } // hacks::tf2::killstreak::fire_event(event); +#endif } original::FireGameEvent(this_, event); } diff --git a/src/hooks/GetFriendPersonaName.cpp b/src/hooks/GetFriendPersonaName.cpp index bd687ba2..97ee81a3 100644 --- a/src/hooks/GetFriendPersonaName.cpp +++ b/src/hooks/GetFriendPersonaName.cpp @@ -7,6 +7,7 @@ #include "HookedMethods.hpp" static settings::String ipc_name{ "name.ipc", "" }; +static settings::String force_name{ "name.custom", "" }; static settings::Int namesteal{ "name.namesteal", "0" }; static std::string stolen_name; @@ -106,11 +107,11 @@ DEFINE_HOOKED_METHOD(GetFriendPersonaName, const char *, ISteamFriends *this_, #if ENABLE_IPC if (ipc::peer) { - static std::string namestr(ipc_name.GetString()); - namestr.assign(ipc_name.GetString()); + std::string namestr(*ipc_name); if (namestr.length() > 3) { ReplaceString(namestr, "%%", std::to_string(ipc::peer->client_id)); + ReplaceString(namestr, "\\n", "\n"); return namestr.c_str(); } } @@ -136,11 +137,10 @@ DEFINE_HOOKED_METHOD(GetFriendPersonaName, const char *, ISteamFriends *this_, } } - if ((strlen(force_name.GetString()) > 1) && + if ((*force_name).size() > 1 && steam_id == g_ISteamUser->GetSteamID()) { - - return force_name_newlined; + return force_name.toString().c_str(); } return original::GetFriendPersonaName(this_, steam_id); } diff --git a/src/hooks/LevelInit.cpp b/src/hooks/LevelInit.cpp index 1ff9abb6..0d7b9510 100644 --- a/src/hooks/LevelInit.cpp +++ b/src/hooks/LevelInit.cpp @@ -7,7 +7,7 @@ #include #include "HookedMethods.hpp" #include "MiscTemporary.hpp" -#if not LAGBOT_MODE +#if !LAGBOT_MODE #include "hacks/Backtrack.hpp" #endif @@ -45,55 +45,21 @@ const char *skynum[] = { "sky_tf2_04", "sky_pyroland_01", "sky_pyroland_02", "sky_pyroland_03" }; -static CatEnum skys({ "sky_tf2_04", - "sky_upward", - "sky_dustbowl_01", - "sky_goldrush_01", - "sky_granary_01", - "sky_well_01", - "sky_gravel_01", - "sky_badlands_01", - "sky_hydro_01", - "sky_night_01", - "sky_nightfall_01", - "sky_trainyard_01", - "sky_stormfront_01", - "sky_morningsnow_01", - "sky_alpinestorm_01", - "sky_harvest_01", - "sky_harvest_night_01", - "sky_halloween", - "sky_halloween_night_01", - "sky_halloween_night2014_01", - "sky_island_01", - "sky_jungle_01", - "sky_invasion2fort_01", - "sky_well_02", - "sky_outpost_01", - "sky_coastal_01", - "sky_rainbow_01", - "sky_badlands_pyroland_01", - "sky_pyroland_01", - "sky_pyroland_02", - "sky_pyroland_03" }); namespace hooked_methods { DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name) { -#if not LAGBOT_MODE +#if !LAGBOT_MODE hacks::shared::backtrack::lastincomingsequencenumber = 0; hacks::shared::backtrack::sequences.clear(); #endif - hacks::shared::autojoin::queuetime.update(); + hacks::shared::autojoin::resetQueueTimer(); firstcm = true; -#if not LAGBOT_MODE +#if !LAGBOT_MODE playerlist::Save(); #endif -#if not LAGBOT_MODE - hacks::shared::lagexploit::bcalled = false; -#endif #if ENABLE_VISUALS typedef bool (*LoadNamedSkys_Fn)(const char *); uintptr_t addr = gSignatures.GetEngineSignature( @@ -114,7 +80,7 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name) #endif g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec"); -#if not LAGBOT_MODE +#if !LAGBOT_MODE hacks::shared::aimbot::Reset(); hacks::shared::backtrack::Init(); chat_stack::Reset(); diff --git a/src/hooks/LevelShutdown.cpp b/src/hooks/LevelShutdown.cpp index f3637492..7bf46773 100644 --- a/src/hooks/LevelShutdown.cpp +++ b/src/hooks/LevelShutdown.cpp @@ -12,13 +12,13 @@ namespace hooked_methods DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_) { - hacks::shared::autojoin::queuetime.update(); + hacks::shared::autojoin::resetQueueTimer(); need_name_change = true; -#if not LAGBOT_MODE +#if !LAGBOT_MODE playerlist::Save(); #endif g_Settings.bInvalid = true; -#if not LAGBOT_MODE +#if !LAGBOT_MODE hacks::shared::aimbot::Reset(); chat_stack::Reset(); hacks::shared::anticheat::ResetEverything(); diff --git a/src/hooks/Paint.cpp b/src/hooks/Paint.cpp index 3b85adb3..28f57ad5 100644 --- a/src/hooks/Paint.cpp +++ b/src/hooks/Paint.cpp @@ -28,10 +28,7 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode) hacks::tf2::killstreak::apply_killstreaks(); #endif hacks::shared::catbot::update(); - if (hitrate::hitrate_check) - { - hitrate::Update(); - } + hitrate::Update(); online::update(); #if ENABLE_IPC static Timer nametimer{}; diff --git a/src/hooks/Shutdown.cpp b/src/hooks/Shutdown.cpp index 638a62e0..49263a36 100644 --- a/src/hooks/Shutdown.cpp +++ b/src/hooks/Shutdown.cpp @@ -9,6 +9,7 @@ static settings::Bool die_if_vac{ "misc.die-if-vac", "false" }; static settings::Bool autoabandon{ "misc.auto-abandon", "false" }; +static settings::String custom_disconnect_reason{ "misc.disconnect-reason", "" }; namespace hooked_methods { @@ -31,10 +32,10 @@ DEFINE_HOOKED_METHOD(Shutdown, void, INetChannel *this_, const char *reason) #if ENABLE_IPC ipc::UpdateServerAddress(true); #endif - if (cathook && (disconnect_reason.convar_parent->m_StringLength > 3) && + if (isHackActive() && (custom_disconnect_reason.toString().size() > 3) && strstr(reason, "user")) { - original::Shutdown(this_, disconnect_reason_newlined); + original::Shutdown(this_, custom_disconnect_reason.toString().c_str()); } else { @@ -44,14 +45,8 @@ DEFINE_HOOKED_METHOD(Shutdown, void, INetChannel *this_, const char *reason) if (autoabandon) { t.update(); - while (1) - if (t.test_and_set(5000)) - { - tfmm::dcandabandon(); - break; - } + tfmm::disconnectAndAbandon(); } - if (hacks::shared::autojoin::auto_queue) - tfmm::queue_start(); + hacks::shared::autojoin::onShutdown(); } } diff --git a/src/prediction.cpp b/src/prediction.cpp index aa1ab31b..6fc75417 100644 --- a/src/prediction.cpp +++ b/src/prediction.cpp @@ -168,7 +168,7 @@ Vector EnginePrediction(CachedEntity *entity, float time) Vector old_origin = entity->m_vecOrigin(); NET_VECTOR(ent, 0x354) = entity->m_vecOrigin(); - //*g_PredictionRandomSeed = MD5_PseudoRandom(g_pUserCmd->command_number) & + //*g_PredictionRandomSeed = MD5_PseudoRandom(current_user_cmd->command_number) & // 0x7FFFFFFF; g_IGameMovement->StartTrackPredictionErrors( reinterpret_cast(ent)); diff --git a/src/visual/EventLogging.cpp b/src/visual/EventLogging.cpp index a690ce47..4ad31b6f 100644 --- a/src/visual/EventLogging.cpp +++ b/src/visual/EventLogging.cpp @@ -174,3 +174,7 @@ InitRoutine init([]() { g_IGameEventManager->AddListener(&listener, false); }); +bool event_logging::isEnabled() +{ + return *enable; +}