Improve the charge mode further
This commit is contained in:
parent
3696e1df75
commit
b9108b2659
6
include/hacks/MiscAimbot.hpp
Normal file
6
include/hacks/MiscAimbot.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
#include "common.hpp"
|
||||
namespace hacks::tf2::misc_aimbot
|
||||
{
|
||||
std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check, float range = 600.0f);
|
||||
}
|
@ -41,5 +41,10 @@ public:
|
||||
static CalculateChargeCap_t CalculateChargeCap_fn = CalculateChargeCap_t(signature);
|
||||
return CalculateChargeCap_fn(self);
|
||||
}
|
||||
// Get Charge meter (for demoknight things)
|
||||
inline static float GetChargeMeter(CTFPlayerShared *self)
|
||||
{
|
||||
return *(float *) (((uintptr_t) self) + 0x204);
|
||||
}
|
||||
};
|
||||
} // namespace re
|
||||
|
@ -142,6 +142,11 @@ mov [esp], ecx
|
||||
DONT_SMASH_SMACK(138);
|
||||
DONT_SMASH_SMACK(154);
|
||||
|
||||
for (auto &i : color_patches)
|
||||
i.Patch();
|
||||
for (auto &i : no_stack_smash)
|
||||
i.Patch();
|
||||
|
||||
EC::Register(
|
||||
EC::Shutdown,
|
||||
[]() {
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "settings/Key.hpp"
|
||||
#include "PlayerTools.hpp"
|
||||
#include "hacks/Trigger.hpp"
|
||||
#include "MiscAimbot.hpp"
|
||||
|
||||
namespace hacks::tf2::misc_aimbot
|
||||
{
|
||||
@ -19,7 +20,7 @@ float sandwich_speed = 350.0f;
|
||||
float grav = 0.25f;
|
||||
int prevent = -1;
|
||||
|
||||
std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check)
|
||||
std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check, float range)
|
||||
{
|
||||
CachedEntity *bestent = nullptr;
|
||||
float bestscr = FLT_MAX;
|
||||
@ -47,8 +48,16 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
|
||||
if (zcheck && (ent->m_vecOrigin().z - LOCAL_E->m_vecOrigin().z) > 80.0f)
|
||||
continue;
|
||||
float scr = ent->m_flDistance();
|
||||
// Demoknight
|
||||
if (fov_check)
|
||||
{
|
||||
if (scr >= range)
|
||||
continue;
|
||||
scr = GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, ent->m_vecOrigin());
|
||||
// Don't turn too harshly
|
||||
if (scr >= 140.0f)
|
||||
continue;
|
||||
}
|
||||
if (g_pPlayerResource->GetClass(ent) == tf_medic)
|
||||
scr *= 0.5f;
|
||||
if (scr < bestscr)
|
||||
@ -82,8 +91,16 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
|
||||
if (zcheck && (ent->m_vecOrigin().z - LOCAL_E->m_vecOrigin().z) > 80.0f)
|
||||
continue;
|
||||
float scr = ent->m_flDistance();
|
||||
// Demoknight
|
||||
if (fov_check)
|
||||
{
|
||||
if (scr >= range)
|
||||
continue;
|
||||
scr = GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, ent->m_vecOrigin());
|
||||
// Don't turn too harshly
|
||||
if (scr >= 140.0f)
|
||||
continue;
|
||||
}
|
||||
if (g_pPlayerResource->GetClass(ent) == tf_medic)
|
||||
scr *= 0.5f;
|
||||
if (scr < bestscr)
|
||||
|
@ -9,6 +9,7 @@
|
||||
#if ENABLE_VISUALS
|
||||
#include "drawing.hpp"
|
||||
#endif
|
||||
#include "MiscAimbot.hpp"
|
||||
|
||||
namespace hacks::tf2::warp
|
||||
{
|
||||
@ -157,6 +158,8 @@ void CreateMove()
|
||||
{
|
||||
if (!enabled)
|
||||
return;
|
||||
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
|
||||
return;
|
||||
warp_override = 0;
|
||||
if (!warp_key.isKeyDown() && !was_hurt)
|
||||
{
|
||||
@ -221,11 +224,33 @@ void CreateMove()
|
||||
{
|
||||
case ATTACK:
|
||||
{
|
||||
// Force a crit
|
||||
criticals::force_crit_this_tick = true;
|
||||
current_user_cmd->buttons |= IN_ATTACK;
|
||||
current_state = CHARGE;
|
||||
should_warp = false;
|
||||
// Get charge meter (0 - 100 range)
|
||||
float charge_meter = re::CTFPlayerShared::GetChargeMeter(re::CTFPlayerShared::GetPlayerShared(RAW_ENT(LOCAL_E)));
|
||||
|
||||
// If our charge meter is full
|
||||
if (charge_meter == 100.0f)
|
||||
{
|
||||
// Shield is 750 HU/s with no acceleration at all, convert to HU/tick
|
||||
float range = 750.0f * g_GlobalVars->interval_per_tick;
|
||||
// Then multiply by our warp ticks to get actual range
|
||||
range *= warp_amount;
|
||||
// Now add a bit of melee range aswell
|
||||
range += 100.0f;
|
||||
|
||||
// Find an entity meeting the shield aim criteria in range
|
||||
std::pair<CachedEntity *, Vector> result = hacks::tf2::misc_aimbot::FindBestEnt(false, false, true, true, range);
|
||||
|
||||
// We found a good entity within range
|
||||
if (result.first)
|
||||
{
|
||||
// Force a crit
|
||||
criticals::force_crit_this_tick = true;
|
||||
current_user_cmd->buttons |= IN_ATTACK;
|
||||
current_state = CHARGE;
|
||||
}
|
||||
}
|
||||
should_warp = false;
|
||||
|
||||
break;
|
||||
}
|
||||
case CHARGE:
|
||||
|
Reference in New Issue
Block a user