Merge pull request #1 from nullworks/master

merge
This commit is contained in:
Cheddar_Cheeze 2018-12-20 20:43:16 -06:00 committed by GitHub
commit cfec5d5d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 573 additions and 665 deletions

View File

@ -25,7 +25,6 @@ set_property(CACHE Game PROPERTY STRINGS ${GameValues})
set(EnableProfiler 0 CACHE BOOL "Enable Profiler")
set(EnableVisuals 1 CACHE BOOL "Enable Visuals")
set(LagbotMode 0 CACHE BOOL "Build light cathook made for lagbots")
set(ExternalDrawing 0 CACHE BOOL "External Visuals")
set(EnableGUI 1 CACHE BOOL "Enable GUI")
set(EnableIPC 1 CACHE BOOL "Enable IPC")

View File

@ -1,8 +1,14 @@
<Tab name="Auto Backstab" padding="4 4 4 4">
<Box padding="6 6 6 6" width="content" height="content">
<List width="170">
<AutoVariable width="fill" target="autobackstab.enable" label="Enable Auto Backstab"/>
<AutoVariable width="fill" target="autobackstab.silent" label="Silent"/>
<AutoVariable width="fill" target="autobackstab.enabled" label="Enable Auto Backstab"/>
<LabeledObject width="fill" label="Autobackstab Mode">
<Select target="autobackstab.mode">
<Option name="Legit" value="0"/>
<Option name="Rage" value="1"/>
<Option name="Backtrack" value="2"/>
</Select>
</LabeledObject>
</List>
</Box>
</Tab>

2
external/chirc vendored

@ -1 +1 @@
Subproject commit 729ade1d523711cc0600f96d712b209425f3d956
Subproject commit 4b51a8b590a8149de24061c21b2c61a78fcb69bd

2
external/libglez vendored

@ -1 +1 @@
Subproject commit dd0158bcb389a5687c16ae8075574db5b7dd1954
Subproject commit ac817c1c55b61387df289773fb3761fee8f462c0

View File

@ -6,7 +6,6 @@
#define GAME_SPECIFIC @GameSpecific@
#define GAME @Game@
#define ENABLE_VISUALS @EnableVisuals@
#define LAGBOT_MODE @LagbotMode@
#define EXTERNAL_DRAWING @ExternalDrawing@
#define ENABLE_GUI @EnableGUI@
#define ENABLE_IPC @EnableIPC@

View File

@ -40,8 +40,7 @@ constexpr bool IsTF()
return IsTF2() || IsTF2C();
}
// This one is supposed to be `if constexpr` but I have to upgrade to gcc7
#define IF_GAME(x) if (x)
#define IF_GAME(x) if constexpr (x)
#else

View File

@ -25,6 +25,7 @@ extern std::mutex command_stack_mutex;
std::stack<std::string> &command_stack();
void ExecuteCommand(const std::string command);
extern bool game_shutdown;
extern bool shutdown;
extern bool initialized;

View File

@ -11,5 +11,4 @@ namespace hacks::tf2::autobackstab
{
void CreateMove();
void Draw();
} // namespace hacks::tf2::autobackstab

View File

@ -16,5 +16,4 @@ void shutdown();
void reload();
extern const std::vector<std::string> builtin_default;
extern const std::vector<std::string> jp_anime;
} // namespace hacks::shared::dominatesay

View File

@ -38,8 +38,6 @@ public:
void Init();
extern std::array<ESPData, 2048> data;
void Draw();
// Entity Processing
void __attribute__((fastcall)) ProcessEntity(CachedEntity *ent);
void __attribute__((fastcall)) ProcessEntityPT(CachedEntity *ent);

View File

@ -1,9 +0,0 @@
#include "common.hpp"
#include <hacks/Aimbot.hpp>
namespace hacks::shared::lightesp
{
#if ENABLE_VISUALS
void draw();
rgba_t LightESPColor(CachedEntity *ent);
#endif
} // namespace hacks::shared::lightesp

View File

@ -12,13 +12,11 @@
#if ENABLE_VISUALS
#include "ESP.hpp"
#include "LightESP.hpp"
#include "SkinChanger.hpp"
#include "Radar.hpp"
#include "SpyAlert.hpp"
#endif
#if not LAGBOT_MODE
#include "Aimbot.hpp"
#include "AntiAim.hpp"
#include "AntiDisguise.hpp"
@ -30,16 +28,12 @@
#include "AutoDeadringer.hpp"
#include "Bunnyhop.hpp"
#include "SeedPrediction.hpp"
#endif
#if ENABLE_VISUALS
#include "Radar.hpp"
#endif
#if not LAGBOT_MODE
#include "Walkbot.hpp"
#include "navparser.hpp"
#endif
#include "AutoJoin.hpp"
#if not LAGBOT_MODE
#include "AntiBackstab.hpp"
#include "AutoBackstab.hpp"
#include "FollowBot.hpp"
@ -49,16 +43,11 @@
#include "DominateSay.hpp"
#include "UberSpam.hpp"
#include "Achievement.hpp"
#endif
#include "Spam.hpp"
#if not LAGBOT_MODE
#include "NavBot.hpp"
#include "Noisemaker.hpp"
#include "FollowBot.hpp"
#include "Announcer.hpp"
#include "Killstreak.hpp"
#endif
#include "CatBot.hpp"
#if not LAGBOT_MODE
#include "Backtrack.hpp"
#endif

View File

@ -104,6 +104,8 @@ void fClampAngle(Vector &qaAng);
// const char* MakeInfoString(IClientEntity* player);
bool GetProjectileData(CachedEntity *weapon, float &speed, float &gravity);
bool IsVectorVisible(Vector a, Vector b, bool enviroment_only = false);
Vector GetForwardVector(Vector origin, Vector viewangles, float distance);
Vector GetForwardVector(float distance);
bool IsSentryBuster(CachedEntity *ent);
std::unique_ptr<char[]> strfmt(const char *fmt, ...);
// TODO move that to weaponid.h

View File

@ -1,111 +1,93 @@
#pragma once
#include <vector>
#include <functional>
#include <string>
#include "core/profiler.hpp"
#include <string>
#include "config.h"
#include "memory"
#include "functional"
#include <set>
class HookedFunction;
namespace HookTools
namespace EC
{
std::vector<HookedFunction *> &GetHookedFunctions();
void CM();
void DRAW();
void PAINT();
} // namespace HookTools
enum HookedFunctions_types
enum ec_types : int8_t
{
// Use CreateMove to run functions that need to run while ingame.
HF_CreateMove = 0,
// Use Draw to draw on screen
HF_Draw,
// Use Paint to run functions everywhere (including main menu)
HF_Paint
CreateMove = 0,
#if ENABLE_VISUALS
Draw,
#endif
Paint,
LevelInit
};
class HookedFunction
enum priority : int8_t
{
std::function<void()> m_func;
int m_priority;
std::string m_name;
#if ENABLE_PROFILER
ProfilerSection section = ProfilerSection("UNNAMED_FUNCTIONS");
#endif
void init(HookedFunctions_types type, std::string name, int priority, std::function<void()> func)
{
switch (type)
{
case HF_CreateMove:
m_name = "CM_";
break;
case HF_Draw:
m_name = "DRAW_";
break;
case HF_Paint:
m_name = "PAINT_";
break;
default:
m_name = "UNDEFINED_";
break;
}
m_name.append(name);
m_priority = priority;
m_func = func;
m_type = type;
#if ENABLE_PROFILER
section.m_name = m_name;
#endif
HookTools::GetHookedFunctions().push_back(this);
}
very_early = -2,
early,
average,
late,
very_late
};
public:
HookedFunctions_types m_type;
bool run(HookedFunctions_types type)
template <ec_types T> struct EventCallbackData
{
explicit EventCallbackData(std::function<void()> function, std::string name, int8_t priority) : function{ function }, priority{ priority }, section{ name }
{
if (m_type == type)
{
#if ENABLE_PROFILER
ProfilerNode node(section);
#endif
m_func();
return true;
}
return false;
}
bool operator>(HookedFunction const &other)
std::function<void()> function;
int8_t priority;
mutable ProfilerSection section;
bool operator<(const EventCallbackData &other) const
{
if (this->m_type < other.m_type)
return true;
return this->m_priority > other.m_priority;
}
HookedFunction(HookedFunctions_types type, std::string name, int priority, std::function<void()> func)
{
init(type, name, priority, func);
}
HookedFunction(HookedFunctions_types type, int priority, std::function<void()> func)
{
static const std::string name("UNNAMED_FUNCTIONS");
init(type, name, priority, func);
}
HookedFunction(HookedFunctions_types type, std::string name, std::function<void()> func)
{
int priority = 5;
init(type, name, priority, func);
}
HookedFunction(HookedFunctions_types type, std::function<void()> func)
{
static const std::string name("UNNAMED_FUNCTIONS");
int priority = 5;
init(type, name, priority, func);
return priority < other.priority;
}
};
// struct CreateMove
//{
// int priority = 0;
// CreateMove(int priority, std::function<void()> func);
// CreateMove(std::function<void()> func);
//};
extern std::multiset<EventCallbackData<CreateMove>> createmoves;
#if ENABLE_VISUALS
extern std::multiset<EventCallbackData<Draw>> draws;
#endif
extern std::multiset<EventCallbackData<Paint>> paints;
extern std::multiset<EventCallbackData<LevelInit>> levelinits;
template <ec_types T> void Register(std::function<void()> function, std::string name, int8_t priority)
{
switch (T)
{
case CreateMove:
{
EventCallbackData<CreateMove> data(function, name, priority);
createmoves.insert(data);
break;
}
#if ENABLE_VISUALS
case Draw:
{
EventCallbackData<Draw> data(function, name, priority);
draws.insert(data);
break;
}
#endif
case Paint:
{
EventCallbackData<Paint> data(function, name, priority);
paints.insert(data);
break;
}
case LevelInit:
{
EventCallbackData<LevelInit> data(function, name, priority);
levelinits.insert(data);
break;
}
default:
throw(std::invalid_argument("Unknown event"));
break;
}
}
void RunCreateMove();
#if ENABLE_VISUALS
void RunDraw();
#endif
void RunPaint();
void RunLevelInit();
} // namespace EC

