From dcdfec46092104b81b02938987606e907788b09a Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Fri, 20 Jul 2018 19:28:14 +0200 Subject: [PATCH 1/6] Improvements and fixes --- include/helpers.hpp | 1 - src/hacks/Aimbot.cpp | 2 +- src/hacks/Backtrack.cpp | 2 +- src/hacks/FollowBot.cpp | 27 ++++++++++-------- src/helpers.cpp | 61 ++++++++++------------------------------- 5 files changed, 33 insertions(+), 60 deletions(-) diff --git a/include/helpers.hpp b/include/helpers.hpp index 03751cd8..ac11ce6d 100755 --- a/include/helpers.hpp +++ b/include/helpers.hpp @@ -82,7 +82,6 @@ Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist, float vectorMax(Vector i); Vector vectorAbs(Vector i); bool canReachVector(Vector loc, Vector dest = {0,0,0}); -bool isJumping(Vector vec); bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax); diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 1c52c229..70ef0763 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -201,7 +201,7 @@ bool BacktrackAimbot() { bool good_tick = false; for (int j = 0; j < 12; ++j) - if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && hacks::shared::backtrack::sorted_ticks[j].tickcount != FLT_MAX) + if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && hacks::shared::backtrack::sorted_ticks[j].tickcount != INT_MAX) good_tick = true; tickcnt++; if (!i.hitboxpos.z) diff --git a/src/hacks/Backtrack.cpp b/src/hacks/Backtrack.cpp index 7cbc34ee..b2793586 100644 --- a/src/hacks/Backtrack.cpp +++ b/src/hacks/Backtrack.cpp @@ -174,7 +174,7 @@ void Run() { bool good_tick = false; for (int i = 0; i < 12; ++i) - if (t == sorted_ticks[i].tick && sorted_ticks[i].tickcount != FLT_MAX) + if (t == sorted_ticks[i].tick && sorted_ticks[i].tickcount != INT_MAX) good_tick = true; if (!good_tick) continue; diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index bb205159..ac090181 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -63,9 +63,10 @@ static const int crumb_limit = 64; // limit // Followed entity, externed for highlight color int follow_target = 0; -bool inited; +static bool inited; Timer lastTaunt{}; // time since taunt was last executed, used to avoid kicks +Timer lastJump{}; std::array afkTicks; // for how many ms the player hasn't been moving void checkAFK() @@ -75,7 +76,7 @@ void checkAFK() auto entity = ENTITY(i); if (CE_BAD(entity)) continue; - if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(5.0f)) + if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(40.0f)) { afkTicks[i].update(); } @@ -306,12 +307,6 @@ void WorldTick() } } -// if(!checkPath()) //wip do not merge if you see this -// { -// follow_target = 0; -// return; -// } - // Update timer on new target static Timer idle_time{}; if (breadcrumbs.empty()) @@ -331,7 +326,7 @@ void WorldTick() // New crumbs, we add one if its empty so we have something to follow if ((breadcrumbs.empty() || tar_orig.DistTo(breadcrumbs.at(breadcrumbs.size() - 1)) > 40.0F) && - DistanceToGround(ENTITY(follow_target)) < 30) + DistanceToGround(ENTITY(follow_target)) < 45) breadcrumbs.push_back(tar_orig); // Prune old and close crumbs that we wont need anymore, update idle timer @@ -357,14 +352,24 @@ void WorldTick() if (dist_to_target > (float) follow_distance) { // Check for jump - if (autojump && (idle_time.check(2000) || isJumping(breadcrumbs[0]))) + if (autojump && lastJump.check(1000) && (idle_time.check(2000) || DistanceToGround(breadcrumbs[0]) > 42)) + { g_pUserCmd->buttons |= IN_JUMP; - // Check for idle + lastJump.update(); + } + // Check if still moving. 70 HU = Sniper Zoomed Speed + if (idle_time.check(3000) && CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(60.0f)) + { + follow_target = 0; + return; + } + // Basic idle check if (idle_time.test_and_set(5000)) { follow_target = 0; return; } + static float last_slot_check = 0.0f; if (g_GlobalVars->curtime < last_slot_check) last_slot_check = 0.0f; diff --git a/src/helpers.cpp b/src/helpers.cpp index 1867137e..ddfb6f40 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -192,16 +192,10 @@ bool canReachVector(Vector loc, Vector dest) int maxiterations = floor(dest.DistTo(loc)) / 40; for (int i = 0; i < maxiterations; i++) { + // math to get the next vector 40.0f in the direction of dest Vector vec = loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1); - trace_t trace; - Ray_t ray; - Vector down = vec; - down.z = down.z - 50; - ray.Init(vec, down); - g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, - &trace); - if (!(trace.startpos.DistTo(trace.endpos) <= 45)) + if (DistanceToGround(vec) >= 45) return false; for (int j = 0; j < 4; j++) @@ -223,13 +217,13 @@ bool canReachVector(Vector loc, Vector dest) directionalLoc.y = directionalLoc.y - 40; break; } - trace_t trace2; - Ray_t ray2; - ray2.Init(vec, directionalLoc); - g_ITrace->TraceRay(ray2, 0x4200400B, &trace::filter_no_player, - &trace2); + trace_t trace; + Ray_t ray; + ray.Init(vec, directionalLoc); + g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, + &trace); // distance of trace < than 26 - if (trace2.startpos.DistTo(trace2.endpos) < 26.0f) + if (trace.startpos.DistTo(trace.endpos) < 26.0f) return false; } } @@ -237,16 +231,11 @@ bool canReachVector(Vector loc, Vector dest) else { // check if the vector is too high above ground - trace_t trace; - Ray_t ray; - Vector down = loc; - down.z = down.z - 50; - ray.Init(loc, down); - g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace); // higher to avoid small false positives, player can jump 42 hu according to // the tf2 wiki - if (!(trace.startpos.DistTo(trace.endpos) <= 45)) + if (DistanceToGround(loc) >= 45) return false; + // check if there is enough space arround the vector for a player to fit // for loop for all 4 directions for (int i = 0; i < 4; i++) @@ -268,38 +257,18 @@ bool canReachVector(Vector loc, Vector dest) directionalLoc.y = directionalLoc.y - 40; break; } - trace_t trace2; - Ray_t ray2; - ray2.Init(loc, directionalLoc); - g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace2); + trace_t trace; + Ray_t ray; + ray.Init(loc, directionalLoc); + g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace); // distance of trace < than 26 - if (trace2.startpos.DistTo(trace2.endpos) < 26.0f) + if (trace.startpos.DistTo(trace.endpos) < 26.0f) return false; } } return true; } -// returns if the player is currently jumping/falling. -bool isJumping(Vector vec) -{ - // check if the vector is too high above ground - trace_t trace; - Ray_t ray; - Vector down = vec; - Vector loc = vec; - down.z = down.z - 50; - loc.z = loc.z + 5; - ray.Init(vec, down); - // trace::filter_no_player.SetSelf(RAW_ENT(g_pLocalPlayer->entity)); - g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace); - // lower to avoid small false negatives, player can jump 42 hu according to - // the tf2 wiki, higher because loc.z = loc.z + 5; - if (trace.startpos.DistTo(trace.endpos) > 45) - return true; - return false; -} - std::string GetLevelName() { From e051c168515251d10a0eba6e723adbee5a24d336 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Fri, 20 Jul 2018 20:27:58 +0200 Subject: [PATCH 2/6] Fix backtrack issues --- src/hacks/Aimbot.cpp | 3 ++- src/hacks/AutoBackstab.cpp | 2 +- src/hacks/Backtrack.cpp | 9 ++++++--- src/hacks/Trigger.cpp | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 70ef0763..cf1a7a21 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -201,7 +201,8 @@ bool BacktrackAimbot() { bool good_tick = false; for (int j = 0; j < 12; ++j) - if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && hacks::shared::backtrack::sorted_ticks[j].tickcount != INT_MAX) + if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && + hacks::shared::backtrack::sorted_ticks[j].tickcount != INT_MAX) good_tick = true; tickcnt++; if (!i.hitboxpos.z) diff --git a/src/hacks/AutoBackstab.cpp b/src/hacks/AutoBackstab.cpp index 3e0f853f..15cea298 100644 --- a/src/hacks/AutoBackstab.cpp +++ b/src/hacks/AutoBackstab.cpp @@ -52,7 +52,7 @@ void CreateMove() { bool good_tick = false; for (int j = 0; j < 12; ++j) - if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick) + if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && hacks::shared::backtrack::sorted_ticks[j].tickcount != INT_MAX) good_tick = true; tickcnt++; if (!good_tick) diff --git a/src/hacks/Backtrack.cpp b/src/hacks/Backtrack.cpp index b2793586..1b70ef1c 100644 --- a/src/hacks/Backtrack.cpp +++ b/src/hacks/Backtrack.cpp @@ -9,8 +9,10 @@ #include "hacks/Backtrack.hpp" #include #include -#define IsMelee GetWeaponMode() == weapon_melee - +bool IsMelee() +{ + return GetWeaponMode() == weapon_melee; +} namespace hacks::shared::backtrack { CatVar enable(CV_SWITCH, "backtrack", "0", "Enable backtrack", @@ -174,7 +176,8 @@ void Run() { bool good_tick = false; for (int i = 0; i < 12; ++i) - if (t == sorted_ticks[i].tick && sorted_ticks[i].tickcount != INT_MAX) + if (t == sorted_ticks[i].tick && + sorted_ticks[i].tickcount != INT_MAX && sorted_ticks[i].tickcount) good_tick = true; if (!good_tick) continue; diff --git a/src/hacks/Trigger.cpp b/src/hacks/Trigger.cpp index c302f412..7911e951 100644 --- a/src/hacks/Trigger.cpp +++ b/src/hacks/Trigger.cpp @@ -86,7 +86,7 @@ bool CanBacktrack() { bool good_tick = false; for (int j = 0; j < 12; ++j) - if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick) + if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && hacks::shared::backtrack::sorted_ticks[j].tickcount != INT_MAX) good_tick = true; tickcnt++; if (!good_tick) From 5e05e151e8a07e96b961b9714293d7583dce40ed Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Fri, 20 Jul 2018 22:23:23 +0200 Subject: [PATCH 3/6] Backtrack fix V2 --- src/hacks/Backtrack.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/hacks/Backtrack.cpp b/src/hacks/Backtrack.cpp index 1b70ef1c..450509d8 100644 --- a/src/hacks/Backtrack.cpp +++ b/src/hacks/Backtrack.cpp @@ -9,10 +9,6 @@ #include "hacks/Backtrack.hpp" #include #include -bool IsMelee() -{ - return GetWeaponMode() == weapon_melee; -} namespace hacks::shared::backtrack { CatVar enable(CV_SWITCH, "backtrack", "0", "Enable backtrack", @@ -108,6 +104,7 @@ void Run() float bestFov = 99999; BestTick = 0; iBestTarget = -1; + bool IsMelee = GetWeaponMode() == weapon_melee; float prev_distance = 9999; From 8d8b7a0e41452144beeea51ea2b715717ffdcf24 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sat, 21 Jul 2018 11:49:44 +0200 Subject: [PATCH 4/6] FB: Autojump, AFK and canReachVector improvements --- src/hacks/FollowBot.cpp | 4 ++-- src/helpers.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index ac090181..2e2d83f5 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -76,7 +76,7 @@ void checkAFK() auto entity = ENTITY(i); if (CE_BAD(entity)) continue; - if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(40.0f)) + if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(60.0f)) { afkTicks[i].update(); } @@ -352,7 +352,7 @@ void WorldTick() if (dist_to_target > (float) follow_distance) { // Check for jump - if (autojump && lastJump.check(1000) && (idle_time.check(2000) || DistanceToGround(breadcrumbs[0]) > 42)) + if (autojump && lastJump.check(1000) && (idle_time.check(2000) || DistanceToGround({breadcrumbs[0].x,breadcrumbs[0].y,breadcrumbs[0].z + 5}) > 47)) { g_pUserCmd->buttons |= IN_JUMP; lastJump.update(); diff --git a/src/helpers.cpp b/src/helpers.cpp index ddfb6f40..3673cf82 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -195,7 +195,7 @@ bool canReachVector(Vector loc, Vector dest) // math to get the next vector 40.0f in the direction of dest Vector vec = loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1); - if (DistanceToGround(vec) >= 45) + if (DistanceToGround({vec.x,vec.y,vec.z + 5}) >= 40) return false; for (int j = 0; j < 4; j++) @@ -233,7 +233,7 @@ bool canReachVector(Vector loc, Vector dest) // check if the vector is too high above ground // higher to avoid small false positives, player can jump 42 hu according to // the tf2 wiki - if (DistanceToGround(loc) >= 45) + if (DistanceToGround({loc.x,loc.y,loc.z + 5}) >= 40) return false; // check if there is enough space arround the vector for a player to fit From a7be8a88fb41af134ff9b0bcb8f7927ce9b0c5c9 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sat, 21 Jul 2018 13:59:16 +0200 Subject: [PATCH 5/6] Fix undef. behaviour/crash when sending msg to chat --- src/helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers.cpp b/src/helpers.cpp index 3673cf82..6fd8b9c5 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -1211,7 +1211,7 @@ void PrintChat(const char *fmt, ...) va_end(list); std::unique_ptr str(strfmt("\x07%06X[\x07%06XCAT\x07%06X]\x01 %s", 0x5e3252, 0xba3d9a, 0x5e3252, - buf.get()).get()); + buf.get()).release()); // FIXME DEBUG LOG logging::Info("%s", str.get()); chat->Printf(str.get()); From e2730286f4c0942b3f6086b15169c632ab93cfee Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sat, 21 Jul 2018 14:24:56 +0200 Subject: [PATCH 6/6] Autounzoom fix Fixed autounzoom having a fixed unzoom time instead of a dynamic time. --- src/hacks/Aimbot.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index cf1a7a21..36a6ad43 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -173,6 +173,8 @@ float cur_proj_grav{ 0.0f }; // If slow aimbot allows autoshoot bool slow_can_shoot = false; bool projectileAimbotRequired; +// Keep track of our zoom time +Timer zoomTime{}; // This array will store calculated projectile/hitscan predictions // for current frame, to avoid performing them again @@ -252,13 +254,9 @@ void CreateMove() // Auto-Unzoom if (auto_unzoom) { - if (g_pLocalPlayer->holding_sniper_rifle) + if (g_pLocalPlayer->holding_sniper_rifle && g_pLocalPlayer->bZoomed && zoomTime.check(3000)) { - if (g_pLocalPlayer->bZoomed) - { - if (g_GlobalVars->curtime - g_pLocalPlayer->flZoomBegin > 5.0f) g_pUserCmd->buttons |= IN_ATTACK2; - } } } // We do this as we need to pass whether the aimkey allows aiming to both @@ -276,6 +274,7 @@ void CreateMove() { if (g_pLocalPlayer->holding_sniper_rifle) { + zoomTime.update(); if (not g_pLocalPlayer->bZoomed) { g_pUserCmd->buttons |= IN_ATTACK2;