From ed9c32c2a4784c327c46568d0de38c161c98957e Mon Sep 17 00:00:00 2001 From: bencat07 Date: Wed, 3 Oct 2018 11:14:08 +0200 Subject: [PATCH 1/7] improvements --- src/hacks/AntiCheat.cpp | 13 +++++++-- src/hacks/MiscAimbot.cpp | 63 +++++++++++++++++++++------------------- src/hacks/NavBot.cpp | 11 +++++-- 3 files changed, 52 insertions(+), 35 deletions(-) diff --git a/src/hacks/AntiCheat.cpp b/src/hacks/AntiCheat.cpp index 10607bb3..e1738922 100644 --- a/src/hacks/AntiCheat.cpp +++ b/src/hacks/AntiCheat.cpp @@ -10,6 +10,7 @@ #include #include #include "common.hpp" +#include "PlayerTools.hpp" #include "hack.hpp" static settings::Bool enable{ "find-cheaters.enable", "0" }; @@ -66,9 +67,15 @@ void CreateMove() { if ((CE_BYTE(ent, netvar.iLifeState) == 0)) { - ac::aimbot::Update(ent); - ac::antiaim::Update(ent); - ac::bhop::Update(ent); + if (player_tools::shouldTarget(ent) == + player_tools::IgnoreReason::DO_NOT_IGNORE || + player_tools::shouldTarget(ent) == + player_tools::IgnoreReason::LOCAL_PLAYER_LIST) + { + ac::aimbot::Update(ent); + ac::antiaim::Update(ent); + ac::bhop::Update(ent); + } } } } diff --git a/src/hacks/MiscAimbot.cpp b/src/hacks/MiscAimbot.cpp index bf29559f..83beaf64 100644 --- a/src/hacks/MiscAimbot.cpp +++ b/src/hacks/MiscAimbot.cpp @@ -12,7 +12,8 @@ static settings::Int aimkey_mode{ "sandwichaim.aimkey-mode", "0" }; float sandwich_speed = 350.0f; float grav = 0.25f; -std::pair FindBestEnt(bool teammate, bool Predict, bool zcheck) +std::pair FindBestEnt(bool teammate, bool Predict, + bool zcheck) { CachedEntity *bestent = nullptr; float bestscr = FLT_MAX; @@ -21,7 +22,8 @@ std::pair FindBestEnt(bool teammate, bool Predict, bool { CachedEntity *ent = ENTITY(i); if (CE_BAD(ent) || !(ent->m_bAlivePlayer()) || - (teammate && ent->m_iTeam() != LOCAL_E->m_iTeam()) || ent == LOCAL_E) + (teammate && ent->m_iTeam() != LOCAL_E->m_iTeam()) || + ent == LOCAL_E) continue; if (!teammate && ent->m_iTeam() == LOCAL_E->m_iTeam()) continue; @@ -30,7 +32,7 @@ std::pair FindBestEnt(bool teammate, bool Predict, bool Vector target{}; if (Predict) target = ProjectilePrediction(ent, 1, sandwich_speed, grav, - PlayerGravityMod(ent)); + PlayerGravityMod(ent)); else target = ent->hitboxes.GetHitbox(1)->center; if (!IsEntityVectorVisible(ent, target)) @@ -42,12 +44,12 @@ std::pair FindBestEnt(bool teammate, bool Predict, bool scr *= 0.1f; if (scr < bestscr) { - bestent = ent; + bestent = ent; predicted = target; - bestscr = scr; + bestscr = scr; } } - return {bestent, predicted}; + return { bestent, predicted }; } static HookedFunction SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() { @@ -76,7 +78,7 @@ static HookedFunction Vector Predict; CachedEntity *bestent = nullptr; std::pair result{}; - result = FindBestEnt(true, true, false); + result = FindBestEnt(true, true, false); bestent = result.first; Predict = result.second; if (bestent) @@ -91,26 +93,27 @@ static HookedFunction g_pLocalPlayer->bUseSilentAngles = true; } }); -static settings::Bool charge_aim{ "chargeaim.enable", "false"}; -static HookedFunction ChargeAimbot(HookedFunctions_types::HF_CreateMove, "ChargeAim", 1, [](){ - if (!*charge_aim) - return; - if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer()) - return; - if (!HasCondition(LOCAL_E)) - return; - std::pair result{}; - result = FindBestEnt(false, false, true); - CachedEntity *bestent = result.first; - if (bestent && result.second.IsValid()) - { - Vector tr = result.second - g_pLocalPlayer->v_Eye; - Vector angles; - VectorAngles(tr, angles); - // Clamping is important - fClampAngle(angles); - current_user_cmd->viewangles = angles; - current_user_cmd->buttons |= IN_ATTACK2; - g_pLocalPlayer->bUseSilentAngles = true; - } -}); \ No newline at end of file +static settings::Bool charge_aim{ "chargeaim.enable", "false" }; +static HookedFunction + ChargeAimbot(HookedFunctions_types::HF_CreateMove, "ChargeAim", 1, []() { + if (!*charge_aim) + return; + if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer()) + return; + if (!HasCondition(LOCAL_E)) + return; + std::pair result{}; + result = FindBestEnt(false, false, true); + CachedEntity *bestent = result.first; + if (bestent && result.second.IsValid()) + { + Vector tr = result.second - g_pLocalPlayer->v_Eye; + Vector angles; + VectorAngles(tr, angles); + // Clamping is important + fClampAngle(angles); + current_user_cmd->viewangles = angles; + current_user_cmd->buttons |= IN_ATTACK2; + g_pLocalPlayer->bUseSilentAngles = true; + } + }); \ No newline at end of file diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index bbab58d5..4533fdab 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -361,8 +361,15 @@ bool NavToEnemy() { int nearestvalid{}; if (!*heavy_mode) - nearestvalid = - nav::FindNearestValidbyDist(ent->m_vecOrigin(), 1000, 4000); + { + int range = 0; + while (nearestvalid == -1 && range < 5000) + { + nearestvalid = + nav::FindNearestValidbyDist(ent->m_vecOrigin(), 2000 - range/4 , 6000 - range); + range += 300.0f; + } + } else nearestvalid = nav::FindNearestValidbyDist(ent->m_vecOrigin(), 200, 1000); From 76efe7f3eff7d2e95ebc0b1c6bf16c062f1b2086 Mon Sep 17 00:00:00 2001 From: LightCat Date: Wed, 3 Oct 2018 11:34:12 +0200 Subject: [PATCH 2/7] woops --- src/hacks/AntiCheat.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/hacks/AntiCheat.cpp b/src/hacks/AntiCheat.cpp index e1738922..a527f09b 100644 --- a/src/hacks/AntiCheat.cpp +++ b/src/hacks/AntiCheat.cpp @@ -68,9 +68,7 @@ void CreateMove() if ((CE_BYTE(ent, netvar.iLifeState) == 0)) { if (player_tools::shouldTarget(ent) == - player_tools::IgnoreReason::DO_NOT_IGNORE || - player_tools::shouldTarget(ent) == - player_tools::IgnoreReason::LOCAL_PLAYER_LIST) + player_tools::IgnoreReason::DO_NOT_IGNORE || ent == LOCAL_E) { ac::aimbot::Update(ent); ac::antiaim::Update(ent); From 4cfff12949109efe5ecebbe0b22db01c4bccf0e5 Mon Sep 17 00:00:00 2001 From: catlaptop Date: Thu, 4 Oct 2018 16:09:30 +0200 Subject: [PATCH 3/7] Upgrades.tm --- include/navparser.hpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/include/navparser.hpp b/include/navparser.hpp index 54d2427f..e6ddb213 100644 --- a/include/navparser.hpp +++ b/include/navparser.hpp @@ -243,6 +243,8 @@ public: struct MAP : public micropather::Graph { std::unique_ptr pather; + std::unordered_map, int, boost::hash>> vischeck_cd; + Timer vischeck_t{}; // Maps already utilize dynamic allocation and we don't need a custom // constructor inactivityTracker inactiveTracker; @@ -321,8 +323,20 @@ struct MAP : public micropather::Graph micropather::StateCost cost; cost.state = static_cast(&areas.at(id)); cost.cost = area->m_center.DistTo(i.area->m_center); - if (!inactiveTracker.vischeckConnection(connection)) - cost.cost *= 999; + if (vischeck_t.test_and_set(2000)) + vischeck_cd.clear(); + if (vischeck_cd[connection] == 0) + { + if (!inactiveTracker.vischeckConnection(connection)) + { + cost.cost *= 99; + vischeck_cd[connection] = 2; + } + else + vischeck_cd[connection] = 1; + } + else if (vischeck_cd[connection] == 2) + cost.cost *= 99; adjacent->push_back(cost); } } From 16189f4e7f55ac2d8078c92d8d1f7a2aab495f1f Mon Sep 17 00:00:00 2001 From: catlaptop Date: Thu, 4 Oct 2018 16:11:37 +0200 Subject: [PATCH 4/7] more changes.tm --- src/hacks/AntiCheat.cpp | 3 ++- src/hacks/NavBot.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hacks/AntiCheat.cpp b/src/hacks/AntiCheat.cpp index a527f09b..da354108 100644 --- a/src/hacks/AntiCheat.cpp +++ b/src/hacks/AntiCheat.cpp @@ -68,7 +68,8 @@ void CreateMove() if ((CE_BYTE(ent, netvar.iLifeState) == 0)) { if (player_tools::shouldTarget(ent) == - player_tools::IgnoreReason::DO_NOT_IGNORE || ent == LOCAL_E) + player_tools::IgnoreReason::DO_NOT_IGNORE || + ent == LOCAL_E) { ac::aimbot::Update(ent); ac::antiaim::Update(ent); diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index 4533fdab..cce82713 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -365,8 +365,8 @@ bool NavToEnemy() int range = 0; while (nearestvalid == -1 && range < 5000) { - nearestvalid = - nav::FindNearestValidbyDist(ent->m_vecOrigin(), 2000 - range/4 , 6000 - range); + nearestvalid = nav::FindNearestValidbyDist( + ent->m_vecOrigin(), 2000 - range / 4, 6000 - range); range += 300.0f; } } From 55695ef2700de8c71461c7a4df62c7094aa43590 Mon Sep 17 00:00:00 2001 From: catlaptop Date: Thu, 4 Oct 2018 19:22:12 +0200 Subject: [PATCH 5/7] Fix AC tf --- include/hacks/ac/aimbot.hpp | 3 +++ src/hacks/AntiCheat.cpp | 5 +++-- src/hacks/ac/aimbot.cpp | 14 +++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/include/hacks/ac/aimbot.hpp b/include/hacks/ac/aimbot.hpp index 57d50520..972acb8b 100644 --- a/include/hacks/ac/aimbot.hpp +++ b/include/hacks/ac/aimbot.hpp @@ -7,6 +7,8 @@ #pragma once +#include "config.h" +#include "common.hpp" #include class KeyValues; @@ -24,6 +26,7 @@ struct ac_data extern int amount[32]; void ResetEverything(); +std::unordered_map &player_orgs(); void ResetPlayer(int idx); void Init(); diff --git a/src/hacks/AntiCheat.cpp b/src/hacks/AntiCheat.cpp index da354108..a59dae22 100644 --- a/src/hacks/AntiCheat.cpp +++ b/src/hacks/AntiCheat.cpp @@ -58,14 +58,15 @@ void CreateMove() if (!enable) return; angles::Update(); - for (int i = 1; i < 33; i++) + ac::aimbot::player_orgs().clear(); + for (int i = 1; i < g_IEngine->GetMaxClients(); i++) { if (skip_local && (i == g_IEngine->GetLocalPlayer())) continue; CachedEntity *ent = ENTITY(i); if (CE_GOOD(ent)) { - if ((CE_BYTE(ent, netvar.iLifeState) == 0)) + if (ent->m_bAlivePlayer()) { if (player_tools::shouldTarget(ent) == player_tools::IgnoreReason::DO_NOT_IGNORE || diff --git a/src/hacks/ac/aimbot.cpp b/src/hacks/ac/aimbot.cpp index 917dcfc3..360c2eaf 100644 --- a/src/hacks/ac/aimbot.cpp +++ b/src/hacks/ac/aimbot.cpp @@ -20,15 +20,22 @@ namespace ac::aimbot ac_data data_table[32]; int amount[32]; +std::unordered_map Player_origs{}; +std::unordered_map & player_orgs() +{ + return Player_origs; +} void ResetEverything() { memset(&data_table, 0, sizeof(ac_data) * 32); + Player_origs.clear(); } void ResetPlayer(int idx) { memset(&data_table[idx - 1], 0, sizeof(ac_data)); + Player_origs.clear(); } void Init() @@ -40,6 +47,7 @@ void Update(CachedEntity *player) { if (!enable) return; + Player_origs[player->m_IDX] = player->m_vecOrigin(); auto &data = data_table[player->m_IDX - 1]; auto &am = amount[player->m_IDX - 1]; if (data.check_timer) @@ -107,12 +115,12 @@ void Event(KeyValues *event) int victim = event->GetInt("userid"); int eid = g_IEngine->GetPlayerForUserID(attacker); int vid = g_IEngine->GetPlayerForUserID(victim); - if (eid > 0 && eid < 33) + if (eid > 0 && eid < 33 && vid > 0 && vid < 33) { CachedEntity *victim = ENTITY(vid); CachedEntity *attacker = ENTITY(eid); - if (CE_GOOD(victim) && CE_GOOD(attacker)) - if (victim->m_vecOrigin().DistTo(attacker->m_vecOrigin()) > 250) + if (Player_origs[vid].z != 0 && Player_origs[eid].z != 0) + if (Player_origs[vid].DistTo(Player_origs[eid]) > 250) { data_table[eid - 1].check_timer = 1; data_table[eid - 1].last_weapon = event->GetInt("weaponid"); From d714557da36accf4bf50e7987283606b71f503ec Mon Sep 17 00:00:00 2001 From: LightyPon <40740201+LightyPon@users.noreply.github.com> Date: Fri, 5 Oct 2018 16:14:10 +0200 Subject: [PATCH 6/7] Fix WTS not working after map change Unless this has some other purpose I'm not aware of, it's useless code which only breaks WTS and requires hud_reloadscheme to fix. --- src/hooks/visual/PaintTraverse.cpp | 40 +----------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/src/hooks/visual/PaintTraverse.cpp b/src/hooks/visual/PaintTraverse.cpp index c1dfed67..121a9a95 100644 --- a/src/hooks/visual/PaintTraverse.cpp +++ b/src/hooks/visual/PaintTraverse.cpp @@ -40,14 +40,10 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_, unsigned int panel, bool force, bool allow_force) { static bool textures_loaded = false; - static unsigned long panel_focus = 0; static unsigned long panel_scope = 0; - static unsigned long panel_top = 0; - static bool cur, draw_flag = false; - static bool call_default = true; + static bool cur; static ConVar *software_cursor = g_ICvar->FindVar("cl_software_cursor"); static const char *name; - static std::string name_s, name_stripped, reason_stripped; #if ENABLE_VISUALS if (!textures_loaded) @@ -175,33 +171,6 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_, original::PaintTraverse(this_, panel, force, allow_force); // To avoid threading problems. - if (panel == panel_top) - draw_flag = true; - if (!isHackActive()) - return; - - if (!panel_top) - { - name = g_IPanel->GetName(panel); - if (strlen(name) > 4) - { - if (name[0] == 'M' && name[3] == 'S') - { - panel_top = panel; - } - } - } - if (!panel_focus) - { - name = g_IPanel->GetName(panel); - if (strlen(name) > 5) - { - if (name[0] == 'F' && name[5] == 'O') - { - panel_focus = panel; - } - } - } if (!panel_scope) { name = g_IPanel->GetName(panel); @@ -215,13 +184,6 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_, g_Settings.bInvalid = true; } - if (panel != panel_focus) - return; - g_IPanel->SetTopmostPopup(panel_focus, true); - if (!draw_flag) - return; - draw_flag = false; - if (disable_visuals) return; From 77f40c4d8f6ada817f19f22c0067d5550f347bcb Mon Sep 17 00:00:00 2001 From: LightyPon <40740201+LightyPon@users.noreply.github.com> Date: Fri, 5 Oct 2018 18:26:34 +0200 Subject: [PATCH 7/7] oops.so --- src/hooks/visual/PaintTraverse.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/visual/PaintTraverse.cpp b/src/hooks/visual/PaintTraverse.cpp index 121a9a95..46a2ce1a 100644 --- a/src/hooks/visual/PaintTraverse.cpp +++ b/src/hooks/visual/PaintTraverse.cpp @@ -41,6 +41,7 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_, { static bool textures_loaded = false; static unsigned long panel_scope = 0; + static bool call_default = true; static bool cur; static ConVar *software_cursor = g_ICvar->FindVar("cl_software_cursor"); static const char *name;