File diff suppressed because one or more lines are too long

View File

@ -18,14 +18,14 @@ public:
inline static bool DoSwingTrace(IClientEntity *self, trace_t *trace)
{
typedef bool (*fn_t)(IClientEntity *, trace_t *);
return vfunc<fn_t>(self, offsets::PlatformOffset(522, offsets::undefined, 522), 0)(self, trace);
return vfunc<fn_t>(self, offsets::PlatformOffset(523, offsets::undefined, 523), 0)(self, trace);
}
inline static int GetSwingRange(IClientEntity *self)
{
if (self->GetClientClass()->m_ClassID == CL_CLASS(CTFSword) || self->GetClientClass()->m_ClassID == CL_CLASS(CTFKatana))
return 128;
else
return 72;
if (g_pLocalPlayer->holding_sapper)
return 48;
typedef int (*fn_t)(IClientEntity *);
return vfunc<fn_t>(self, offsets::PlatformOffset(521, offsets::undefined, 521), 0)(self);
}
};
} // namespace re

View File

@ -5,8 +5,8 @@
* Author: nullifiedcat
*/
#pragma once
#ifndef CH_TIMER_HPP
#define CH_TIMER_HPP
#include <chrono>
class Timer
@ -37,3 +37,4 @@ public:
public:
std::chrono::time_point<clock> last{};
};
#endif

View File

@ -18,13 +18,16 @@ class EffectChams : public IScreenSpaceEffect
{
public:
virtual void Init();
inline virtual void Shutdown()
virtual void Shutdown()
{
mat_unlit.Shutdown();
mat_unlit_z.Shutdown();
mat_lit.Shutdown();
mat_lit_z.Shutdown();
init = false;
if (init)
{
mat_unlit.Shutdown();
mat_unlit_z.Shutdown();
mat_lit.Shutdown();
mat_lit_z.Shutdown();
init = false;
}
}
inline virtual void SetParameters(KeyValues *params)

View File

@ -17,15 +17,19 @@ class EffectGlow : public IScreenSpaceEffect
{
public:
virtual void Init();
inline virtual void Shutdown()
virtual void Shutdown()
{
mat_unlit.Shutdown();
mat_unlit_z.Shutdown();
mat_blit.Shutdown();
mat_unlit.Shutdown();
mat_unlit_z.Shutdown();
mat_blur_x.Shutdown();
mat_blur_y.Shutdown();
if (init)
{
mat_unlit.Shutdown();
mat_unlit_z.Shutdown();
mat_blit.Shutdown();
mat_unlit.Shutdown();
mat_unlit_z.Shutdown();
mat_blur_x.Shutdown();
mat_blur_y.Shutdown();
init = false;
}
}
inline virtual void SetParameters(KeyValues *params)

View File

@ -5,7 +5,7 @@
* Author: nullifiedcat
*/
#include <core/logging.hpp>
#include "common.hpp"
#include <pthread.h>
#include "hack.hpp"
@ -40,7 +40,7 @@ void *MainThread(void *arg)
logging::Info("Shutting down...");
hack::Shutdown();
logging::Shutdown();
return 0;
return nullptr;
}
void __attribute__((constructor)) attach()
@ -51,9 +51,19 @@ void __attribute__((constructor)) attach()
pthread_create(&thread_main, 0, MainThread, &mutex_quit);
}
void __attribute__((destructor)) detach()
void detach()
{
logging::Info("Detaching");
pthread_mutex_unlock(&mutex_quit);
pthread_join(thread_main, 0);
}
void __attribute__((destructor)) deconstruct()
{
detach();
}
CatCommand cat_detach("detach", "Detach cathook from TF2", []() {
hack::game_shutdown = false;
detach();
});

View File

@ -12,6 +12,7 @@
#include <settings/Bool.hpp>
#include "common.hpp"
#include "hack.hpp"
settings::Bool log_to_console{ "hack.log-console", "false" };
@ -45,7 +46,7 @@ void logging::Info(const char *fmt, ...)
fprintf(logging::handle, "%s", result);
fflush(logging::handle);
#if ENABLE_VISUALS
if (g_ICvar)
if (!hack::game_shutdown && g_ICvar)
{
if (*log_to_console)
g_ICvar->ConsolePrintf("%s", result);

View File

@ -32,6 +32,8 @@
* Linux
*/
// game_shutdown = Is full game shutdown or just detach
bool hack::game_shutdown = true;
bool hack::shutdown = false;
bool hack::initialized = false;
@ -289,13 +291,11 @@ free(logname);*/
// hooks::materialsystem.HookMethod();
}
#endif
#if not LAGBOT_MODE
// FIXME [MP]
hacks::shared::killsay::init();
hacks::shared::dominatesay::init();
hacks::shared::announcer::init();
hacks::tf2::killstreak::init();
#endif
hacks::shared::catbot::init();
logging::Info("Hooked!");
velocity::Init();
@ -309,7 +309,6 @@ free(logname);*/
{
effect_chams::g_pEffectChams = new CScreenSpaceEffectRegistration("_cathook_chams", &effect_chams::g_EffectChams);
g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_chams");
effect_chams::g_EffectChams.Init();
effect_glow::g_pEffectGlow = new CScreenSpaceEffectRegistration("_cathook_glow", &effect_glow::g_EffectGlow);
g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_glow");
}
@ -319,9 +318,7 @@ free(logname);*/
logging::Info("SDL hooking done");
#endif /* TEXTMODE */
#if not LAGBOT_MODE
hacks::shared::anticheat::Init();
#endif
#if ENABLE_VISUALS
#ifndef FEATURE_FIDGET_SPINNER_ENABLED
InitSpinner();
@ -329,9 +326,7 @@ free(logname);*/
#endif
hacks::shared::spam::init();
#endif
#if not LAGBOT_MODE
hacks::shared::walkbot::Initialize();
#endif
#if ENABLE_VISUALS
hacks::shared::esp::Init();
#endif
@ -374,17 +369,24 @@ void hack::Shutdown()
if (hack::shutdown)
return;
hack::shutdown = true;
// Stop cathook stuff
settings::RVarLock.store(true);
playerlist::Save();
#if ENABLE_VISUALS
sdl_hooks::cleanSdlHooks();
#endif
logging::Info("Unregistering convars..");
ConVar_Unregister();
#if not LAGBOT_MODE
logging::Info("Shutting down killsay...");
hacks::shared::killsay::shutdown();
hacks::shared::dominatesay::shutdown();
hacks::shared::announcer::shutdown();
if (!hack::game_shutdown)
{
hacks::shared::killsay::shutdown();
hacks::shared::dominatesay::shutdown();
hacks::shared::announcer::shutdown();
#if ENABLE_VISUALS
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_glow");
g_pScreenSpaceEffects->DisableScreenSpaceEffect("_cathook_chams");
#endif
}
logging::Info("Success..");
}

View File

