push with merge conflicts for Elite to fix

This commit is contained in:
BenCat07 2018-07-18 22:02:31 +02:00
parent 30abfddc81
commit d57a8c6a39
22 changed files with 479 additions and 241 deletions

View File

@ -9,6 +9,8 @@
// This is a temporary file to put code that needs moving/refactoring in.
extern bool *bSendPackets;
extern std::array<int, 32> bruteint;
extern std::array<Timer, 32> timers;
extern CatVar no_zoom;
extern CatVar clean_screenshots;
extern CatVar disable_visuals;
@ -23,6 +25,7 @@ extern CatVar serverlag_amount;
extern CatVar servercrash;
extern CatVar debug_projectiles;
extern CatVar semiauto;
extern CatVar resolver;
extern CatVar engine_pred;
extern Timer DelayTimer;
extern bool firstcm;

2
include/helpers.hpp Executable file → Normal file
View File

@ -81,7 +81,7 @@ Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist,
bool checkWalkable);
float vectorMax(Vector i);
Vector vectorAbs(Vector i);
bool canReachVector(Vector loc, Vector dest = {0,0,0});
bool canReachVector(Vector loc, Vector dest = { 0, 0, 0 });
bool isJumping(Vector vec);
bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax);

View File

@ -4,6 +4,8 @@
*/
#include "MiscTemporary.hpp"
std::array<Timer, 32> timers{};
std::array<int, 32> bruteint{};
CatVar minigun_jump(CV_SWITCH, "minigun_jump", "0", "TF2C minigun jump",
"Allows jumping while shooting with minigun");
@ -25,7 +27,8 @@ CatVar serverlag_amount(
CatVar servercrash(CV_SWITCH, "servercrash", "0", "crash servers",
"Crash servers by spamming signon net messages");
CatVar semiauto(CV_INT, "semiauto", "0", "Semiauto");
bool *bSendPackets;
bool *bSendPackets = nullptr;
CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles");
CatVar crypt_chat(
CV_SWITCH, "chat_crypto", "1", "Crypto chat",

View File

@ -3,12 +3,6 @@
#include "common.hpp"
#define INRANGE(x, a, b) (x >= a && x <= b)
#define getBits(x) \
(INRANGE((x & (~0x20)), 'A', 'F') ? ((x & (~0x20)) - 'A' + 0xa) \
: (INRANGE(x, '0', '9') ? x - '0' : 0))
#define getByte(x) (getBits(x[0]) << 4 | getBits(x[1]))
// module should be a pointer to the base of an elf32 module
// this is not the value returned by dlopen (which returns an opaque handle to
// the module) the best method to get this address is with fopen() and mmap()
@ -51,9 +45,73 @@ Elf32_Shdr *getSectionHeader(void *module, const char *sectionName)
}
return 0;
}
bool InRange(char x, char a, char b)
{
return x >= a && x <= b;
}
int GetBits(char x)
{
if (InRange((char) (x & (~0x20)), 'A', 'F'))
{
return (x & (~0x20)) - 'A' + 0xa;
}
else if (InRange(x, '0', '9'))
{
return x - '0';
}
return 0;
}
int GetBytes(const char *x)
{
return GetBits(x[0]) << 4 | GetBits(x[1]);
}
uintptr_t CSignature::dwFindPattern(uintptr_t dwAddress, uintptr_t dwLength,
const char *szPattern)
{
const char *pattern = szPattern;
uintptr_t firstMatch = 0;
uintptr_t start = dwAddress;
uintptr_t end = dwLength;
for (uintptr_t pos = start; pos < end; pos++)
{
if (*pattern == 0)
return firstMatch;
const uint8_t currentPattern =
*reinterpret_cast<const uint8_t *>(pattern);
const uint8_t currentMemory = *reinterpret_cast<const uint8_t *>(pos);
if (currentPattern == '\?' || currentMemory == GetBytes(pattern))
{
if (firstMatch == 0)
firstMatch = pos;
if (pattern[2] == 0)
{
logging::Info("Found pattern \"%s\" at 0x%08X.", szPattern,
firstMatch);
return firstMatch;
}
pattern += currentPattern != '\?' ? 3 : 2;
}
else
{
pattern = szPattern;
firstMatch = 0;
}
}
logging::Info("THIS IS SERIOUS: Could not locate signature: "
"\n============\n\"%s\"\n============",
szPattern);
return 0;
}
/*uintptr_t CSignature::dwFindPattern(uintptr_t dwAddress, uintptr_t dwLength,
const char *szPattern)
{
const char *pat = szPattern;
uintptr_t firstMatch = NULL;
@ -84,7 +142,7 @@ uintptr_t CSignature::dwFindPattern(uintptr_t dwAddress, uintptr_t dwLength,
szPattern);
return NULL;
}
}*/
//===================================================================================
void *CSignature::GetModuleHandleSafe(const char *pszModuleName)
{

View File

@ -182,8 +182,8 @@ bool BacktrackAimbot()
{
if (!hacks::shared::backtrack::enable || !backtrackAimbot)
return false;
if (aimkey && !aimkey.KeyDown())
return false;
if (aimkey && !aimkey.KeyDown())
return false;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || !CanShoot())
return false;
@ -194,14 +194,15 @@ bool BacktrackAimbot()
int iBestTarget = hacks::shared::backtrack::iBestTarget;
if (iBestTarget == -1)
return true;
return true;
int tickcnt = 0;
for (auto i : hacks::shared::backtrack::headPositions[iBestTarget])
{
bool good_tick = false;
for (int j = 0; j < 12; ++j)
if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && hacks::shared::backtrack::sorted_ticks[j].tickcount != FLT_MAX)
if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick &&
hacks::shared::backtrack::sorted_ticks[j].tickcount != FLT_MAX)
good_tick = true;
tickcnt++;
if (!i.hitboxpos.z)
@ -216,6 +217,7 @@ bool BacktrackAimbot()
// ok just in case
if (CE_BAD(tar))
continue;
//target_eid = tar->m_IDX;
Vector &angles = NET_VECTOR(tar, netvar.m_angEyeAngles);
float &simtime = NET_FLOAT(tar, netvar.m_flSimulationTime);
angles.y = i.viewangles;
@ -232,11 +234,11 @@ bool BacktrackAimbot()
else if (silent)
g_pLocalPlayer->bUseSilentAngles = true;
if (!slow_aim)
slow_can_shoot = true;
slow_can_shoot = true;
// Set angles
g_pUserCmd->viewangles = angles2;
if (autoshoot && slow_can_shoot)
g_pUserCmd->buttons |= IN_ATTACK;
g_pUserCmd->buttons |= IN_ATTACK;
return true;
}
return true;
@ -289,8 +291,6 @@ void CreateMove()
g_pLocalPlayer->weapon_mode == weapon_throwable))
projectileAimbotRequired = true;
// Local player check + Aimkey
if (!aimkey_status || !ShouldAim())
return;
@ -308,7 +308,7 @@ void CreateMove()
cur_proj_grav = float(proj_gravity);
}
if (BacktrackAimbot())
return;
return;
if (!g_IEntityList->GetClientEntity(target_entity->m_IDX))
return;
@ -325,6 +325,7 @@ void CreateMove()
// Attemt to auto-shoot
// flNextPrimaryAttack meme
//target_eid = target_entity->m_IDX;
if (only_can_shoot)
{

View File

@ -6,27 +6,31 @@
*/
#include <hacks/hacklist.hpp>
#include <glez/draw.hpp>
#include "common.hpp"
namespace hacks::shared::antiaim
{
CatVar communicate(CV_SWITCH, "identify", "0", "identify",
"Auto identify for other cathook users");
CatVar enabled(CV_SWITCH, "aa_enabled", "0", "Anti-Aim",
"Master AntiAim switch");
static CatVar crouch(CV_SWITCH, "aa_fakecrouch", "0", "Fake Crouch", "Fake crouch");
CatVar draw_fakes(CV_SWITCH, "aa_drawfakes", "1", "Draw Fakes",
"Draw a nice box around the head hitboxes");
static CatVar crouch(CV_SWITCH, "aa_fakecrouch", "0", "Fake Crouch",
"Fake crouch");
static CatVar yaw(CV_FLOAT, "aa_yaw", "0.0", "Yaw", "Static yaw (left/right)",
360.0);
static CatVar pitch(CV_FLOAT, "aa_pitch", "-89.0", "Pitch",
"Static pitch (up/down)", -89.0, 89.0);
static CatEnum yaw_mode_enum({ "KEEP", "STATIC", "JITTER",
"BIGRANDOM", "RANDOM", "SPIN",
"OFFSETKEEP", "EDGE", "HECK",
"FAKEKEEP", "FAKESTATIC", "FAKEJITTER",
"FAKEBIGRANDOM", "FAKERANDOM", "FAKESPIN",
"FAKEOFFSETKEEP", "FAKEEDGE", "FAKEHECK", "FAKESIDEWAYS", "FAKELEFT",
"FAKERIGHT", "FAKEREVERSEEDGE"});
static CatEnum yaw_mode_enum({ "KEEP", "STATIC", "JITTER",
"BIGRANDOM", "RANDOM", "SPIN",
"OFFSETKEEP", "EDGE", "HECK",
"FAKEKEEP", "FAKESTATIC", "FAKEJITTER",
"FAKEBIGRANDOM", "FAKERANDOM", "FAKESPIN",
"FAKEOFFSETKEEP", "FAKEEDGE", "FAKEHECK",
"FAKESIDEWAYS", "FAKELEFT", "FAKERIGHT",
"FAKEREVERSEEDGE" });
static CatEnum pitch_mode_enum({ "KEEP", "STATIC", "JITTER", "RANDOM", "FLIP",
"FAKEFLIP", "FAKEUP", "FAKEDOWN", "FAKECENTER",
"UP", "DOWN", "HECK" });
@ -74,7 +78,7 @@ float GetAAAAPitch()
case 1:
return aaaa_stage ? 271 : 89;
case 2:
return aaaa_stage ? -180 : 180;
return aaaa_stage ? -180 : 180;
default:
break;
}
@ -388,59 +392,54 @@ float useEdge(float edgeViewAngle)
Timer delay{};
int val = 0;
int value[32] = { 0 };
void FakeCrouch(CUserCmd * cmd)
void FakeCrouch(CUserCmd *cmd)
{
if (!crouch)
return;
if (cmd->buttons & IN_ATTACK)
{
*bSendPackets = true;
return;
}
static bool bDuck = false;
if (!crouch)
return;
if (cmd->buttons & IN_ATTACK)
{
*bSendPackets = true;
return;
}
static bool bDuck = false;
static int waittime = 0;
static int waittime = 0;
if (waittime)
{
waittime--;
return;
}
bDuck = !bDuck;
if (waittime)
{
waittime--;
return;
}
bDuck = !bDuck;
if (bDuck)
{
cmd->buttons |= IN_DUCK;
*bSendPackets = false;
waittime = 15;
}
else{
cmd->buttons &= ~IN_DUCK;
*bSendPackets = true;
}
if (bDuck)
{
cmd->buttons |= IN_DUCK;
*bSendPackets = false;
waittime = 15;
}
else
{
cmd->buttons &= ~IN_DUCK;
*bSendPackets = true;
}
}
void ProcessUserCmd(CUserCmd *cmd)
{
if (!enabled)
{
*bSendPackets = true;
return;
}
if (!ShouldAA(cmd))
return;
static bool angstate = true;
static bool keepmode = true;
keepmode = !keepmode;
if ((int) yaw_mode >= 8)
angstate = !angstate;
else
angstate = true;
if (!LOCAL_E->m_bAlivePlayer())
angstate = true;
if (g_pUserCmd->buttons & IN_ATTACK || g_pUserCmd->buttons & IN_ATTACK2)
angstate = true;
*bSendPackets = angstate;
float &p = cmd->viewangles.x;
float &y = cmd->viewangles.y;
static bool flip = false;
bool clamp = !no_clamping;
static bool keepmode = true;
keepmode = !keepmode;
float &p = cmd->viewangles.x;
float &y = cmd->viewangles.y;
static bool flip = false;
static bool bsendflip = true;
bool clamp = !no_clamping;
if (test)
{
cmd->viewangles.x = FLT_MAX;
@ -503,7 +502,6 @@ void ProcessUserCmd(CUserCmd *cmd)
else
y -= 90;
break;
flip = !flip;
}
clamp = false;
break;
@ -547,20 +545,20 @@ void ProcessUserCmd(CUserCmd *cmd)
y += (float) yaw;
break;
case 16: // Fake edge
if (*bSendPackets)
{
if (*bSendPackets)
{
// Attemt to find an edge and if found, edge
if (findEdge(y))
y = useEdge(y);
}
break;
}
break;
case 17: // Fake heck
if (*bSendPackets)
{
if (*bSendPackets)
{
FuckYaw(y);
clamp = false;
}
break;
}
break;
case 18: // Fake sideways
y += *bSendPackets ? 90.0f : -90.0f;
break;
@ -571,13 +569,13 @@ void ProcessUserCmd(CUserCmd *cmd)
y += !*bSendPackets ? 0.0f : 90.0f;
break;
case 21: // Fake reverse edge
if (*bSendPackets)
{
if (*bSendPackets)
{
// Attemt to find an edge and if found, edge
if (findEdge(y))
y = useEdge(y) + 180.0f;
}
break;
}
break;
default:
break;
}
@ -625,7 +623,7 @@ void ProcessUserCmd(CUserCmd *cmd)
clamp = false;
}
if (*bSendPackets)
flip = !flip;
flip = !flip;
if (clamp)
fClampAngle(cmd->viewangles);
if (roll)

