From 1cb16f9855a963d0b1e64bb6551a9c91288288fb Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Mon, 11 May 2020 13:08:52 +0200 Subject: [PATCH] Don't use way too low charge aimbot range and fix targeting issues --- include/hacks/MiscAimbot.hpp | 2 +- src/hacks/MiscAimbot.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/hacks/MiscAimbot.hpp b/include/hacks/MiscAimbot.hpp index dc338c9a..6ebc2931 100644 --- a/include/hacks/MiscAimbot.hpp +++ b/include/hacks/MiscAimbot.hpp @@ -2,5 +2,5 @@ #include "common.hpp" namespace hacks::tf2::misc_aimbot { -std::pair FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check, float range = 600.0f); +std::pair FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check, float range = 1500.0f); } diff --git a/src/hacks/MiscAimbot.cpp b/src/hacks/MiscAimbot.cpp index 0b608be1..954814d4 100644 --- a/src/hacks/MiscAimbot.cpp +++ b/src/hacks/MiscAimbot.cpp @@ -19,12 +19,17 @@ static settings::Int sandwichaim_aimkey_mode{ "sandwichaim.aimkey-mode", "0" }; float sandwich_speed = 350.0f; float grav = 0.25f; int prevent = -1; +static Timer previous_entity_delay{}; +// TODO: Refactor this jank std::pair FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check, float range) { CachedEntity *bestent = nullptr; float bestscr = FLT_MAX; Vector predicted{}; + // Too long since we focused it + if (previous_entity_delay.check(100)) + prevent = -1; for (int i = 0; i < 1; i++) { if (prevent != -1) @@ -32,7 +37,7 @@ std::pair FindBestEnt(bool teammate, bool Predict, bool auto ent = ENTITY(prevent); if (CE_BAD(ent) || !ent->m_bAlivePlayer() || (teammate && ent->m_iTeam() != LOCAL_E->m_iTeam()) || ent == LOCAL_E) continue; - if (!teammate && ent->m_iTeam() == LOCAL_E->m_ItemType()) + if (!teammate && ent->m_iTeam() == LOCAL_E->m_iTeam()) continue; if (!ent->hitboxes.GetHitbox(1)) continue; @@ -69,7 +74,10 @@ std::pair FindBestEnt(bool teammate, bool Predict, bool } } if (bestent && predicted.z) + { + previous_entity_delay.update(); return { bestent, predicted }; + } } prevent = -1; for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)