@ -5,82 +5,30 @@
* Author: nullifiedcat
*/
#include <settings/Bool.hpp>
#include "common.hpp"
#include "hacks/Backtrack.hpp"
#include "hacks/Aimbot.hpp"
#include "hacks/Trigger.hpp"
#include "hacks/AntiAntiAim.hpp"
#include "PlayerTools.hpp"
#include "Trigger.hpp"
#include "Backtrack.hpp"
namespace hacks::tf2::autobackstab
{
namespace backtrack = hacks::shared::backtrack;
static settings::Bool enable{ "autobackstab.enable", "0" };
static settings::Bool silent{ "autobackstab.silent", "1" };
void testingFunc();
static settings::Bool enabled("autobackstab.enabled", "false");
static settings::Int mode("autobackstab.mode", "0");
// Not required anymore, keeping for future reference
Vector rotateVector(Vector center, float radianAngle, Vector p)
static bool angleCheck(CachedEntity *target, std::optional<Vector> target_pos, Vector local_angle)
{
float s = sin(radianAngle);
float c = cos(radianAngle);
Vector tarAngle = CE_VECTOR(target, netvar.m_angEyeAngles);
// translate point back to origin:
p.x -= center.x;
p.y -= center.y;
// rotate point
// float xnew = p.x * c - p.y * s;
// float ynew = p.x * s + p.y * c;
Vector vecNew{ p.x * c - p.y * s, p.x * s + p.y * c, 0 };
// translate point back:
p.x = vecNew.x + center.x;
p.y = vecNew.y + center.y;
return p;
}
// Function to find the closest hitbox to the v_Eye for a given ent
int ClosestDistanceHitbox(CachedEntity *target, backtrack::BacktrackData btd = {})
{
int closest = -1;
float closest_dist = 0.0f, dist = 0.0f;
for (int i = pelvis; i < lowerArm_R; i++)
{
if (hacks::shared::backtrack::isBacktrackEnabled)
dist = g_pLocalPlayer->v_Eye.DistTo(btd.hitboxes.at(i).center);
else
dist = g_pLocalPlayer->v_Eye.DistTo(target->hitboxes.GetHitbox(i)->center);
if (dist < closest_dist || closest == -1)
{
closest = i;
closest_dist = dist;
}
}
return closest;
}
bool unifiedCanBackstab(CachedEntity *tar, Vector &vecAngle, Vector targetOrigin, Vector min, Vector max)
{
// Get melee range
float meleeRange = re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W));
Vector tarAngle = CE_VECTOR(tar, netvar.m_angEyeAngles);
Vector head = g_pLocalPlayer->v_Eye;
// Check if we are in range. Note: This has to be done in order to avoid
// false positives even when "forward" is only "meleeRange" away from the
// head.
if (head.DistTo((min + max) / 2) > meleeRange)
return false;
Vector wsc_spy_to_victim = (targetOrigin - LOCAL_E->m_vecOrigin());
wsc_spy_to_victim.z = 0;
Vector wsc_spy_to_victim;
if (target_pos)
wsc_spy_to_victim = *target_pos - LOCAL_E->m_vecOrigin();
else
wsc_spy_to_victim = target->m_vecOrigin() - LOCAL_E->m_vecOrigin();
wsc_spy_to_victim.z = 0;
wsc_spy_to_victim.NormalizeInPlace();
Vector eye_spy;
AngleVectors2(VectorToQAngle(vecAngle), &eye_spy);
AngleVectors2(VectorToQAngle(local_angle), &eye_spy);
eye_spy.z = 0;
eye_spy.NormalizeInPlace();
@ -89,19 +37,6 @@ bool unifiedCanBackstab(CachedEntity *tar, Vector &vecAngle, Vector targetOrigin
eye_victim.z = 0;
eye_victim.NormalizeInPlace();
// Get the min and max for the hitbox
Vector minz(fminf(min.x, max.x), fminf(min.y, max.y), fminf(min.z, max.z));
Vector maxz(fmaxf(min.x, max.x), fmaxf(min.y, max.y), fmaxf(min.z, max.z));
Vector forward;
AngleVectors2(VectorToQAngle(vecAngle), &forward);
forward = forward * meleeRange + head;
Vector hit;
// Check if we our line is within the targets hitbox
if (!hacks::shared::triggerbot::CheckLineBox(minz, maxz, head, forward, hit))
return false;
if (DotProduct(wsc_spy_to_victim, eye_victim) <= 0.0f)
return false;
if (DotProduct(wsc_spy_to_victim, eye_spy) <= 0.5f)
@ -111,227 +46,103 @@ bool unifiedCanBackstab(CachedEntity *tar, Vector &vecAngle, Vector targetOrigin
return true;
}
void CreateMove()
static void doLegitBackstab()
{
// testingFunc();
if (!enable)
trace_t trace;
if (!re::C_TFWeaponBaseMelee::DoSwingTrace(RAW_ENT(LOCAL_W), &trace))
return;
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W) || !LOCAL_E->m_bAlivePlayer())
if (!trace.m_pEnt)
return;
if (g_pLocalPlayer->weapon()->m_iClassID() != CL_CLASS(CTFKnife))
int index = reinterpret_cast<IClientEntity *>(trace.m_pEnt)->entindex();
auto ent = ENTITY(index);
if (index == 0 || index > g_IEngine->GetMaxClients() || !ent->m_bEnemy() || player_tools::shouldTarget(ent) != player_tools::IgnoreReason::DO_NOT_IGNORE)
return;
if (!CanShoot())
return;
CachedEntity *besttarget = nullptr;
if (!backtrack::isBacktrackEnabled)
if (angleCheck(ENTITY(index), std::nullopt, g_pLocalPlayer->v_OrigViewangles))
{
for (int i = 0; i < g_IEngine->GetMaxClients(); i++)
{
CachedEntity *target = ENTITY(i);
if (CE_BAD(target))
continue;
if (target == LOCAL_E || target->m_iTeam() == LOCAL_E->m_iTeam() || !target->m_bAlivePlayer() || target->m_Type() != ENTITY_PLAYER)
continue;
if (player_tools::shouldTarget(target) != player_tools::IgnoreReason::DO_NOT_IGNORE)
continue;
if (target->hitboxes.GetHitbox(spine_3)->center.DistTo(g_pLocalPlayer->v_Eye) <= 200.0f)
{
if (CE_GOOD(besttarget))
{
if (target->hitboxes.GetHitbox(spine_3)->center.DistTo(g_pLocalPlayer->v_Eye) < besttarget->hitboxes.GetHitbox(spine_3)->center.DistTo(g_pLocalPlayer->v_Eye))
besttarget = target;
}
else
{
besttarget = target;
}
}
}
}
else
{
// Run if backtrack is enabled
if (backtrack::iBestTarget == -1)
return;
CachedEntity *target = ENTITY(backtrack::iBestTarget);
// Various valid entity checks
if (CE_BAD(target))
return;
if (target == LOCAL_E || target->m_iTeam() == LOCAL_E->m_iTeam() || !target->m_bAlivePlayer() || target->m_Type() != ENTITY_PLAYER)
return;
if (player_tools::shouldTarget(target) != player_tools::IgnoreReason::DO_NOT_IGNORE)
return;
// Check if besttick distance is < 200.0f
if (backtrack::headPositions[target->m_IDX][backtrack::BestTick].hitboxes.at(spine_3).center.DistTo(g_pLocalPlayer->v_Eye) < 200.0f)
besttarget = target;
current_user_cmd->buttons |= IN_ATTACK;
}
}
if (CE_GOOD(besttarget))
static void doRageBackstab()
{
float swingrange = re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W));
Vector newangle = g_pLocalPlayer->v_OrigViewangles;
for (newangle.y = -180.0f; newangle.y < 180.0f; newangle.y += 10.0f)
{
hacks::shared::anti_anti_aim::resolveEnt(besttarget->m_IDX);
Vector angle = NET_VECTOR(RAW_ENT(LOCAL_E), 4104);
if (!backtrack::isBacktrackEnabled)
trace_t trace;
Ray_t ray;
trace::filter_default.SetSelf(RAW_ENT(g_pLocalPlayer->entity));
ray.Init(g_pLocalPlayer->v_Eye, GetForwardVector(g_pLocalPlayer->v_Eye, newangle, swingrange));
g_ITrace->TraceRay(ray, MASK_SHOT_HULL, &trace::filter_default, &trace);
if (trace.m_pEnt)
{
IClientEntity *raw = RAW_ENT(besttarget);
Vector origin = besttarget->m_vecOrigin();
Vector min = raw->GetCollideable()->OBBMins() + origin;
Vector max = raw->GetCollideable()->OBBMaxs() + origin;
for (angle.y = -180.0f; angle.y < 180.0f; angle.y += 10.0f)
int index = reinterpret_cast<IClientEntity *>(trace.m_pEnt)->entindex();
auto ent = ENTITY(index);
if (index == 0 || index > g_IEngine->GetMaxClients() || !ent->m_bEnemy() || player_tools::shouldTarget(ent) != player_tools::IgnoreReason::DO_NOT_IGNORE)
continue;
if (angleCheck(ent, std::nullopt, newangle))
{
if (!unifiedCanBackstab(besttarget, angle, origin, min, max))
continue;
current_user_cmd->viewangles = angle;
current_user_cmd->buttons |= IN_ATTACK;
besttarget = nullptr;
if (silent)
g_pLocalPlayer->bUseSilentAngles = true;
current_user_cmd->viewangles = newangle;
g_pLocalPlayer->bUseSilentAngles = true;
return;
}
}
else
{
int idx = besttarget->m_IDX;
for (int j = 0; j < 66; j++)
{
auto i = backtrack::headPositions[idx][j];
if (!backtrack::ValidTick(i, besttarget))
continue;
for (angle.y = -180.0f; angle.y < 180.0f; angle.y += 20.0f)
{
if (unifiedCanBackstab(besttarget, angle, i.entorigin, i.collidable.min, i.collidable.max))
{
current_user_cmd->tick_count = i.tickcount;
current_user_cmd->viewangles = angle;
current_user_cmd->buttons |= IN_ATTACK;
if (silent)
g_pLocalPlayer->bUseSilentAngles = true;
return;
}
}
}
}
}
}
const Vector GetWorldSpaceCenter(CachedEntity *ent)
static void doBacktrackStab()
{
Vector vMin, vMax;
RAW_ENT(ent)->GetRenderBounds(vMin, vMax);
Vector vWorldSpaceCenter = RAW_ENT(ent)->GetAbsOrigin();
vWorldSpaceCenter.z += (vMin.z + vMax.z) / 2;
return vWorldSpaceCenter;
}
static bool InBackstabAngleRange = false;
static bool LookingAtVic = false;
static bool IsBehind = false;
void Draw()
{
// if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W) || !LOCAL_E->m_bAlivePlayer())
// return;
// if (g_pLocalPlayer->weapon()->m_iClassID() != CL_CLASS(CTFKnife))
// return;
// CachedEntity *besttarget = nullptr;
// for (int i = 0; i < g_IEngine->GetMaxClients(); i++)
// {
// CachedEntity *target = ENTITY(i);
// if (CE_BAD(target))
// continue;
// if (target == LOCAL_E || target->m_iTeam() ==
// LOCAL_E->m_iTeam() ||
// !target->m_bAlivePlayer() || target->m_Type() !=
// ENTITY_PLAYER) continue;
// if (target->m_vecOrigin().DistTo(
// g_pLocalPlayer->v_Eye) <= 200.0f)
// {
// if (CE_GOOD(besttarget))
// {
// if (besttarget->m_vecOrigin().DistTo(
// g_pLocalPlayer->v_Eye) <
// besttarget->m_vecOrigin().DistTo(
// g_pLocalPlayer->v_Eye))
// besttarget = target;
// }
// else
// {
// besttarget = target;
// }
// }
// }
// if (CE_BAD(besttarget))
// return;
// Vector angle = NET_VECTOR(RAW_ENT(LOCAL_E), netvar.m_angEyeAngles);
// Vector tarAngle = NET_VECTOR(RAW_ENT(besttarget),
// netvar.m_angEyeAngles);
// //bool IsBehind = dot1 <= 0.0f;
// bool LookingAtVic = GetFov(angle, g_pLocalPlayer->v_Eye,
// GetWorldSpaceCenter(besttarget)) <= 60.0f; bool InBackstabAngleRange =
// fabsf(tarAngle.y - angle.y) <= 107.5f;
// rgba_t col1 = IsBehind ? colors::green : colors::red;
// rgba_t col2 = LookingAtVic ? colors::green : colors::red;
// rgba_t col3 = InBackstabAngleRange ? colors::green : colors::red;
// AddCenterString(format("Behind target" /*, dot1*/), col1);
// AddCenterString(format("Looking at Target" /*, dot2*/), col2);
// AddCenterString(format("In Angle Range" /*, dot3*/), col3);
}
void testingFunc()
{
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W) || !LOCAL_E->m_bAlivePlayer())
float swingrange = re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W));
CachedEntity *ent;
try {
ent = ENTITY(hacks::shared::backtrack::iBestTarget);
} catch (std::out_of_range) {
return;
if (g_pLocalPlayer->weapon()->m_iClassID() != CL_CLASS(CTFKnife))
}
if (!ent->m_bEnemy() || player_tools::shouldTarget(ent) != player_tools::IgnoreReason::DO_NOT_IGNORE)
return;
CachedEntity *besttarget = nullptr;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++)
auto &btd = hacks::shared::backtrack::headPositions[ent->m_IDX];
for (auto &i : btd)
{
CachedEntity *target = ENTITY(i);
if (CE_BAD(target))
if (!hacks::shared::backtrack::ValidTick(i, ent))
continue;
if (target == LOCAL_E || target->m_iTeam() == LOCAL_E->m_iTeam() || !target->m_bAlivePlayer() || target->m_Type() != ENTITY_PLAYER)
continue;
if (target->m_vecOrigin().DistTo(g_pLocalPlayer->v_Eye) <= 200.0f)
Vector angle = GetAimAtAngles(g_pLocalPlayer->v_Eye, i.hitboxes[spine_1].center);
if (!angleCheck(ent, i.entorigin, angle))
return;
Vector hit;
if (hacks::shared::triggerbot::CheckLineBox(i.collidable.min, i.collidable.max, g_pLocalPlayer->v_Eye, GetForwardVector(g_pLocalPlayer->v_Eye, angle, swingrange), hit))
{
if (CE_GOOD(besttarget))
{
if (target->m_vecOrigin().DistTo(g_pLocalPlayer->v_Eye) < besttarget->m_vecOrigin().DistTo(g_pLocalPlayer->v_Eye))
besttarget = target;
}
else
{
besttarget = target;
}
current_user_cmd->tick_count = i.tickcount;
current_user_cmd->viewangles = angle;
current_user_cmd->buttons |= IN_ATTACK;
g_pLocalPlayer->bUseSilentAngles = true;
}
}
if (CE_BAD(besttarget))
return;
Vector angle = NET_VECTOR(RAW_ENT(LOCAL_E), 4104);
Vector tarAngle = NET_VECTOR(RAW_ENT(besttarget), netvar.m_angEyeAngles);
logging::Info("Loc: %f; Tar: %f", angle.y, tarAngle.y);
Vector wsc_spy_to_victim = (besttarget->m_vecOrigin() - LOCAL_E->m_vecOrigin());
wsc_spy_to_victim.z = 0;
wsc_spy_to_victim.NormalizeInPlace();
Vector eye_spy;
AngleVectors2(VectorToQAngle(angle), &eye_spy);
eye_spy.z = 0;
eye_spy.NormalizeInPlace();
Vector eye_victim;
AngleVectors2(VectorToQAngle(tarAngle), &eye_victim);
eye_victim.z = 0;
eye_victim.NormalizeInPlace();
IsBehind = DotProduct(wsc_spy_to_victim, eye_victim) <= 0.0f;
LookingAtVic = DotProduct(wsc_spy_to_victim, eye_spy) <= 0.5f;
InBackstabAngleRange = DotProduct(eye_spy, eye_victim) <= -0.3f;
}
void CreateMove()
{
if (!enabled)
return;
if (CE_BAD(LOCAL_E) || g_pLocalPlayer->life_state || g_pLocalPlayer->clazz != tf_spy || CE_BAD(LOCAL_W) || GetWeaponMode() != weapon_melee || !CanShoot())
return;
switch (*mode)
{
case 0:
doLegitBackstab();
break;
case 1:
doRageBackstab();
break;
case 2:
if (hacks::shared::backtrack::isBacktrackEnabled)
doBacktrackStab();
default:
break;
}
}
} // namespace hacks::tf2::autobackstab