View File

@ -71,7 +71,7 @@ void CreateMove()
Vector &angles = NET_VECTOR(tar, netvar.m_angEyeAngles);
float &simtime = NET_FLOAT(tar, netvar.m_flSimulationTime);
angles.y = i.viewangles;
simtime = i.simtime;
simtime = i.simtime;
g_pUserCmd->tick_count = i.tickcount;
g_pUserCmd->buttons |= IN_ATTACK;
break;

View File

@ -578,7 +578,7 @@ int HealingPriority(int idx)
int overheal = maxoverheal - (maxbuffedhealth - health);
float overhealp = ((float) overheal / (float) maxoverheal);
float healthp = ((float) health / (float) maxhealth);
priority += hacks::shared::followbot::ClassPriority(ent) * 10;
priority += hacks::shared::followbot::ClassPriority(ent) * 1.3;
switch (playerlist::AccessData(ent).state)
{
case playerlist::k_EState::FRIEND:

View File

@ -102,10 +102,10 @@ void Run()
}
shouldDrawBt = true;
CUserCmd *cmd = g_pUserCmd;
float bestFov = 99999;
BestTick = 0;
iBestTarget = -1;
CUserCmd *cmd = g_pUserCmd;
float bestFov = 99999;
BestTick = 0;
iBestTarget = -1;
float prev_distance = 9999;
@ -161,20 +161,26 @@ void Run()
float bestFOV = 180.0f;
float distance, prev_distance_ticks = 9999;
<<<<<<< Updated upstream
for (int i = 0; i < 12; ++i)
sorted_ticks[i] = BestTickData{INT_MAX, i};
=======
for (int i = 0; i < 12; ++i)
sorted_ticks[i] = BestTickData{ FLT_MAX, i };
>>>>>>> Stashed changes
for (int t = 0; t < ticks; ++t)
{
if (headPositions[iBestTarget][t].tickcount)
sorted_ticks[t] =
BestTickData{ headPositions[iBestTarget][t].tickcount, t };
if (headPositions[iBestTarget][t].tickcount)
sorted_ticks[t] =
BestTickData{ headPositions[iBestTarget][t].tickcount, t };
}
std::sort(sorted_ticks, sorted_ticks + ticks);
for (int t = 0; t < ticks; ++t)
{
bool good_tick = false;
for (int i = 0; i < 12; ++i)
if (t == sorted_ticks[i].tick && sorted_ticks[i].tickcount != FLT_MAX)
if (t == sorted_ticks[i].tick &&
sorted_ticks[i].tickcount != FLT_MAX)
good_tick = true;
if (!good_tick)
continue;

View File

@ -308,7 +308,6 @@ struct bonelist_s
};
std::unordered_map<studiohdr_t *, bonelist_s> bonelist_map{};
// Function called on draw
void Draw()
{
@ -505,17 +504,6 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent)
// Get if ent should be transparent
bool transparent = vischeck && ent_data.transparent;
// Bone esp
if (draw_bones && type == ENTITY_PLAYER)
{
const model_t *model = RAW_ENT(ent)->GetModel();
if (model)
{
auto hdr = g_IModelInfo->GetStudiomodel(model);
bonelist_map[hdr].Draw(ent, fg);
}
}
// Tracers
if (tracers && type == ENTITY_PLAYER)
{

View File

@ -54,8 +54,9 @@ static CatVar afk(CV_SWITCH, "fb_afk", "1", "Switch target if 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");
static CatVar corneractivate(CV_SWITCH, "fb_activation_corners", "1", "Activate arround corners",
"Try to find an activation path to an entity behind a corner.");
static CatVar corneractivate(
CV_SWITCH, "fb_activation_corners", "1", "Activate arround corners",
"Try to find an activation path to an entity behind a corner.");
// Something to store breadcrumbs created by followed players
static std::vector<Vector> breadcrumbs;
@ -102,7 +103,9 @@ void addCrumbs(CachedEntity *target, Vector corner = g_pLocalPlayer->v_Origin)
int maxiterations = floor(corner.DistTo(g_pLocalPlayer->v_Origin)) / 40;
for (int i = 0; i < maxiterations; i++)
{
breadcrumbs.push_back(g_pLocalPlayer->v_Origin + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1));
breadcrumbs.push_back(g_pLocalPlayer->v_Origin +
dist / vectorMax(vectorAbs(dist)) * 40.0f *
(i + 1));
}
}
@ -110,34 +113,35 @@ void addCrumbs(CachedEntity *target, Vector corner = g_pLocalPlayer->v_Origin)
int maxiterations = floor(corner.DistTo(target->m_vecOrigin())) / 40;
for (int i = 0; i < maxiterations; i++)
{
breadcrumbs.push_back(corner + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1));
breadcrumbs.push_back(
corner + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1));
}
}
int ClassPriority(CachedEntity* ent)
int ClassPriority(CachedEntity *ent)
{
switch (g_pPlayerResource->GetClass(ent))
{
if (g_pPlayerResource->GetClass(ent) == tf_spy)
return 0;
case tf_engineer:
return 1;
case tf_medic:
return 2;
case tf_pyro:
return 3;
case tf_scout:
return 4;
case tf_sniper:
return 5;
case tf_demoman:
return 6;
case tf_soldier:
return 7;
case tf_heavy:
return 8;
default:
return 0;
}
switch (g_pPlayerResource->GetClass(ent))
{
if (g_pPlayerResource->GetClass(ent) == tf_spy)
return 0;
case tf_engineer:
return 1;
case tf_medic:
return 2;
case tf_pyro:
return 3;
case tf_scout:
return 4;
case tf_sniper:
return 5;
case tf_demoman:
return 6;
case tf_soldier:
return 7;
case tf_heavy:
return 8;
default:
return 0;
}
}
void WorldTick()
{
@ -183,7 +187,7 @@ void WorldTick()
if (CE_BAD(entity)) // Exist + dormant
continue;
if (i == follow_target)
continue;
break;
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (steamid != entity->player_info.friendsID) // steamid check
@ -193,10 +197,21 @@ void WorldTick()
continue;
if (corneractivate)
{
Vector indirectOrigin = VischeckWall(LOCAL_E, entity, 250, true); //get the corner location that the future target is visible from
if (!indirectOrigin.z) //if we couldn't find it, exit
Vector indirectOrigin =
VischeckWall(LOCAL_E, entity, 250,
true); // get the corner location that the
// future target is visible from
if (!indirectOrigin.z) // if we couldn't find it, exit
continue;
<<<<<<< Updated upstream
addCrumbs(entity, indirectOrigin);
=======
breadcrumbs.clear(); // we need to ensure that the breadcrumbs
// std::vector is empty
breadcrumbs.push_back(indirectOrigin); // add the corner
// location to the
// breadcrumb list
>>>>>>> Stashed changes
}
else
{
@ -209,10 +224,14 @@ void WorldTick()
}
// If we dont have a follow target from that, we look again for someone
// else who is suitable
if ((!follow_target || change || (ClassPriority(ENTITY(follow_target)) < 6 && ENTITY(follow_target)->player_info.friendsID != steamid)) && roambot)
if ((!follow_target || change ||
(ClassPriority(ENTITY(follow_target)) < 6 &&
ENTITY(follow_target)->player_info.friendsID != steamid)) &&
roambot)
{
// Try to get a new target
auto ent_count = followcart ? HIGHEST_ENTITY : g_IEngine->GetMaxClients();
auto ent_count =
followcart ? HIGHEST_ENTITY : g_IEngine->GetMaxClients();
for (int i = 0; i < ent_count; i++)
{
auto entity = ENTITY(i);
@ -263,8 +282,11 @@ void WorldTick()
if (corneractivate)
{
Vector indirectOrigin = VischeckWall(LOCAL_E, entity, 250, true); //get the corner location that the future target is visible from
if (!indirectOrigin.z) //if we couldn't find it, exit
Vector indirectOrigin =
VischeckWall(LOCAL_E, entity, 250,
true); // get the corner location that the
// future target is visible from
if (!indirectOrigin.z) // if we couldn't find it, exit
continue;
addCrumbs(entity, indirectOrigin);
}
@ -273,6 +295,18 @@ void WorldTick()
if (!VisCheckEntFromEnt(LOCAL_E, entity))
continue;
}
<<<<<<< Updated upstream
=======
// favor closer entitys
if (follow_target &&
ENTITY(follow_target)->m_flDistance() >
entity->m_flDistance()) // favor closer entitys
{
if (ClassPriority(ENTITY(follow_target)) >
ClassPriority(entity))
continue;
}
>>>>>>> Stashed changes
// ooooo, a target
follow_target = i;
@ -306,11 +340,11 @@ void WorldTick()
}
}
// if(!checkPath()) //wip do not merge if you see this
// {
// follow_target = 0;
// return;
// }
// if(!checkPath()) //wip do not merge if you see this
// {
// follow_target = 0;
// return;
// }
// Update timer on new target
static Timer idle_time{};

