From 7262f1f4fcf26bf96d782ccf23ee8dc4f7dbc5c1 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sat, 23 Jun 2018 16:31:12 +0200 Subject: [PATCH 1/7] FollowBot is better now + changed AutoUber --- src/hacks/AutoHeal.cpp | 14 +++++++++-- src/hacks/FollowBot.cpp | 50 +++++++++++++++++++++++++++++--------- src/visual/EffectChams.cpp | 8 +----- 3 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/hacks/AutoHeal.cpp b/src/hacks/AutoHeal.cpp index ec665eed..d733697d 100644 --- a/src/hacks/AutoHeal.cpp +++ b/src/hacks/AutoHeal.cpp @@ -28,7 +28,7 @@ int m_iNewTarget{ 0 }; static CatVar pop_uber_auto(CV_SWITCH, "autoheal_uber", "1", "AutoUber", "Use ubercharge automatically"); static CatVar - pop_uber_percent(CV_FLOAT, "autoheal_uber_health", "30", + pop_uber_percent(CV_FLOAT, "autoheal_uber_health", "0", "Pop uber if health% <", "When under a percentage of health, use ubercharge"); static CatVar share_uber( @@ -355,9 +355,17 @@ bool IsPopped() bool ShouldChargePlayer(int idx) { CachedEntity *target = ENTITY(idx); + const int health = target->m_iHealth(); + if (float(pop_uber_percent) > 0) + { + const float pophealth = target->m_iMaxHealth() * (float(pop_uber_percent) / 100); + if (health < pophealth) + return true; + } + else + { const float damage_accum_duration = g_GlobalVars->curtime - data[idx].accum_damage_start; - const int health = target->m_iHealth(); if (!data[idx].accum_damage_start) return false; if (health > 30 && data[idx].accum_damage < 45) @@ -370,6 +378,8 @@ bool ShouldChargePlayer(int idx) if (health < 30 && data[idx].accum_damage > 10) return true; return false; + } + return false; } bool ShouldPop() diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 424101cb..2dfcdbdc 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace hacks { @@ -51,12 +52,16 @@ static CatVar sync_taunt(CV_SWITCH, "fb_sync_taunt", "0", "Synced taunt", "Taunt when follow target does"); static CatVar change(CV_SWITCH, "fb_switch", "1", "Change followbot target", "Always change roaming target when possible"); +static CatVar autojump(CV_SWITCH, "fb_autojump", "1", "Autojump", + "Automatically jump if stuck"); + // Something to store breadcrumbs created by followed players static std::vector breadcrumbs; static const int crumb_limit = 64; // limit // Followed entity, externed for highlight color int follow_target = 0; +long int lasttaunt; void WorldTick() { @@ -159,22 +164,36 @@ void WorldTick() if (!follow_target) return; - // If the player is close enough, we dont need to follow the path CachedEntity *followtar = ENTITY(follow_target); // wtf is this needed if (CE_BAD(followtar)) return; - auto tar_orig = followtar->m_vecOrigin(); - auto loc_orig = LOCAL_E->m_vecOrigin(); - auto dist_to_target = loc_orig.DistTo(tar_orig); - if (dist_to_target < 30) - breadcrumbs.clear(); - // Update timer on new target static Timer idle_time{}; if (breadcrumbs.empty()) idle_time.update(); + // If the player is close enough, we dont need to follow the path + auto tar_orig = followtar->m_vecOrigin(); + auto loc_orig = LOCAL_E->m_vecOrigin(); + auto dist_to_target = loc_orig.DistTo(tar_orig); + if (roambot) + { + if ((dist_to_target < (float)follow_distance) && VisCheckEntFromEnt(LOCAL_E, followtar)) + { + breadcrumbs.clear(); + idle_time.update(); + } + } + else + { + if (dist_to_target < 30) + { + breadcrumbs.clear(); + idle_time.update(); + } + } + // 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) && @@ -189,20 +208,29 @@ void WorldTick() breadcrumbs.erase(breadcrumbs.begin()); } + //moved because its worthless otherwise + if (sync_taunt && HasCondition(followtar)) { + //std::time_t time = std::time(nullptr); + long int t = static_cast (std::time(nullptr)); + if (!(t == lasttaunt)) + { + lasttaunt = t; + g_IEngine->ClientCmd("taunt"); + } + } + // Follow the crumbs when too far away, or just starting to follow if (dist_to_target > (float) follow_distance) { // Check for idle - if (idle_time.check(3000) || - (breadcrumbs.size() > 1 && LOCAL_E->m_vecVelocity.IsZero(5.0f))) + if (autojump && (idle_time.check(3000) || + (breadcrumbs.size() > 1 && LOCAL_E->m_vecVelocity.IsZero(5.0f)))) g_pUserCmd->buttons |= IN_JUMP; if (idle_time.test_and_set(5000)) { follow_target = 0; return; } - if (sync_taunt && HasCondition(ENTITY(follow_target))) - g_IEngine->ClientCmd("taunt"); static float last_slot_check = 0.0f; if (g_GlobalVars->curtime < last_slot_check) last_slot_check = 0.0f; diff --git a/src/visual/EffectChams.cpp b/src/visual/EffectChams.cpp index 55dec1e0..5ca3625a 100644 --- a/src/visual/EffectChams.cpp +++ b/src/visual/EffectChams.cpp @@ -222,8 +222,6 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity) bool EffectChams::ShouldRenderChams(IClientEntity *entity) { - if (!enable) - return false; if (entity->entindex() < 0) return false; CachedEntity *ent = ENTITY(entity->entindex()); @@ -366,11 +364,7 @@ void EffectChams::Render(int x, int y, int w, int h) BeginRenderChams(); for (int i = 1; i < HIGHEST_ENTITY; i++) { - IClientEntity *ent = g_IEntityList->GetClientEntity(i); - if (ent && !ent->IsDormant()) - { - RenderChams(i); - } + RenderChams(i); } EndRenderChams(); } From 1ad0582cafbff1c2033622dc52435ceeccbdc096 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sat, 23 Jun 2018 22:36:04 +0200 Subject: [PATCH 2/7] Followbot disguise/invisible --- include/visual/EffectChams.hpp | 4 ++-- src/hacks/FollowBot.cpp | 10 ++++++++++ src/visual/EffectChams.cpp | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/visual/EffectChams.hpp b/include/visual/EffectChams.hpp index d94fc032..2bfe231f 100644 --- a/include/visual/EffectChams.hpp +++ b/include/visual/EffectChams.hpp @@ -36,7 +36,7 @@ public: void SetEntityColor(CachedEntity *ent, rgba_t color); rgba_t ChamsColor(IClientEntity *entity); bool ShouldRenderChams(IClientEntity *entity); - void RenderChams(int idx); + void RenderChams(IClientEntity *entity); void BeginRenderChams(); void EndRenderChams(); void RenderChamsRecursive(IClientEntity *entity); @@ -54,4 +54,4 @@ public: extern EffectChams g_EffectChams; extern CScreenSpaceEffectRegistration *g_pEffectChams; -} \ No newline at end of file +} diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 2dfcdbdc..6edd27a7 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -131,6 +131,10 @@ void WorldTick() continue; if (entity == LOCAL_E) // Follow self lol continue; + if (entity->m_bEnemy()) + continue; + if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity)) + continue; if (!entity->m_bAlivePlayer()) // Dont follow dead players continue; if (follow_activation && @@ -168,6 +172,12 @@ void WorldTick() // wtf is this needed if (CE_BAD(followtar)) return; + // Check if we are following a disguised/spy + if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity)) + { + follow_target = 0; + return; + } // Update timer on new target static Timer idle_time{}; if (breadcrumbs.empty()) diff --git a/src/visual/EffectChams.cpp b/src/visual/EffectChams.cpp index 5ca3625a..02a7da55 100644 --- a/src/visual/EffectChams.cpp +++ b/src/visual/EffectChams.cpp @@ -318,6 +318,7 @@ void EffectChams::RenderChamsRecursive(IClientEntity *entity) } void EffectChams::RenderChams(int idx) +void EffectChams::RenderChams(IClientEntity *entity) { CMatRenderContextPtr ptr(GET_RENDER_CONTEXT); IClientEntity *entity = g_IEntityList->GetClientEntity(idx); @@ -365,6 +366,7 @@ void EffectChams::Render(int x, int y, int w, int h) for (int i = 1; i < HIGHEST_ENTITY; i++) { RenderChams(i); + RenderChams(entity); } EndRenderChams(); } From d6a91320031224b41c76f22d61437c51935c5929 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sun, 24 Jun 2018 16:16:41 +0200 Subject: [PATCH 3/7] AFK check --- src/hacks/FollowBot.cpp | 37 ++++++++++++++++++++++++++++++++----- src/visual/EffectChams.cpp | 13 +++++-------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 6edd27a7..bd4505f8 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -50,10 +50,12 @@ static CatVar always_medigun(CV_SWITCH, "fb_always_medigun", "0", "Always Medigun", "Always use medigun"); static CatVar sync_taunt(CV_SWITCH, "fb_sync_taunt", "0", "Synced taunt", "Taunt when follow target does"); -static CatVar change(CV_SWITCH, "fb_switch", "1", "Change followbot target", +static CatVar change(CV_SWITCH, "fb_switch", "0", "Change followbot target", "Always change roaming target when possible"); static CatVar autojump(CV_SWITCH, "fb_autojump", "1", "Autojump", "Automatically jump if stuck"); +static CatVar afk(CV_SWITCH, "fb_afk", "1", "Switch target if AFK", + "Automatically switch target if the target is afk"); // Something to store breadcrumbs created by followed players static std::vector breadcrumbs; @@ -61,7 +63,10 @@ static const int crumb_limit = 64; // limit // Followed entity, externed for highlight color int follow_target = 0; -long int lasttaunt; + +long int lasttaunt; //time since epoch when "taunt" was last executed +int lasttarget; //target we should not follow again +int tickswasted; //how many createmove ticks we have wasted because a target is afk void WorldTick() { @@ -133,6 +138,8 @@ void WorldTick() continue; if (entity->m_bEnemy()) continue; + if (i == lasttarget) //don't follow target that was determined afk + continue; if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity)) continue; if (!entity->m_bAlivePlayer()) // Dont follow dead players @@ -162,6 +169,7 @@ void WorldTick() continue; // ooooo, a target follow_target = entity->m_IDX; + tickswasted = 0; //set afk ticks to 0 } } // last check for entity before we continue @@ -173,11 +181,31 @@ void WorldTick() if (CE_BAD(followtar)) return; // Check if we are following a disguised/spy - if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity)) + if (IsPlayerDisguised(followtar) || IsPlayerInvisible(followtar)) { follow_target = 0; return; } + //check if player is afk + if (afk) + { + if (CE_VECTOR(followtar, netvar.vVelocity).IsZero(1.0f)) + { + tickswasted = tickswasted + 1; + if (tickswasted >= 990) + { + lasttarget = follow_target; + follow_target = 0; + return; + } + } + else + { + tickswasted = 0; + } + + } + // Update timer on new target static Timer idle_time{}; if (breadcrumbs.empty()) @@ -233,8 +261,7 @@ void WorldTick() if (dist_to_target > (float) follow_distance) { // Check for idle - if (autojump && (idle_time.check(3000) || - (breadcrumbs.size() > 1 && LOCAL_E->m_vecVelocity.IsZero(5.0f)))) + if (autojump && idle_time.check(3000)) g_pUserCmd->buttons |= IN_JUMP; if (idle_time.test_and_set(5000)) { diff --git a/src/visual/EffectChams.cpp b/src/visual/EffectChams.cpp index 02a7da55..eb13fcea 100644 --- a/src/visual/EffectChams.cpp +++ b/src/visual/EffectChams.cpp @@ -222,11 +222,11 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity) bool EffectChams::ShouldRenderChams(IClientEntity *entity) { + if (!enable) + return false; if (entity->entindex() < 0) return false; CachedEntity *ent = ENTITY(entity->entindex()); - if (CE_BAD(ent)) - return false; if (ent->m_IDX == LOCAL_E->m_IDX && !chamsself) return false; switch (ent->m_Type()) @@ -317,13 +317,9 @@ void EffectChams::RenderChamsRecursive(IClientEntity *entity) } } -void EffectChams::RenderChams(int idx) void EffectChams::RenderChams(IClientEntity *entity) { CMatRenderContextPtr ptr(GET_RENDER_CONTEXT); - IClientEntity *entity = g_IEntityList->GetClientEntity(idx); - if (entity && !entity->IsDormant()) - { if (ShouldRenderChams(entity)) { rgba_t color = ChamsColor(entity); @@ -347,7 +343,6 @@ void EffectChams::RenderChams(IClientEntity *entity) g_IVModelRender->ForcedMaterialOverride(flat ? mat_unlit : mat_lit); RenderChamsRecursive(entity); - } } } } @@ -365,7 +360,9 @@ void EffectChams::Render(int x, int y, int w, int h) BeginRenderChams(); for (int i = 1; i < HIGHEST_ENTITY; i++) { - RenderChams(i); + IClientEntity *entity = g_IEntityList->GetClientEntity(i); + if (!entity || entity->IsDormant() || CE_BAD(ENTITY(i))) + return; RenderChams(entity); } EndRenderChams(); From 5a7be4e1c472eabbb052ba8c2ebb370121d4f180 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sun, 24 Jun 2018 20:29:05 +0200 Subject: [PATCH 4/7] Better afk check & better breadcrumb clearing --- src/hacks/FollowBot.cpp | 65 ++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 9523f602..a8f02cb6 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -51,7 +51,10 @@ static CatVar change(CV_SWITCH, "fb_switch", "0", "Change followbot target", static CatVar autojump(CV_SWITCH, "fb_autojump", "1", "Autojump", "Automatically jump if stuck"); static CatVar afk(CV_SWITCH, "fb_afk", "1", "Switch target if AFK", - "Automatically switch target if the target is afk"); + "Automatically switch target if the target is afk"); +static CatVar afktime(CV_INT, "fb_afk_time", "990", "Max AFK Time", + "Max ticks (66 * time in seconds) spent standing still " + "until a player is declared afk."); // Something to store breadcrumbs created by followed players static std::vector breadcrumbs; @@ -60,9 +63,26 @@ static const int crumb_limit = 64; // limit // Followed entity, externed for highlight color int follow_target = 0; -long int lasttaunt; //time since epoch when "taunt" was last executed -int lasttarget; //target we should not follow again -int tickswasted; //how many createmove ticks we have wasted because a target is afk +static long int lasttaunt; //time since epoch when "taunt" was last executed +std::array afkticks; //for how many createmove ticks the player hasn't been moving + +void checkAFK() +{ + for (int i = 0; i < g_GlobalVars->maxClients; i++) + { + auto entity = ENTITY(i); + if (CE_BAD(entity)) + continue; + if (CE_VECTOR(entity, netvar.vVelocity).IsZero(5.0f)) + { + afkticks[i] = afkticks[i] + 1; + } + else + { + afkticks[i] = 0; + } + } +} void WorldTick() { @@ -79,6 +99,9 @@ void WorldTick() return; } + if (afk) + checkAFK(); + // Still good check if (follow_target) { @@ -134,7 +157,7 @@ void WorldTick() continue; if (entity->m_bEnemy()) continue; - if (i == lasttarget) //don't follow target that was determined afk + if (afk && afkticks[i] >= int(afktime)) //don't follow target that was determined afk continue; if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity)) continue; @@ -164,8 +187,8 @@ void WorldTick() entity->m_flDistance()) // favor closer entitys continue; // ooooo, a target - follow_target = entity->m_IDX; - tickswasted = 0; //set afk ticks to 0 + follow_target = i; + afkticks[i] = 0; //set afk ticks to 0 } } // last check for entity before we continue @@ -182,22 +205,13 @@ void WorldTick() follow_target = 0; return; } - //check if player is afk + //check if target is afk if (afk) { - if (CE_VECTOR(followtar, netvar.vVelocity).IsZero(1.0f)) + if (afkticks[follow_target] >= 990) { - tickswasted = tickswasted + 1; - if (tickswasted >= 990) - { - lasttarget = follow_target; - follow_target = 0; - return; - } - } - else - { - tickswasted = 0; + follow_target = 0; + return; } } @@ -215,7 +229,6 @@ void WorldTick() { if ((dist_to_target < (float)follow_distance) && VisCheckEntFromEnt(LOCAL_E, followtar)) { - breadcrumbs.clear(); idle_time.update(); } } @@ -242,6 +255,16 @@ void WorldTick() breadcrumbs.erase(breadcrumbs.begin()); } + for (int i = 0; i < breadcrumbs.size(); i++) + { + if (loc_orig.DistTo(breadcrumbs.at(i)) < 60.f) + { + idle_time.update(); + for (int i2 = 0; i2 <= i; i2++) + breadcrumbs.erase(breadcrumbs.begin()); + } + } + //moved because its worthless otherwise if (sync_taunt && HasCondition(followtar)) { //std::time_t time = std::time(nullptr); From 11505574cd4e7acc778891269aa5580e27a2175f Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sun, 24 Jun 2018 21:14:19 +0200 Subject: [PATCH 5/7] improvements tm --- src/hacks/FollowBot.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index a8f02cb6..1a63814a 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -24,7 +24,7 @@ static CatVar draw_crumb(CV_SWITCH, "fb_draw", "1", "Draw crumbs", "Self explanitory"); static CatVar follow_distance(CV_INT, "fb_distance", "175", "Follow Distance", "How close the bots should stay to the target"); -static CatVar follow_activation(CV_INT, "fb_activation", "175", +static CatVar follow_activation(CV_INT, "fb_activation", "1000", "Activation Distance", "How close a player should be until the " "followbot will pick them as a target"); @@ -75,11 +75,11 @@ void checkAFK() continue; if (CE_VECTOR(entity, netvar.vVelocity).IsZero(5.0f)) { - afkticks[i] = afkticks[i] + 1; + afkTicks[i] = afkTicks[i] + 1; } else { - afkticks[i] = 0; + afkTicks[i] = 0; } } } @@ -157,7 +157,7 @@ void WorldTick() continue; if (entity->m_bEnemy()) continue; - if (afk && afkticks[i] >= int(afktime)) //don't follow target that was determined afk + if (afk && afkTicks[i] >= int(afktime)) //don't follow target that was determined afk continue; if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity)) continue; @@ -188,7 +188,7 @@ void WorldTick() continue; // ooooo, a target follow_target = i; - afkticks[i] = 0; //set afk ticks to 0 + afkTicks[i] = 0; //set afk ticks to 0 } } // last check for entity before we continue @@ -208,7 +208,7 @@ void WorldTick() //check if target is afk if (afk) { - if (afkticks[follow_target] >= 990) + if (afkTicks[follow_target] >= int(afktime)) { follow_target = 0; return; @@ -260,7 +260,7 @@ void WorldTick() if (loc_orig.DistTo(breadcrumbs.at(i)) < 60.f) { idle_time.update(); - for (int i2 = 0; i2 <= i; i2++) + for (int j = 0; j <= i; j++) breadcrumbs.erase(breadcrumbs.begin()); } } From f734e4534436446041a3f849ef58948e1632a6b1 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sun, 24 Jun 2018 21:38:59 +0200 Subject: [PATCH 6/7] just use timers tf --- src/hacks/FollowBot.cpp | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 1a63814a..df8e2c2a 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -52,9 +52,9 @@ static CatVar autojump(CV_SWITCH, "fb_autojump", "1", "Autojump", "Automatically jump if stuck"); static CatVar afk(CV_SWITCH, "fb_afk", "1", "Switch target if AFK", "Automatically switch target if the target is afk"); -static CatVar afktime(CV_INT, "fb_afk_time", "990", "Max AFK Time", - "Max ticks (66 * time in seconds) spent standing still " - "until a player is declared afk."); +static CatVar afktime( + CV_INT, "fb_afk_time", "15000", "Max AFK Time", + "Max time in ms spent standing still before player gets declared afk"); // Something to store breadcrumbs created by followed players static std::vector breadcrumbs; @@ -62,9 +62,10 @@ static const int crumb_limit = 64; // limit // Followed entity, externed for highlight color int follow_target = 0; +bool inited; -static long int lasttaunt; //time since epoch when "taunt" was last executed -std::array afkticks; //for how many createmove ticks the player hasn't been moving +Timer lastTaunt{}; //time since taunt was last executed, used to avoid kicks +std::array afkTicks; //for how many ms the player hasn't been moving void checkAFK() { @@ -73,17 +74,22 @@ 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(5.0f)) { - afkTicks[i] = afkTicks[i] + 1; - } - else - { - afkTicks[i] = 0; + afkTicks[i].update(); } } } +void init() +{ + for (int i; i < afkTicks.size(); i++) + { + afkTicks[i].update(); + } + inited = true; +} + void WorldTick() { if (!followbot) @@ -91,6 +97,8 @@ void WorldTick() follow_target = 0; return; } + if (!inited) + init(); // We need a local player to control if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer()) @@ -157,7 +165,7 @@ void WorldTick() continue; if (entity->m_bEnemy()) continue; - if (afk && afkTicks[i] >= int(afktime)) //don't follow target that was determined afk + if (afk && afkTicks[i].check(int(afktime))) //don't follow target that was determined afk continue; if (IsPlayerDisguised(entity) || IsPlayerInvisible(entity)) continue; @@ -188,7 +196,7 @@ void WorldTick() continue; // ooooo, a target follow_target = i; - afkTicks[i] = 0; //set afk ticks to 0 + afkTicks[i].update(); //set afk time to 0 } } // last check for entity before we continue @@ -208,7 +216,7 @@ void WorldTick() //check if target is afk if (afk) { - if (afkTicks[follow_target] >= int(afktime)) + if (afkTicks[follow_target].check(int(afktime))) { follow_target = 0; return; @@ -267,11 +275,8 @@ void WorldTick() //moved because its worthless otherwise if (sync_taunt && HasCondition(followtar)) { - //std::time_t time = std::time(nullptr); - long int t = static_cast (std::time(nullptr)); - if (!(t == lasttaunt)) + if (lastTaunt.test_and_set(1000)) { - lasttaunt = t; g_IEngine->ClientCmd("taunt"); } } From 6f8292ce0a66e0b9e7cb5c6487181c3da616e4f0 Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sun, 24 Jun 2018 21:56:20 +0200 Subject: [PATCH 7/7] fix --- src/hacks/FollowBot.cpp | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index df8e2c2a..fa130ac3 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -10,7 +10,6 @@ #include #include #include -#include namespace hacks::shared::followbot { @@ -233,20 +232,11 @@ void WorldTick() auto tar_orig = followtar->m_vecOrigin(); auto loc_orig = LOCAL_E->m_vecOrigin(); auto dist_to_target = loc_orig.DistTo(tar_orig); - if (roambot) + + if ((dist_to_target < (float) follow_distance) && + VisCheckEntFromEnt(LOCAL_E, followtar)) { - if ((dist_to_target < (float)follow_distance) && VisCheckEntFromEnt(LOCAL_E, followtar)) - { - idle_time.update(); - } - } - else - { - if (dist_to_target < 30) - { - breadcrumbs.clear(); - idle_time.update(); - } + idle_time.update(); } // New crumbs, we add one if its empty so we have something to follow @@ -257,12 +247,6 @@ void WorldTick() // Prune old and close crumbs that we wont need anymore, update idle timer // too - while (breadcrumbs.size() > 1 && loc_orig.DistTo(breadcrumbs.at(0)) < 60.f) - { - idle_time.update(); - breadcrumbs.erase(breadcrumbs.begin()); - } - for (int i = 0; i < breadcrumbs.size(); i++) { if (loc_orig.DistTo(breadcrumbs.at(i)) < 60.f) @@ -274,11 +258,8 @@ void WorldTick() } //moved because its worthless otherwise - if (sync_taunt && HasCondition(followtar)) { - if (lastTaunt.test_and_set(1000)) - { + if (sync_taunt && HasCondition(followtar) && lastTaunt.test_and_set(1000)) { g_IEngine->ClientCmd("taunt"); - } } // Follow the crumbs when too far away, or just starting to follow