View File

@ -148,8 +148,8 @@ void updateSearch()
}
#endif
}
static HookedFunction update(HookedFunctions_types::HF_CreateMove, "Autojoin", 1, []() {
#if !LAGBOT_MODE
static void update()
{
if (autoteam_timer.test_and_set(500))
{
if (autojoin_team and UnassignedTeam())
@ -162,12 +162,13 @@ static HookedFunction update(HookedFunctions_types::HF_CreateMove, "Autojoin", 1
g_IEngine->ExecuteClientCmd(format("join_class ", classnames[int(autojoin_class) - 1]).c_str());
}
}
#endif
});
}
void onShutdown()
{
if (auto_queue)
tfmm::startQueue();
}
static InitRoutine init([]() { EC::Register<EC::CreateMove>(update, "cm_autojoin", EC::average); });
} // namespace hacks::shared::autojoin

View File

@ -3,7 +3,6 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/CatBot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SeedPrediction.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Spam.cpp")
if(NOT LagbotMode)
target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Achievement.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Aimbot.cpp"
@ -37,7 +36,6 @@ if(NOT LagbotMode)
"${CMAKE_CURRENT_LIST_DIR}/Walkbot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Radar.cpp")
add_subdirectory(ac)
endif()
if(EnableVisuals)
target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/ESP.cpp"

View File

@ -177,14 +177,21 @@ Timer level_init_timer{};
Timer micspam_on_timer{};
Timer micspam_off_timer{};
static bool patched_report;
void reportall()
{
typedef uint64_t (*ReportPlayer_t)(uint64_t, int);
static uintptr_t addr2 = gSignatures.GetClientSignature("55 89 E5 57 56 53 81 EC ? ? ? ? 8B 5D ? 8B 7D ? 89 D8");
ReportPlayer_t ReportPlayer_fn = ReportPlayer_t(addr2);
static ReportPlayer_t ReportPlayer_fn = ReportPlayer_t(addr2);
if (!addr2)
return;
if (!patched_report)
{
static uintptr_t addr2 = gSignatures.GetClientSignature("73 ? 80 7D ? ? 74 ? F3 0F 10 0D") +0x2F;
static unsigned char patch[] = { 0x89, 0xe0 };
Patch((void *)addr2, (void *)patch, sizeof(patch));
patched_report = true;
}
player_info_s local;
g_IEngine->GetPlayerInfo(g_pLocalPlayer->entity_idx, &local);
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
@ -257,8 +264,9 @@ void smart_crouch()
}
CatCommand print_ammo("debug_print_ammo", "debug", []() {
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
logging::Info("Current slot: %d", re::C_BaseCombatWeapon::GetSlot(RAW_ENT(LOCAL_W)));
for (int i = 0; i < 10; i++)
logging::Info("Ammo Table %d: %d", i, CE_INT(LOCAL_E, netvar.m_iAmmo + i * 4));
});
@ -267,17 +275,24 @@ static Timer report_timer{};
static std::string health = "Health: 0/0";
static std::string ammo = "Ammo: 0/0";
static int max_ammo;
static CachedEntity *local_w;
// TODO: add more stuffs
static HookedFunction cm(HF_CreateMove, "catbot", 5, []() {
static void cm()
{
if (!*catbotmode)
return;
if (CE_GOOD(LOCAL_E))
{
if (LOCAL_W != local_w)
{
local_w = LOCAL_W;
max_ammo = 0;
}
float max_hp = g_pPlayerResource->GetMaxHealth(LOCAL_E);
float curr_hp = CE_INT(LOCAL_E, netvar.iHealth);
int ammo0 = CE_INT(LOCAL_E, netvar.m_iAmmo + 4);
int ammo2 = CE_INT(LOCAL_E, netvar.m_iAmmo + 8);
int ammo0 = CE_INT(LOCAL_E, netvar.m_iClip2);
int ammo2 = CE_INT(LOCAL_E, netvar.m_iClip1);
if (ammo0 + ammo2 > max_ammo)
max_ammo = ammo0 + ammo2;
health = format("Health: ", curr_hp, "/", max_hp);
@ -302,7 +317,7 @@ static HookedFunction cm(HF_CreateMove, "catbot", 5, []() {
}
if (*autoReport && report_timer.test_and_set(60000))
reportall();
});
}
static Timer autojointeam{};
void update()
@ -420,13 +435,21 @@ void level_init()
}
#if ENABLE_VISUALS
static HookedFunction Paint(HookedFunctions_types::HF_Draw, "anti_motd_info", 3, []() {
static void draw()
{
if (!catbotmode || !anti_motd)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
return;
AddCenterString(health, colors::green);
AddCenterString(ammo, colors::yellow);
});
}
#endif
static InitRoutine runinit([]() {
EC::Register<EC::CreateMove>(cm, "cm_catbot", EC::average);
#if ENABLE_VISUALS
EC::Register<EC::Draw>(cm, "draw_catbot", EC::average);
#endif
});
} // namespace hacks::shared::catbot