View File

@ -53,14 +53,16 @@ void draw()
CachedEntity *pEntity = ENTITY(i);
if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer())
continue;
if (pEntity == LOCAL_E)
continue;
Vector out;
if (draw::WorldToScreen(hitp[i], out))
{
float size;
if (abs(maxp[i].x - minp[i].x) > abs(maxp[i].y - minp[i].y))
size = abs(maxp[i].x - minp[i].x);
else
size = abs(maxp[i].y - minp[i].y);
Vector pout, pout2;
if (draw::WorldToScreen(minp[i], pout) &&
draw::WorldToScreen(maxp[i], pout2))
size = fmaxf(fabsf(pout2.x - pout.x), fabsf(pout2.y - pout.y));
glez::draw::rect(out.x, out.y, size / 4, size / 4,
hacks::shared::lightesp::LightESPColor(pEntity));

View File

@ -192,7 +192,8 @@ bool canReachVector(Vector loc, Vector dest)
int maxiterations = floor(dest.DistTo(loc)) / 40;
for (int i = 0; i < maxiterations; i++)
{
Vector vec = loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1);
Vector vec =
loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1);
trace_t trace;
Ray_t ray;
@ -243,7 +244,8 @@ bool canReachVector(Vector loc, Vector dest)
down.z = down.z - 50;
ray.Init(loc, down);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
// higher to avoid small false positives, player can jump 42 hu according to
// higher to avoid small false positives, player can jump 42 hu
// according to
// the tf2 wiki
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
return false;
@ -271,7 +273,8 @@ bool canReachVector(Vector loc, Vector dest)
trace_t trace2;
Ray_t ray2;
ray2.Init(loc, directionalLoc);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace2);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
&trace2);
// distance of trace < than 26
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
return false;
@ -984,11 +987,11 @@ bool IsVectorVisible(Vector origin, Vector target, bool enviroment_only)
trace::filter_no_player.SetSelf(RAW_ENT(g_pLocalPlayer->entity));
ray.Init(origin, target);
if (!enviroment_only)
g_ITrace->TraceRay(ray, MASK_SHOT_HULL, &trace::filter_no_player,
&trace_visible);
g_ITrace->TraceRay(ray, MASK_SHOT_HULL, &trace::filter_no_player,
&trace_visible);
else
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
&trace_visible);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
&trace_visible);
return (trace_visible.fraction == 1.0f);
}

