Fix problems with targets going out of aimbot range with rapidfire

This commit is contained in:
BenCat07 2021-05-05 17:39:25 +02:00 committed by LightCat
parent fed65faaf8
commit 1e14a64efc
3 changed files with 14 additions and 8 deletions

View File

@ -15,7 +15,7 @@ class IClientEntity;
namespace hacks::shared::aimbot namespace hacks::shared::aimbot
{ {
extern settings::Boolean ignore_cloak; extern settings::Boolean ignore_cloak;
extern unsigned last_target_ignore_timer;
// Used to store aimbot data to prevent calculating it again // Used to store aimbot data to prevent calculating it again
struct AimbotCalculatedData_s struct AimbotCalculatedData_s
{ {

View File

@ -128,6 +128,9 @@ int CurrentX, CurrentY;
float last_mouse_check = 0; float last_mouse_check = 0;
float stop_moving_time = 0; float stop_moving_time = 0;
// Used to make rapidfire not knock your enemies out of range
unsigned last_target_ignore_timer = 0;
int GetSentry() int GetSentry()
{ {
for (int i = 1; i <= HIGHEST_ENTITY; i++) for (int i = 1; i <= HIGHEST_ENTITY; i++)
@ -420,7 +423,7 @@ bool MouseMoving()
if (PreviousX != CurrentX || PreviousY != CurrentY) if (PreviousX != CurrentX || PreviousY != CurrentY)
stop_moving_time = g_GlobalVars->curtime + 0.5; stop_moving_time = g_GlobalVars->curtime + 0.5;
if (g_GlobalVars->curtime <= stop_moving_time) if (g_GlobalVars->curtime <= stop_moving_time)
return true; return true;
else else
@ -587,7 +590,7 @@ bool IsTargetStateGood(CachedEntity *entity)
{ {
if (g_pLocalPlayer->weapon_mode != weapon_melee) if (g_pLocalPlayer->weapon_mode != weapon_melee)
{ {
if (entity->m_flDistance() > EffectiveTargetingRange()) if (entity->m_flDistance() > EffectiveTargetingRange() && tickcount > hacks::shared::aimbot::last_target_ignore_timer)
return false; return false;
} }
else else
@ -739,7 +742,7 @@ bool IsTargetStateGood(CachedEntity *entity)
else if (!IsVectorVisible(pos, entity->hitboxes.GetHitbox(cd.hitbox)->center, false, ENTITY(sentry))) else if (!IsVectorVisible(pos, entity->hitboxes.GetHitbox(cd.hitbox)->center, false, ENTITY(sentry)))
return false; return false;
} }
if (fov > 0.0f && cd.fov > fov) if (fov > 0.0f && cd.fov > fov && tickcount > hacks::shared::aimbot::last_target_ignore_timer)
return false; return false;
return true; return true;
@ -760,7 +763,7 @@ bool IsTargetStateGood(CachedEntity *entity)
// Distance // Distance
if (EffectiveTargetingRange()) if (EffectiveTargetingRange())
{ {
if (entity->m_flDistance() > (int) EffectiveTargetingRange()) if (entity->m_flDistance() > (int) EffectiveTargetingRange() && tickcount > hacks::shared::aimbot::last_target_ignore_timer)
return false; return false;
} }
@ -796,7 +799,7 @@ bool IsTargetStateGood(CachedEntity *entity)
if (!IsVectorVisible(pos, GetBuildingPosition(entity), false, ENTITY(sentry))) if (!IsVectorVisible(pos, GetBuildingPosition(entity), false, ENTITY(sentry)))
return false; return false;
} }
if (fov > 0.0f && cd.fov > fov) if (fov > 0.0f && cd.fov > fov && tickcount > hacks::shared::aimbot::last_target_ignore_timer)
return false; return false;
return true; return true;
@ -819,7 +822,7 @@ bool IsTargetStateGood(CachedEntity *entity)
// Distance // Distance
if (EffectiveTargetingRange()) if (EffectiveTargetingRange())
{ {
if (entity->m_flDistance() > (int) EffectiveTargetingRange()) if (entity->m_flDistance() > (int) EffectiveTargetingRange() && tickcount > hacks::shared::aimbot::last_target_ignore_timer)
return false; return false;
} }
@ -828,7 +831,7 @@ bool IsTargetStateGood(CachedEntity *entity)
if (!VischeckPredictedEntity(entity)) if (!VischeckPredictedEntity(entity))
return false; return false;
if (fov > 0.0f && cd.fov > fov) if (fov > 0.0f && cd.fov > fov && tickcount > hacks::shared::aimbot::last_target_ignore_timer)
return false; return false;
return true; return true;
} }

View File

@ -15,6 +15,7 @@
#include "WeaponData.hpp" #include "WeaponData.hpp"
#include "MiscTemporary.hpp" #include "MiscTemporary.hpp"
#include "Think.hpp" #include "Think.hpp"
#include "Aimbot.hpp"
namespace hacks::tf2::warp namespace hacks::tf2::warp
{ {
@ -357,6 +358,8 @@ void Warp(float accumulated_extra_samples, bool finalTick)
{ {
choke_packet = false; choke_packet = false;
packets_sent = -1; packets_sent = -1;
if (i == calls - 1)
hacks::shared::aimbot::last_target_ignore_timer = tickcount + 5;
} }
else else
hooked_methods::UpdatePred(); hooked_methods::UpdatePred();