View File

@ -35,9 +35,6 @@ std::string ComposeDominateSay(IGameEvent *event)
case 2:
source = &builtin_default;
break;
case 3:
source = &jp_anime;
break;
default:
break;
}
@ -115,17 +112,4 @@ const std::vector<std::string> builtin_default = {
"%killer% is dominating the server with %dominum% dominations!",
};
// same goes to this one
const std::vector<std::string> jp_anime = {
"Get d-dominated %name%-senpai >:3",
"g- gomenasai! %name%-san!",
"Wow! hey hey hey H~ ey !!! I found you again~~!",
"%name%-san please don't get mad at me.. ><",
// https://youtu.be/sW3RT0tF020?t=207
"kore kara mo douzo yoroshiku ne.",
"konna watashi dakedo waratte yurushite ne.",
"zutto taisetsu ni shite ne.",
"eikyuu hoshou no watashi dakara.",
};
} // namespace hacks::shared::dominatesay

View File

@ -219,7 +219,7 @@ struct bonelist_s
std::unordered_map<studiohdr_t *, bonelist_s> bonelist_map{};
// Function called on draw
void Draw()
static void Draw()
{
if (!enable)
return;
@ -234,7 +234,7 @@ void Draw()
}
// Function called on create move
static HookedFunction CreateMove(HookedFunctions_types::HF_CreateMove, "ESP", 18, []() {
static void cm() {
// Check usersettings if enabled
if (!*enable)
return;
@ -288,7 +288,7 @@ static HookedFunction CreateMove(HookedFunctions_types::HF_CreateMove, "ESP", 18
}
}
}
});
}
static glez::texture atlas{ DATA_PATH "/textures/atlas.png" };
static glez::texture idspec{ DATA_PATH "/textures/idspec.png" };
@ -1443,4 +1443,11 @@ void SetEntityColor(CachedEntity *entity, const rgba_t &color)
return;
data[entity->m_IDX].color = color;
}
static InitRoutine init([](){
EC::Register<EC::CreateMove>(cm, "cm_esp", EC::average);
EC::Register<EC::Draw>(Draw, "draw_esp", EC::average);
});
} // namespace hacks::shared::esp

View File