View File

@ -6,6 +6,8 @@
*/
#include "common.hpp"
#include <hacks/Aimbot.hpp>
#include "MiscTemporary.hpp"
#include "init.hpp"
namespace hitrate
@ -58,7 +60,7 @@ CatCommand debug_ammo("debug_ammo", "Debug ammo", []() {
logging::Info("%d %d", i, CE_INT(LOCAL_E, netvar.m_iAmmo + i * 4));
}
});
std::deque<int> entstocheck{};
void Update()
{
CachedEntity *weapon = LOCAL_W;
@ -67,14 +69,50 @@ void Update()
if (LOCAL_W->m_iClassID() == CL_CLASS(CTFSniperRifle) ||
LOCAL_W->m_iClassID() == CL_CLASS(CTFSniperRifleDecap))
{
/*INetChannel *ch = (INetChannel *)g_IEngine->GetNetChannelInfo();
static int prevhits = count_hits;
int latency = ch->GetAvgLatency(MAX_FLOWS) * 1000 + 0.5f;
if (hacks::shared::aimbot::target_eid != -1 && !timers[hacks::shared::aimbot::target_eid].check(latency))
{
if (count_hits > prevhits)
{
prevhits = count_hits;
timers[hacks::shared::aimbot::target_eid].update();
}
}*/
// ONLY tracks primary ammo
int ammo = CE_INT(LOCAL_E, netvar.m_iAmmo + 4);
if (lastweapon)
{
if (ammo < lastammo)
{
OnShot();
//for (auto i : entstocheck)
//{
OnShot();
/*static int prevent = 0;
if (hacks::shared::aimbot::target_eid != prevent)
{
entstocheck.push_back(hacks::shared::aimbot::target_eid);
prevent = hacks::shared::aimbot::target_eid;
timers[hacks::shared::aimbot::target_eid].update();
}
if (i != -1)
{
if (timers[i].test_and_set(latency))
{
bruteint[i]++;
entstocheck[];
}
}
}
}*/
}
/*else if (timers[hacks::shared::aimbot::target_eid].check(latency / 2))
{
}*/
}
lastweapon = weapon->m_IDX;
lastammo = ammo;
@ -91,7 +129,7 @@ class HurtListener : public IGameEventListener
public:
virtual void FireGameEvent(KeyValues *event)
{
if (strcmp("player_hurt", event->GetName()))
if (strcmp("player_hurt", event->GetName()) || strcmp("player_death", event->GetName()))
return;
if (g_IEngine->GetPlayerForUserID(event->GetInt("attacker")) ==
g_IEngine->GetLocalPlayer())
@ -99,7 +137,7 @@ public:
if (CE_GOOD(LOCAL_W) &&
(LOCAL_W->m_iClassID() == CL_CLASS(CTFSniperRifle) ||
LOCAL_W->m_iClassID() == CL_CLASS(CTFSniperRifleDecap)))
OnHit(event->GetBool("crit"));
OnHit(strcmp("player_death", event->GetName()) ? event->GetBool("crit") : false);
}
}
};