@ -188,7 +188,7 @@ Timer waittime{};
int lastent = 0;
#if ENABLE_IPC
static HookedFunction WorldTick(HookedFunctions_types::HF_CreateMove, "followbot", 20, []() {
static void cm() {
if (!enable)
{
follow_target = 0;
@ -555,11 +555,11 @@ static HookedFunction WorldTick(HookedFunctions_types::HF_CreateMove, "followbot
}
else
idle_time.update();
});
}
#endif
#if ENABLE_VISUALS
static HookedFunction func(HF_Draw, "followbot", 10, []() {
static void draw() {
if (!enable || !draw_crumb)
return;
if (breadcrumbs.size() < 2)
@ -577,9 +577,19 @@ static HookedFunction func(HF_Draw, "followbot", 10, []() {
return;
glez::draw::rect(wts.x - 4, wts.y - 4, 8, 8, colors::white);
glez::draw::rect_outline(wts.x - 4, wts.y - 4, 7, 7, colors::white, 1.0f);
});
}
#endif
static InitRoutine runinit([](){
#if ENABLE_IPC
EC::Register<EC::CreateMove>(cm, "cm_followbot", EC::average);
#endif
#if ENABLE_VISUALS
EC::Register<EC::Draw>(cm, "draw_followbot", EC::average);
#endif
});
int getTarget()
{
return follow_target;

View File

@ -104,7 +104,7 @@ class KillSayEventListener : public IGameEventListener2
}
};
static HookedFunction ProcessKillsay(HookedFunctions_types::HF_Paint, "KillSay_send", 1, []() {
static void ProcessKillsay() {
if (killsay_storage.empty())
return;
for (auto &i : killsay_storage)
@ -117,6 +117,10 @@ static HookedFunction ProcessKillsay(HookedFunctions_types::HF_Paint, "KillSay_s
i.second = {};
}
}
}
static InitRoutine runinit([](){
EC::Register<EC::Paint>(ProcessKillsay, "paint_killsay", EC::average);
});
static KillSayEventListener listener{};

View File

@ -1,21 +1,28 @@
#include "hacks/LightESP.hpp"
#include "config.h"
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <settings/Bool.hpp>
#include "common.hpp"
#include "glez/draw.hpp"
static settings::Bool enable{ "lightesp.enable", "false" };
namespace hacks::shared::lightesp
{
Vector hitp[32];
Vector minp[32];
Vector maxp[32];
bool drawEsp[32];
static Vector hitp[32];
static Vector minp[32];
static Vector maxp[32];
static bool drawEsp[32];
#if ENABLE_VISUALS
static HookedFunction cm(HF_CreateMove, "lightesp", 5, []() {
rgba_t LightESPColor(CachedEntity *ent)
{
if (!playerlist::IsDefault(ent))
{
return playerlist::Color(ent);
}
return colors::green;
}
static void cm() {
if (!*enable)
return;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
@ -40,12 +47,10 @@ static HookedFunction cm(HF_CreateMove, "lightesp", 5, []() {
maxp[i] = pEntity->hitboxes.GetHitbox(0)->max;
drawEsp[i] = true;
}
});
#endif
}
void draw()
{
#if ENABLE_VISUALS
if (!enable)
return;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
@ -72,16 +77,12 @@ void draw()
glez::draw::rect(out.x - size / 8, out.y - size / 8, size / 4, size / 4, colors::red);
}
}
#endif
}
#if ENABLE_VISUALS
rgba_t LightESPColor(CachedEntity *ent)
{
if (!playerlist::IsDefault(ent))
{
return playerlist::Color(ent);
}
return colors::green;
}
#endif
static InitRoutine init([](){
EC::Register<EC::CreateMove>(cm, "cm_lightesp", EC::average);
EC::Register<EC::Draw>(draw, "draw_lightesp", EC::average);
});
} // namespace hacks::shared::lightesp
#endif

View File

@ -131,7 +131,6 @@ InitRoutine init([]() { teammatesPushaway = g_ICvar->FindVar("tf_avoidteammates_
void CreateMove()
{
#if !LAGBOT_MODE
if (current_user_cmd->command_number)
last_number = current_user_cmd->command_number;
@ -225,7 +224,6 @@ void CreateMove()
if (*nopush_enabled == teammatesPushaway->GetBool())
teammatesPushaway->SetValue(!nopush_enabled);
}
#endif
}
#if ENABLE_VISUALS

View File

@ -146,7 +146,7 @@ void DoSlowAim(Vector &input_angle)
fClampAngle(input_angle);
}
static HookedFunction SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 5, []() {
static void SandwichAim() {
if (!*sandwichaim_enabled)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
@ -186,11 +186,11 @@ static HookedFunction SandwichAim(HookedFunctions_types::HF_CreateMove, "Sandwic
current_user_cmd->buttons |= IN_ATTACK2;
g_pLocalPlayer->bUseSilentAngles = true;
}
});
}
static bool charge_aimbotted = false;
static settings::Bool charge_aim{ "chargeaim.enable", "false" };
static settings::Button charge_key{ "chargeaim.key", "<null>" };
static HookedFunction ChargeAimbot(HookedFunctions_types::HF_CreateMove, "ChargeAim", 2, []() {
static void ChargeAimbot() {
charge_aimbotted = false;
if (!*charge_aim)
return;
@ -214,11 +214,11 @@ static HookedFunction ChargeAimbot(HookedFunctions_types::HF_CreateMove, "Charge
current_user_cmd->viewangles = angles;
charge_aimbotted = true;
}
});
}
static settings::Bool charge_control{ "chargecontrol.enable", "false" };
static settings::Float charge_float{ "chargecontrol.strength", "3.0f" };
static HookedFunction ChargeControl(HookedFunctions_types::HF_CreateMove, "chargecontrol", 5, []() {
static void ChargeControl() {
if (!*charge_control || charge_aimbotted)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
@ -231,12 +231,12 @@ static HookedFunction ChargeControl(HookedFunctions_types::HF_CreateMove, "charg
if (current_user_cmd->buttons & IN_MOVERIGHT)
offset = -*charge_float;
current_user_cmd->viewangles.y += offset;
});
}
static settings::Bool autosapper_enabled("autosapper.enabled", "false");
static settings::Bool autosapper_silent("autosapper.silent", "true");
static HookedFunction SapperAimbot(HF_CreateMove, "sapperaimbot", 5, []() {
static void SapperAimbot() {
if (!autosapper_enabled)
return;
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W) || !g_pLocalPlayer->holding_sapper)
@ -272,4 +272,13 @@ static HookedFunction SapperAimbot(HF_CreateMove, "sapperaimbot", 5, []() {
g_pLocalPlayer->bUseSilentAngles = true;
current_user_cmd->buttons |= IN_ATTACK;
}
});
}
static void CreateMove(){
SandwichAim();
ChargeAimbot();
ChargeControl();
SapperAimbot();
}
static InitRoutine init([](){EC::Register<EC::CreateMove>(CreateMove, "cm_miscaimbot", EC::late);});

View File

@ -390,10 +390,43 @@ static void autoJump()
current_user_cmd->buttons |= IN_JUMP;
}
enum slots
{
primary = 1,
secondary = 2,
melee = 3
};
static int GetBestSlot()
{
switch (g_pLocalPlayer->clazz)
{
case tf_scout:
{
float nearest_dist = getNearestPlayerDistance().second;
if (nearest_dist < 1000)
return primary;
else
return secondary;
}
case tf_heavy:
return primary;
default:
{
float nearest_dist = getNearestPlayerDistance().second;
if (nearest_dist > 400)
return primary;
else
return secondary;
}
}
return primary;
}
static void updateSlot()
{
static Timer slot_timer{};
if (!slot_timer.test_and_set(1000))
if (!slot_timer.test_and_set(300))
return;
if (CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && !g_pLocalPlayer->life_state)
{
@ -402,14 +435,16 @@ static void updateSlot()
if (re::C_BaseCombatWeapon::IsBaseCombatWeapon(weapon))
{
int slot = re::C_BaseCombatWeapon::GetSlot(weapon);
int newslot = 1;
int newslot = GetBestSlot();
if (slot != newslot - 1)
g_IEngine->ClientCmd_Unrestricted(format("slot", newslot).c_str());
}
}
}
static HookedFunction cm(HookedFunctions_types::HF_CreateMove, "NavBot", 16, &CreateMove);
static InitRoutine runinit([](){
EC::Register<EC::Paint>(CreateMove, "paint_killsay", EC::average);
});
void change(settings::VariableBase<bool> &, bool)
{

View File

@ -1149,7 +1149,7 @@ void OnLevelInit()
Timer quit_timer{};
Timer map_check{};
int erasedelay = 0;
static HookedFunction Move(HookedFunctions_types::HF_CreateMove, "Walkbot", 16, []() {
static void cm() {
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (state::state == WB_DISABLED)
@ -1219,5 +1219,10 @@ static HookedFunction Move(HookedFunctions_types::HF_CreateMove, "Walkbot", 16,
}
break;
}
}
static InitRoutine init([](){
EC::Register<EC::CreateMove>(cm, "cm_walkbot", EC::average);
});
} // namespace hacks::shared::walkbot

View File

@ -1091,6 +1091,29 @@ void WhatIAmLookingAt(int *result_eindex, Vector *result_pos)
*result_eindex = ((IClientEntity *) (trace.m_pEnt))->entindex();
}
Vector GetForwardVector(Vector origin, Vector viewangles, float distance)
{
Vector forward;
float sp, sy, cp, cy;
QAngle angle = VectorToQAngle(viewangles);
trace_t trace;
sy = sinf(DEG2RAD(angle[1]));
cy = cosf(DEG2RAD(angle[1]));
sp = sinf(DEG2RAD(angle[0]));
cp = cosf(DEG2RAD(angle[0]));
forward.x = cp * cy;
forward.y = cp * sy;
forward.z = -sp;
forward = forward * distance + origin;
return forward;
}
Vector GetForwardVector(float distance)
{
return GetForwardVector(g_pLocalPlayer->v_Eye, g_pLocalPlayer->v_OrigViewangles, distance);
}
bool IsSentryBuster(CachedEntity *entity)
{
return (entity->m_Type() == EntityType::ENTITY_PLAYER && CE_INT(entity, netvar.iClass) == tf_class::tf_demoman && g_pPlayerResource->GetMaxHealth(entity) == 2500);

View File

@ -33,19 +33,6 @@ static settings::Bool no_shake{ "visual.no-shake", "true" };
#endif
class CMoveData;
#if LAGBOT_MODE
CatCommand set_value("set", "Set value", [](const CCommand &args) {
if (args.ArgC() < 2)
return;
ConVar *var = g_ICvar->FindVar(args.Arg(1));
if (!var)
return;
std::string value(args.Arg(2));
ReplaceString(value, "\\n", "\n");
var->SetValue(value.c_str());
logging::Info("Set '%s' to '%s'", args.Arg(1), value.c_str());
});
#endif
namespace engine_prediction
{
@ -101,21 +88,11 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd)
return;
}
} // namespace engine_prediction
#if not LAGBOT_MODE
#define antikick_time 35
#else
#define antikick_time 90
#endif
static int attackticks = 0;
namespace hooked_methods
{
static HookedFunction viewangs(HookedFunctions_types::HF_CreateMove, "set_ang", 21, []() {
if (CE_BAD(LOCAL_E))
return;
g_pLocalPlayer->v_OrigViewangles = current_user_cmd->viewangles;
});
DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUserCmd *cmd)
{
#define TICK_INTERVAL (g_GlobalVars->interval_per_tick)
@ -133,13 +110,11 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
tickcount++;
current_user_cmd = cmd;
#if !LAGBOT_MODE
IF_GAME(IsTF2C())
{
if (CE_GOOD(LOCAL_W) && minigun_jump && LOCAL_W->m_iClassID() == CL_CLASS(CTFMinigun))
CE_INT(LOCAL_W, netvar.iWeaponState) = 0;
}
#endif
ret = original::CreateMove(this_, input_sample_time, cmd);
PROF_SECTION(CreateMove);
@ -301,13 +276,12 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
{
PROF_SECTION(CM_WRAPPER);
HookTools::CM();
EC::RunCreateMove();
}
if (CE_GOOD(g_pLocalPlayer->entity))
{
if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon()))
{
#if !LAGBOT_MODE
// Walkbot can leave game.
if (!g_IEngine->IsInGame())
{
@ -328,12 +302,12 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
PROF_SECTION(CM_deadringer);
hacks::shared::deadringer::CreateMove();
}
if (engine_pred)
engine_prediction::RunEnginePrediction(RAW_ENT(LOCAL_E), current_user_cmd);
{
PROF_SECTION(CM_bunnyhop);
hacks::shared::bunnyhop::CreateMove();
}
if (engine_pred)
engine_prediction::RunEnginePrediction(RAW_ENT(LOCAL_E), current_user_cmd);
{
PROF_SECTION(CM_backtracc);
hacks::shared::backtrack::Run();
@ -405,9 +379,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
if (debug_projectiles)
projectile_logging::Update();
Prediction_CreateMove();
#endif
}
#if !LAGBOT_MODE
{
PROF_SECTION(CM_misc);
hacks::shared::misc::CreateMove();
@ -416,27 +388,22 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
PROF_SECTION(CM_crits);
criticals::create_move();
}
#endif
{
PROF_SECTION(CM_spam);
hacks::shared::spam::createMove();
}
#if !LAGBOT_MODE
{
PROF_SECTION(CM_AC);
hacks::shared::anticheat::CreateMove();
}
#endif
}
if (time_replaced)
g_GlobalVars->curtime = curtime_old;
g_Settings.bInvalid = false;
#if !LAGBOT_MODE
{
PROF_SECTION(CM_chat_stack);
chat_stack::OnCreateMove();
}
#endif
// TODO Auto Steam Friend
@ -451,7 +418,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
}
}
#endif
#if !LAGBOT_MODE
hacks::shared::backtrack::UpdateIncomingSequences();
if (CE_GOOD(g_pLocalPlayer->entity))
{
@ -523,7 +489,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
g_Settings.brute.choke[i].pop_front();
}
}
#endif
// PROF_END("CreateMove");
if (!(cmd->buttons & IN_ATTACK))

View File

@ -58,7 +58,26 @@ template <typename T> void SplitName(std::vector<T> &ret, const T &name, int num
if (tmp.size() > 2)
ret.push_back(tmp);
}
static int anti_balance_attempts = 0;
static std::string previous_name = "";
static Timer reset_it{};
static Timer wait_timer{};
void Paint()
{
if (!wait_timer.test_and_set(1000))
return;
INetChannel *server = (INetChannel *)g_IEngine->GetNetChannelInfo();
if (server)
reset_it.update();
if (reset_it.test_and_set(20000))
{
anti_balance_attempts = 0;
previous_name = "";
}
}
static InitRoutine Autobalance([](){
EC::Register<EC::Paint>(Paint, "paint_autobalance", EC::average);
});
DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, bf_read &buf)
{
if (!isHackActive())
@ -91,10 +110,30 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, bf_read &
case 5:
if (*anti_votekick && buf.GetNumBytesLeft() > 35)
{
INetChannel *server = (INetChannel *)g_IEngine->GetNetChannelInfo();
data = std::string(buf_data);
logging::Info("%s", data.c_str());
if (data.find("TeamChangeP") != data.npos && CE_GOOD(LOCAL_E))
g_IEngine->ClientCmd_Unrestricted("cat_disconnect;wait 100;cat_mm_join");
{
std::string server_name = server->GetName();
if (server_name != previous_name)
{
previous_name = server_name;
anti_balance_attempts = 0;
}
if (anti_balance_attempts < 2)
g_IEngine->ClientCmd_Unrestricted("cat_disconnect read if gay;wait 100;cat_mm_join");
else
{
std::string autobalance_msg = "tf_party_chat \"autobalanced in 3 seconds";
if (ipc::peer && ipc::peer->connected)
autobalance_msg += format(" IPC ID ", ipc::peer->client_id, "\"");
else
autobalance_msg += "\"";
g_IEngine->ClientCmd_Unrestricted(autobalance_msg.c_str());
}
anti_balance_attempts++;
}
buf.Seek(0);
}
break;
@ -187,7 +226,6 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, bf_read &
if (crypt_chat && message.find("!!B") == 0 && ucccccp::validate(message))
{
std::string msg = ucccccp::decrypt(message);
#if !LAGBOT_MODE
CachedEntity *ent = ENTITY(data[0]);
if (msg != "Attempt at ucccccping and failing" && msg != "Unsupported version" && ent != LOCAL_E)
{
@ -197,7 +235,6 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, bf_read &
state = playerlist::k_EState::CAT;
}
}
#endif
PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(), msg.c_str());
}
chatlog::LogMessage(data[0], message);

View File

@ -128,7 +128,7 @@ const char *GetNamestealName(CSteamID steam_id)
{
// Return the name that has changed from the func above
return format(stolen_name, "\015").c_str();
return format(stolen_name, "\e").c_str();
}
}
}
@ -171,7 +171,8 @@ static InitRoutine init([]() {
});
});
static Timer set_name{};
static HookedFunction CM(HookedFunctions_types::HF_CreateMove, "namesteal", 2, []() {
static void cm()
{
if (!namesteal)
return;
if (!set_name.test_and_set(500000))
@ -187,5 +188,10 @@ static HookedFunction CM(HookedFunctions_types::HF_CreateMove, "namesteal", 2, [
setname.SetReliable(false);
ch->SendNetMsg(setname, false);
}
}
static InitRoutine runinit([]() {
EC::Register<EC::CreateMove>(cm, "cm_namesteal", EC::late);
});
} // namespace hooked_methods

View File

@ -1,43 +1,45 @@
#include "HookTools.hpp"
#include "common.hpp"
#include "HookTools.hpp"
std::vector<HookedFunction *> &HookTools::GetHookedFunctions()
namespace EC
{
static std::vector<HookedFunction *> CreateMoves{};
return CreateMoves;
// Ordered set to always keep priorities correct
std::multiset<EventCallbackData<CreateMove>> createmoves;
#if ENABLE_VISUALS
std::multiset<EventCallbackData<Draw>> draws;
#endif
std::multiset<EventCallbackData<Paint>> paints;
std::multiset<EventCallbackData<LevelInit>> levelinits;
template <typename t> inline void run(t &set)
{
for (auto &i : set)
{
#if ENABLE_PROFILER
ProfilerNode node(i.section);
#endif
i.function();
}
}
// -----------------------------------------------------------
void RunHookedFunctions(HookedFunctions_types type)
void RunCreateMove()
{
auto &HookedFunctions = HookTools::GetHookedFunctions();
for (auto &i : HookedFunctions)
i->run(type);
run(createmoves);
}
#if ENABLE_VISUALS
void RunDraw()
{
run(draws);
}
#endif
void RunPaint()
{
run(paints);
}
void HookTools::CM()
void RunLevelInit()
{
RunHookedFunctions(HF_CreateMove);
run(levelinits);
}
void HookTools::DRAW()
{
RunHookedFunctions(HF_Draw);
}
void HookTools::PAINT()
{
RunHookedFunctions(HF_Paint);
}
static InitRoutine init([]() {
auto &HookedFunctions = HookTools::GetHookedFunctions();
logging::Info("Hooked Functions amount: %i", HookedFunctions.size());
std::sort(HookedFunctions.begin(), HookedFunctions.end(), [](HookedFunction *a, HookedFunction *b) { return *a > *b; });
logging::Info("Sorted Hooked Functions: %i", HookedFunctions.size());
});
static CatCommand print("debug_print_hookedfunctions", "Print hooked functions (CreateMove, Draw, Paint)", []() {
});
} // namespace EC

View File

@ -22,15 +22,11 @@ namespace hooked_methods
DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
{
#if !LAGBOT_MODE
hacks::shared::backtrack::lastincomingsequencenumber = 0;
hacks::shared::backtrack::sequences.clear();
#endif
firstcm = true;
// nav::init = false;
#if !LAGBOT_MODE
playerlist::Save();
#endif
#if ENABLE_VISUALS
#if ENABLE_GUI
gui::onLevelLoad();
@ -55,14 +51,13 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
for (int i = 0; i < 32; i++)
g_Settings.brute.brutenum[i] = 0;
g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec");
#if !LAGBOT_MODE
hacks::shared::aimbot::Reset();
hacks::shared::backtrack::Init();
chat_stack::Reset();
hacks::shared::anticheat::ResetEverything();
original::LevelInit(this_, name);
hacks::shared::walkbot::OnLevelInit();
#endif
EC::RunLevelInit();
#if ENABLE_IPC
if (ipc::peer)
{

View File

@ -13,15 +13,11 @@ namespace hooked_methods
DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_)
{
need_name_change = true;
#if !LAGBOT_MODE
playerlist::Save();
#endif
g_Settings.bInvalid = true;
#if !LAGBOT_MODE
hacks::shared::aimbot::Reset();
chat_stack::Reset();
hacks::shared::anticheat::ResetEverything();
#endif
#if ENABLE_IPC
if (ipc::peer)
{

View File

@ -24,9 +24,7 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
if (mode & PaintMode_t::PAINT_UIPANELS)
{
#if not LAGBOT_MODE
hacks::tf2::killstreak::apply_killstreaks();
#endif
hacks::shared::catbot::update();
hitrate::Update();
#if ENABLE_ONLINE
@ -91,7 +89,7 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
render_cheat_visuals();
#endif
// Call all paint functions
HookTools::PAINT();
EC::RunPaint();
}
return original::Paint(this_, mode);

View File

@ -12,7 +12,6 @@ DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf)
{
if (!round(hacks::shared::backtrack::getLatency()))
return original::SendDatagram(ch, buf);
#if !LAGBOT_MODE
int in = 0;
int state = 0;
if (CE_GOOD(LOCAL_E) && ch)
@ -23,17 +22,13 @@ DEFINE_HOOKED_METHOD(SendDatagram, int, INetChannel *ch, bf_write *buf)
float latencysend = round((round((hacks::shared::backtrack::getLatency() - 0.5f) / 15.1515151515f) - 0.5f) * 15.1515151515f);
hacks::shared::backtrack::AddLatencyToNetchan(ch, latencysend);
}
#endif
int ret = original::SendDatagram(ch, buf);
#if !LAGBOT_MODE
if (CE_GOOD(LOCAL_E) && ch)
{
ch->m_nInSequenceNr = in;
ch->m_nInReliableState = state;
}
#endif
return ret;
}
} // namespace hooked_methods

View File

@ -8,9 +8,7 @@
#include <settings/Bool.hpp>
#include <hacks/Thirdperson.hpp>
#include "HookedMethods.hpp"
#if not LAGBOT_MODE
#include "hacks/Backtrack.hpp"
#endif
static settings::Float nightmode{ "visual.night-mode", "0" };
static settings::Bool no_shake{ "visual.no-shake", "true" };

View File

@ -37,7 +37,7 @@ bool IsHoovyHelper(CachedEntity *entity)
return false;
}
static HookedFunction UpdateHoovyList(HookedFunctions_types::HF_CreateMove, "HoovyList", 19, []() {
void UpdateHoovyList() {
if (CE_BAD(LOCAL_E))
return;
@ -59,7 +59,7 @@ static HookedFunction UpdateHoovyList(HookedFunctions_types::HF_CreateMove, "Hoo
}
}
}
});
}
bool IsHoovy(CachedEntity *entity)
{
@ -67,3 +67,5 @@ bool IsHoovy(CachedEntity *entity)
return false;
return hoovy_list[entity->m_IDX - 1];
}
static InitRoutine init([](){EC::Register<EC::CreateMove>(UpdateHoovyList, "cm_hoovylist", EC::average);});

View File