View File

@ -304,7 +304,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
}
#endif
#endif
*bSendPackets = true;
if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon()))
{
#if not LAGBOT_MODE
@ -347,26 +346,24 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
PROF_SECTION(CM_aimbot);
hacks::shared::aimbot::CreateMove();
}
IF_GAME(IsTF2())
{
PROF_SECTION(CM_antibackstab);
hacks::tf2::antibackstab::CreateMove();
}
static int attackticks = 0;
if (g_pUserCmd->buttons & IN_ATTACK)
++attackticks;
else
attackticks = 0;
if (semiauto)
{
if (g_pUserCmd->buttons & IN_ATTACK)
{
if (attackticks % int(semiauto) < int(semiauto) - 1)
{
g_pUserCmd->buttons &= ~IN_ATTACK;
}
static int fakelag_queue = 0;
if (CE_GOOD(LOCAL_E))
if (fakelag_amount)
{
*bSendPackets = int(fakelag_amount) == fakelag_queue;
fakelag_queue++;
if (fakelag_queue > int(fakelag_amount))
fakelag_queue = 0;
}
}
{
PROF_SECTION(CM_antiaim);
hacks::shared::antiaim::ProcessUserCmd(cmd);
@ -396,6 +393,11 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
hacks::tf::autoheal::CreateMove();
}
IF_GAME(IsTF2())
{
PROF_SECTION(CM_antibackstab);
hacks::tf2::antibackstab::CreateMove();
}
IF_GAME(IsTF2())
{
PROF_SECTION(CM_autobackstab);
hacks::tf2::autobackstab::CreateMove();
@ -466,24 +468,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
hacks::shared::backtrack::UpdateIncomingSequences();
if (CE_GOOD(g_pLocalPlayer->entity))
{
static int fakelag_queue = 0;
if (fakelag_amount)
{
if (fakelag_queue == int(fakelag_amount) ||
(g_pUserCmd->buttons & IN_ATTACK))
{
*bSendPackets = true;
}
else if (fakelag_queue < int(fakelag_amount))
{
*bSendPackets = false;
}
else
{
fakelag_queue = 0;
}
fakelag_queue++;
}
speedapplied = false;
if (roll_speedhack &&
g_IInputSystem->IsButtonDown(
@ -524,7 +508,10 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
ret = false;
}
if (cmd)
if (cmd &&
(cmd->buttons & IN_ATTACK ||
!(hacks::shared::antiaim::enabled &&
float(hacks::shared::antiaim::yaw_mode) >= 9 && !*bSendPackets)))
g_Settings.last_angles = cmd->viewangles;
}
#endif

View File

@ -9,55 +9,56 @@
#if not LAGBOT_MODE
#include "hacks/Backtrack.hpp"
#endif
static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles");
static CatVar nightmode(CV_SWITCH, "nightmode", "0", "Enable nightmode", "");
static CatVar nightmode(CV_FLOAT, "nightmode", "0", "Enable nightmode", "");
namespace hooked_methods
{
DEFINE_HOOKED_METHOD(FrameStageNotify, void, void *this_,
ClientFrameStage_t stage)
{
if (nightmode)
static float OldNightmode = 0.0f;
if (OldNightmode != (float) nightmode)
{
static int OldNightmode = 0;
if (OldNightmode != (int) nightmode)
static ConVar *r_DrawSpecificStaticProp =
g_ICvar->FindVar("r_DrawSpecificStaticProp");
if (!r_DrawSpecificStaticProp)
{
static ConVar *r_DrawSpecificStaticProp =
r_DrawSpecificStaticProp =
g_ICvar->FindVar("r_DrawSpecificStaticProp");
if (!r_DrawSpecificStaticProp)
{
r_DrawSpecificStaticProp =
g_ICvar->FindVar("r_DrawSpecificStaticProp");
return;
}
r_DrawSpecificStaticProp->SetValue(0);
for (MaterialHandle_t i = g_IMaterialSystem->FirstMaterial();
i != g_IMaterialSystem->InvalidMaterial();
i = g_IMaterialSystem->NextMaterial(i))
{
IMaterial *pMaterial = g_IMaterialSystem->GetMaterial(i);
if (!pMaterial)
continue;
if (strstr(pMaterial->GetTextureGroupName(), "World") ||
strstr(pMaterial->GetTextureGroupName(), "StaticProp"))
{
if (nightmode)
{
if (strstr(pMaterial->GetTextureGroupName(),
"StaticProp"))
pMaterial->ColorModulate(0.3f, 0.3f, 0.3f);
else
pMaterial->ColorModulate(0.05f, 0.05f, 0.05f);
}
else
pMaterial->ColorModulate(1.0f, 1.0f, 1.0f);
}
}
OldNightmode = nightmode;
return;
}
r_DrawSpecificStaticProp->SetValue(0);
for (MaterialHandle_t i = g_IMaterialSystem->FirstMaterial();
i != g_IMaterialSystem->InvalidMaterial();
i = g_IMaterialSystem->NextMaterial(i))
{
IMaterial *pMaterial = g_IMaterialSystem->GetMaterial(i);
if (!pMaterial)
continue;
if (strstr(pMaterial->GetTextureGroupName(), "World") ||
strstr(pMaterial->GetTextureGroupName(), "StaticProp"))
{
if (float(nightmode) > 0.0f)
{
if (strstr(pMaterial->GetTextureGroupName(), "StaticProp"))
pMaterial->ColorModulate(1.0f - float(nightmode) / 100.0f,
1.0f - float(nightmode) / 100.0f,
1.0f - float(nightmode) / 100.0f);
else
pMaterial->ColorModulate(
(1.0f - float(nightmode) / 100.0f) / 6.0f,
(1.0f - float(nightmode) / 100.0f) / 6.0f,
(1.0f - float(nightmode) / 100.0f) / 6.0f);
}
else
pMaterial->ColorModulate(1.0f, 1.0f, 1.0f);
}
}
OldNightmode = nightmode;
}
static IClientEntity *ent;

View File

@ -15,6 +15,17 @@ CatVar no_zoom(CV_SWITCH, "no_zoom", "0", "Disable scope",
"Disables black scope overlay");
static CatVar pure_bypass(CV_SWITCH, "pure_bypass", "0", "Pure Bypass",
"Bypass sv_pure");
int spamdur = 0;
Timer joinspam{};
CatCommand join_spam("join_spam",
"Spam joins server for X seconds",
[](const CCommand &args) {
if (args.ArgC() < 1)
return;
int id = atoi(args.Arg(1));
joinspam.update();
spamdur = id;
});
void *pure_orig = nullptr;
void **pure_addr = nullptr;
@ -27,6 +38,34 @@ static CatVar
static CatVar no_reportlimit(CV_SWITCH, "no_reportlimit", "0",
"no report limit",
"Remove playerlist report time limit");
// static CatVar disable_ban_tf(CV_SWITCH, "disable_mm_ban", "0", "Disable MM
// ban", "Disable matchmaking ban");
// static CatVar party_bypass(CV_SWITCH, "party_bypass", "0", "Party bypass",
// "Bypass the have to be friended restrictions on party");
/*void JoinParty(uint32 steamid)
{
CSteamID id(steamid, EUniverse::k_EUniversePublic,
EAccountType::k_EAccountTypeIndividual);
}
CatCommand join_party("join_party", "Join this players party (steamid3, no U:1:
and no [])", [](const CCommand &args) {
if (args.ArgC() < 1)
{
g_ICvar->ConsolePrintf("Please give a steamid3, thanks.\n");
return;
}
std::string tofind(args.Arg(1));
if (tofind.find("[U:1:") || tofind.find("]"))
g_ICvar->ConsolePrintf("Invalid steamid3. Please remove the [U:1 and the
].\n");
unsigned int id = atol(args.Arg(1));
if (!id)
g_ICvar->ConsolePrintf("Invalid steamid3.\n");
else
JoinParty(id);
});*/
bool replaced = false;
namespace hooked_methods
{
@ -46,10 +85,74 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
#if ENABLE_VISUALS
if (!textures_loaded)
{
textures_loaded = true;
}
#endif
static bool switcherido = false;
if (switcherido && spamdur && !joinspam.check(spamdur * 1000))
{
auto gc = re::CTFGCClientSystem::GTFGCClientSystem();
if (!gc)
goto label1;
gc->JoinMMMatch();
}
else if (!joinspam.check(spamdur * 1000) && spamdur)
{
INetChannel *ch = (INetChannel *)g_IEngine->GetNetChannelInfo();
if (!ch)
goto label1;
ch->Shutdown("GET GOOD GET CATHOOK");
}
label1:
/*static bool replacedparty = false;
if (party_bypass && !replacedparty)
{
static unsigned char patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
static unsigned char patch2[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
static unsigned char patch3[] = { 0x90, 0x90};
static unsigned char patch4[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
uintptr_t addr = gSignatures.GetClientSignature("0F 84 ? ? ? ? 8B 7B ?
8D 45");
uintptr_t addr2 = gSignatures.GetClientSignature("0F 8F ? ? ? ? 80 BD ?
? ? ? ? 0F 84 ? ? ? ? 80 BD");
uintptr_t addr3 = gSignatures.GetClientSignature("74 ? E8 ? ? ? ? 89
F1");
uintptr_t addr4 = gSignatures.GetClientSignature("0F 84 ? ? ? ? 8B 45 ?
8B 70 ? 8B 78 ? 8D 45");
uintptr_t addr5 = gSignatures.GetClientSignature("89 C6 74 ? 8B 43 ? 85
C0 74 ? 8B 10");
if (addr && addr2 && addr3 && addr4 && addr5)
{
logging::Info("Party bypass: 0x%08X, 0x%08X, 0x%08X, 0x%08X", addr,
addr2, addr3, addr4);
Patch((void*) addr, (void *) patch, sizeof(patch));
Patch((void*) addr2, (void *) patch2, sizeof(patch2));
Patch((void*) addr3, (void *) patch3, sizeof(patch3));
Patch((void*) addr4, (void *) patch4, sizeof(patch4));
replacedparty = true;
}
else
logging::Info("No Party bypass Signature");
}
static bool replacedban = false;
if (disable_ban_tf && !replacedban)
{
static unsigned char patch[] = { 0x31, 0xe0 };
static unsigned char patch2[] = { 0xb0, 0x01, 0x90 };
uintptr_t addr = gSignatures.GetClientSignature("31 C0 5B 5E 5F 5D C3 8D
B6 00 00 00 00 BA");
uintptr_t addr2 = gSignatures.GetClientSignature("0F 92 C0 83 C4 ? 5B 5E
5F 5D C3 8D B4 26 00 00 00 00 83 C4");
if (addr && addr2)
{
logging::Info("MM Banned: 0x%08x, 0x%08x", addr, addr2);
Patch((void*) addr, (void *) patch, sizeof(patch));
Patch((void*) addr2, (void *) patch2, sizeof(patch2));
replacedban = true;
}
else
logging::Info("No disable ban Signature");
}*/
if (no_reportlimit && !replaced)
{
static unsigned char patch[] = { 0xB8, 0x01, 0x00, 0x00, 0x00 };

View File

@ -7,11 +7,11 @@
#include "common.hpp"
CatCommand printfov(
"fov_print", "Dump achievements to file (development)", []() {
if (CE_GOOD(LOCAL_E))
logging::Info("%d", CE_INT(LOCAL_E, netvar.iFOV));
});
CatCommand printfov("fov_print", "Dump achievements to file (development)",
[]() {
if (CE_GOOD(LOCAL_E))
logging::Info("%d", CE_INT(LOCAL_E, netvar.iFOV));
});
void LocalPlayer::Update()
{
CachedEntity *wep;

View File

@ -1,7 +1,7 @@
target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/C_MannVsMachineStats.cpp"
"${CMAKE_CURRENT_LIST_DIR}/CTFGCClientSystem.cpp"
"${CMAKE_CURRENT_LIST_DIR}/CTFInventoryManager.cpp"
"${CMAKE_CURRENT_LIST_DIR}/CTFPartyClient.cpp"
"${CMAKE_CURRENT_LIST_DIR}/CTFParty.cpp"
"${CMAKE_CURRENT_LIST_DIR}/CTFGCClientSystem.cpp"
"${CMAKE_CURRENT_LIST_DIR}/ITFGroupMatchCriteria.cpp")

View File

@ -72,5 +72,16 @@ CTFParty *CTFGCClientSystem::GetParty()
int CTFGCClientSystem::JoinMMMatch()
{
// TODO
return 0;
typedef int (*JoinMMMatch_t)(CTFGCClientSystem *);
static uintptr_t addr =
gSignatures.GetClientSignature("55 89 E5 56 53 83 EC ? 8B 5D ? 0F B6 83 ? ? ? ? 89 C2");
if (!addr)
{
logging::Info("calling NULL!");
addr = gSignatures.GetClientSignature(
"55 89 E5 56 53 83 EC ? 8B 5D ? 0F B6 83 ? ? ? ? 89 C2");
return true;
}
static JoinMMMatch_t JoinMMMatch_fn = JoinMMMatch_t(addr);
return JoinMMMatch_fn(this);
}

View File

@ -58,7 +58,9 @@ int re::CTFPartyClient::LoadSavedCasualCriteria()
{
typedef int (*LoadSavedCasualCriteria_t)(re::CTFPartyClient *);
uintptr_t addr = gSignatures.GetClientSignature(
"55 89 E5 8B 45 ? 5D 8B 80 ? ? ? ? C3 66 90 55 89 E5 8B 45 ? 5D 0F B6 80 ? ? ? ? C3 90 55 89 E5 56") - 0x40;
"55 89 E5 8B 45 ? 5D 8B 80 ? ? ? ? C3 66 90 55 89 E5 "
"8B 45 ? 5D 0F B6 80 ? ? ? ? C3 90 55 89 E5 56") -
0x40;
LoadSavedCasualCriteria_t LoadSavedCasualCriteria_fn =
LoadSavedCasualCriteria_t(addr);

2
src/trace.cpp Executable file → Normal file
View File

@ -79,7 +79,7 @@ void trace::FilterNoPlayer::SetSelf(IClientEntity *self)
bool trace::FilterNoPlayer::ShouldHitEntity(IHandleEntity *handle, int mask)
{
return false;
return false;
IClientEntity *entity;
ClientClass *clazz;