@ -301,7 +301,7 @@ int GetMaxParty()
CatCommand debug_maxparty("debug_partysize", "Debug party size", []() { logging::Info("%d", GetMaxParty()); });
static Timer resize_party{};
static HookedFunction paint(HookedFunctions_types::HF_Paint, "IRC", 16, []() {
static void run() {
if (!restarting)
{
auto party_client = re::CTFPartyClient::GTFPartyClient();
@ -374,7 +374,7 @@ static HookedFunction paint(HookedFunctions_types::HF_Paint, "IRC", 16, []() {
irc.setState(state);
}
}
});
}
template <typename T> void rvarCallback(settings::VariableBase<T> &var, T after)
{
@ -394,6 +394,7 @@ template <typename T> void rvarCallback(settings::VariableBase<T> &var, T after)
}
static InitRoutine init([]() {
EC::Register<EC::Paint>(run, "PAINT_irc", EC::average);
updateData();
enabled.installChangeCallback(rvarCallback<bool>);
anon.installChangeCallback(rvarCallback<bool>);

View File

@ -32,26 +32,38 @@ weaponmode GetWeaponModeloc()
if (slot == 2)
return weaponmode::weapon_melee;
if (slot > 2)
{
return weaponmode::weapon_pda;
}
else if (classid == CL_CLASS(CTFLunchBox) || classid == CL_CLASS(CTFLunchBox_Drink) || classid == CL_CLASS(CTFBuffItem))
switch (classid)
{
case CL_CLASS(CTFLunchBox):
case CL_CLASS(CTFLunchBox_Drink):
case CL_CLASS(CTFBuffItem):
return weaponmode::weapon_consumable;
}
else if (classid == CL_CLASS(CTFRocketLauncher_DirectHit) || classid == CL_CLASS(CTFRocketLauncher) || classid == CL_CLASS(CTFGrenadeLauncher) || classid == CL_CLASS(CTFPipebombLauncher) || classid == CL_CLASS(CTFCompoundBow) || classid == CL_CLASS(CTFBat_Wood) || classid == CL_CLASS(CTFBat_Giftwrap) || classid == CL_CLASS(CTFFlareGun) || classid == CL_CLASS(CTFFlareGun_Revenge) || classid == CL_CLASS(CTFSyringeGun) || classid == CL_CLASS(CTFCrossbow) || classid == CL_CLASS(CTFShotgunBuildingRescue) || classid == CL_CLASS(CTFDRGPomson) || classid == CL_CLASS(CTFWeaponFlameBall) || classid == CL_CLASS(CTFRaygun) || classid == CL_CLASS(CTFGrapplingHook))
{
case CL_CLASS(CTFRocketLauncher_DirectHit):
case CL_CLASS(CTFRocketLauncher):
case CL_CLASS(CTFGrenadeLauncher):
case CL_CLASS(CTFPipebombLauncher):
case CL_CLASS(CTFCompoundBow):
case CL_CLASS(CTFBat_Wood):
case CL_CLASS(CTFBat_Giftwrap):
case CL_CLASS(CTFFlareGun):
case CL_CLASS(CTFFlareGun_Revenge):
case CL_CLASS(CTFSyringeGun):
case CL_CLASS(CTFCrossbow):
case CL_CLASS(CTFShotgunBuildingRescue):
case CL_CLASS(CTFDRGPomson):
case CL_CLASS(CTFWeaponFlameBall):
case CL_CLASS(CTFRaygun):
case CL_CLASS(CTFGrapplingHook):
return weaponmode::weapon_projectile;
}
else if (classid == CL_CLASS(CTFJar) || classid == CL_CLASS(CTFJarMilk))
{
case CL_CLASS(CTFJar):
case CL_CLASS(CTFJarMilk):
return weaponmode::weapon_throwable;
}
else if (classid == CL_CLASS(CWeaponMedigun))
{
case CL_CLASS(CWeaponMedigun):
return weaponmode::weapon_medigun;
default:
return weaponmode::weapon_hitscan;
}
return weaponmode::weapon_hitscan;
}
void LocalPlayer::Update()
{
@ -79,6 +91,7 @@ void LocalPlayer::Update()
life_state = CE_BYTE(entity, netvar.iLifeState);
v_ViewOffset = CE_VECTOR(entity, netvar.vViewOffset);
v_Origin = entity->m_vecOrigin();
v_OrigViewangles = current_user_cmd->viewangles;
v_Eye = v_Origin + v_ViewOffset;
clazz = CE_INT(entity, netvar.iClass);
health = CE_INT(entity, netvar.iHealth);

View File

@ -563,7 +563,8 @@ void repath()
static Timer last_jump{};
// Main movement function, gets path from NavTo
static HookedFunction CreateMove(HookedFunctions_types::HF_CreateMove, "NavParser", 17, []() {
static void cm()
{
if (!enabled || status != on)
return;
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
@ -616,10 +617,11 @@ static HookedFunction CreateMove(HookedFunctions_types::HF_CreateMove, "NavParse
}
// Walk to next crumb
WalkTo(crumbs.at(0));
});
}
#if ENABLE_VISUALS
static HookedFunction drawcrumbs(HF_Draw, "navparser", 10, []() {
static void drawcrumbs()
{
if (!enabled || !draw)
return;
if (!enabled)
@ -643,9 +645,16 @@ static HookedFunction drawcrumbs(HF_Draw, "navparser", 10, []() {
return;
glez::draw::rect(wts.x - 4, wts.y - 4, 8, 8, colors::white);
glez::draw::rect_outline(wts.x - 4, wts.y - 4, 7, 7, colors::white, 1.0f);
});
}
#endif
static InitRoutine runinit([]() {
EC::Register<EC::CreateMove>(cm, "cm_navparser", EC::late);
#if ENABLE_VISUALS
EC::Register<EC::Paint>(cm, "cm_navparser", EC::average);
#endif
});
void ResetPather()
{
Map.pather->Reset();

View File

@ -35,8 +35,11 @@ CatCommand fix_black_chams("fix_black_chams", "Fix Black Chams", []() {
effect_chams::g_EffectChams.Shutdown();
effect_chams::g_EffectChams.Init();
});
void EffectChams::Init()
{
if (init)
return;
logging::Info("Init EffectChams...");
{
KeyValues *kv = new KeyValues("UnlitGeneric");
@ -330,6 +333,8 @@ void EffectChams::Render(int x, int y, int w, int h)
return;
if (!enable)
return;
if (g_Settings.bInvalid)
return;
if (!init)
Init();
if (!isHackActive() || (g_IEngine->IsTakingScreenshot() && clean_screenshots))

View File

@ -129,6 +129,8 @@ CatCommand fix_black_glow("fix_black_glow", "Fix Black Glow", []() {
void EffectGlow::Init()
{
if (init)
return;
logging::Info("Init Glow...");
{
KeyValues *kv = new KeyValues("UnlitGeneric");

View File

@ -33,5 +33,6 @@ void applySdlHooks()
void cleanSdlHooks()
{
*pointers::SDL_GL_SwapWindow = hooked_methods::original::SDL_GL_SwapWindow;
*pointers::SDL_PollEvent = hooked_methods::original::SDL_PollEvent;
}
} // namespace sdl_hooks

View File

@ -60,8 +60,8 @@ std::mutex drawing_mutex;
struct snowflake
{
Vector2D pos;
Vector2D angle;
Vector2D pos{};
Vector2D angle{};
};
double getRandom(double lower_bound, double upper_bound)
@ -88,7 +88,7 @@ void DrawCheatVisuals()
{
PROF_SECTION(DRAW_SNOWFLAKES);
if (zerokernel::Menu::instance && !zerokernel::Menu::instance->isInGame())
if (zerokernel::Menu::instance && !zerokernel::Menu::instance->isInGame() && *draw_snowflakes)
{
// used to count current vector index
int idx = 0;
@ -103,7 +103,7 @@ void DrawCheatVisuals()
{
flake.pos += flake.angle;
// Get a new value so the snowflakes look a bit more natural, don#t dip below min/go above max.
// Get a new value so the snowflakes look a bit more natural, don't dip below min/go above max.
float rand_down_min = fminf(*snowflake_min_down, flake.angle.y - 0.01f);
float rand_down_max = fmaxf(*snowflake_max_down, flake.angle.x + 0.01f);
float rand_side_min = fminf(*snowflake_min_side, flake.angle.x - 0.01f);
@ -183,7 +183,7 @@ void DrawCheatVisuals()
}
{
PROF_SECTION(DRAW_WRAPPER);
HookTools::DRAW();
EC::RunDraw();
}
if (CE_GOOD(g_pLocalPlayer->entity) && !g_Settings.bInvalid)
{
@ -214,11 +214,6 @@ void DrawCheatVisuals()
PROF_SECTION(DRAW_backtracc);
hacks::shared::backtrack::Draw();
}
IF_GAME(IsTF2())
{
PROF_SECTION(DRAW_lightesp);
hacks::shared::lightesp::draw();
}
{
PROF_SECTION(DRAW_walkbot);
hacks::shared::walkbot::Draw();
@ -233,15 +228,10 @@ void DrawCheatVisuals()
PROF_SECTION(PT_spyalert);
hacks::tf::spyalert::Draw();
}
{
PROF_SECTION(DRAW_esp);
hacks::shared::esp::Draw();
}
IF_GAME(IsTF2())
{
criticals::draw();
}
hacks::tf2::autobackstab::Draw();
#ifndef FEATURE_FIDGET_SPINNER_ENABLED
DrawSpinner();
#endif