Bug fixes

This commit is contained in:
BenCat07 2018-06-02 20:03:07 +02:00
parent b381982dbf
commit 52856ea0ed
37 changed files with 551 additions and 469 deletions

View File

@ -26,6 +26,7 @@ extern CatVar debug_projectiles;
extern CatVar semiauto;
extern CatVar engine_pred;
extern Timer DelayTimer;
extern bool firstcm;
extern CatVar delay;
extern CatVar adjust;
extern float prevflow;

View File

@ -23,5 +23,5 @@ constexpr int c_strcmp(char const *lhs, char const *rhs)
: c_strcmp(lhs + 1, rhs + 1);
}
#define FEATURE_RADAR_DISABLED
//#define FEATURE_RADAR_DISABLED
#define FEATURE_FIDGET_SPINNER_DISABLED

View File

@ -98,10 +98,6 @@ struct offsets
{
return PlatformOffset(36, undefined, undefined);
}
static constexpr uint32_t WriteUsercmdDeltaToBuffer()
{
return PlatformOffset(22, undefined, 22);
}
static constexpr uint32_t CanPacket()
{
return PlatformOffset(57, undefined, undefined);
@ -159,6 +155,10 @@ struct offsets
{
return PlatformOffset(8, undefined, undefined);
}
static constexpr uint32_t ProcessMovement()
{
return PlatformOffset(1, undefined, 1);
}
static constexpr uint32_t m_NetChannel()
{
return PlatformOffset(196, undefined, undefined);

View File

@ -140,7 +140,7 @@ public:
EntityType m_Type()
{
EntityType ret = ENTITY_GENERIC;
int classid = m_iClassID();
int classid = m_iClassID();
if (classid == CL_CLASS(CTFPlayer))
ret = ENTITY_PLAYER;
else if (classid == CL_CLASS(CTFGrenadePipebombProjectile) ||

View File

@ -47,7 +47,6 @@ public:
bool m_bInit;
bool m_bSuccess;
mstudiohitboxset_t *m_pHitboxSet;
model_t *m_pLastModel;
CachedEntity *parent_ref; // TODO FIXME turn this into an actual reference

View File

@ -22,18 +22,25 @@ struct BacktrackData
Vector min;
Vector max;
Vector origin;
float viewangles;
};
struct BestTickData
{
int tickcount;
int tick;
bool operator<(const BestTickData &rhs) const
{
return tickcount < rhs.tickcount;
}
};
void Init();
void Run();
void Backtrack(CachedEntity *, int);
int Besttick(CachedEntity *);
CachedEntity *BestTarget();
void Draw();
void AddLatencyToNetchan(INetChannel *, float);
void UpdateIncomingSequences();
extern bool dontbacktrack;
extern int lastincomingsequencenumber;
extern int BestTick;
extern int iBestTarget;
struct CIncomingSequence
{
CIncomingSequence(int instate, int seqnr, float time)
@ -51,6 +58,7 @@ extern circular_buf sequences;
extern CatVar latency;
extern CatVar enable;
extern BacktrackData headPositions[32][66];
extern BestTickData sorted_ticks[66];
}
}
}

View File

@ -19,7 +19,8 @@ extern int follow_target;
extern bool followcart;
extern CatVar followbot;
extern CatVar roambot;
extern CatVar follow_steam;
extern CatCommand follow_steam;
extern unsigned steamid;
void DrawTick();
void WorldTick();
}

7
include/reclasses/C_TFWeaponBaseGun.hpp Executable file → Normal file
View File

@ -29,5 +29,12 @@ public:
self, offsets::PlatformOffset(535, offsets::undefined, 535),
0)(self);
}
inline static int LaunchGrenade(IClientEntity *self)
{
typedef int (*fn_t)(IClientEntity *);
return vfunc<fn_t>(
self, offsets::PlatformOffset(548, offsets::undefined, 548),
0)(self);
}
};
}

View File

@ -22,13 +22,9 @@ public:
self, offsets::PlatformOffset(522, offsets::undefined, 522),
0)(self, trace);
}
inline static float GetSwingRange(CachedEntity *self)
inline static int GetSwingRange(IClientEntity *self)
{
int ret = 48.0f;
if (self->m_iClassID() == CL_CLASS(CTFSword) ||
self->m_iClassID() == CL_CLASS(CTFKatana))
ret = 72.0f;
return ret;
return 128;
}
};
}

View File

@ -35,6 +35,7 @@ CatVar crypt_chat(
int spectator_target;
CLC_VoiceData *voicecrash{};
bool firstcm = false;
Timer DelayTimer{};
CatVar delay(
CV_INT, "delay", "0", "Delay",

View File

@ -120,10 +120,12 @@ uintptr_t CSignature::GetClientSignature(const char *chPattern)
// we need to remap the address that we got from the pattern search from our
// mapped file to the actual memory we do this by rebasing the address
// (subbing the mmapped one and replacing it with the dlopened one.
return dwFindPattern(((uintptr_t) module) + textOffset,
((uintptr_t) module) + textOffset + textSize,
chPattern) -
(uintptr_t)(module) + moduleMap->l_addr;
uintptr_t patr =
dwFindPattern(((uintptr_t) module) + textOffset,
((uintptr_t) module) + textOffset + textSize, chPattern);
if (!patr)
return NULL;
return patr - (uintptr_t)(module) + moduleMap->l_addr;
}
//===================================================================================
uintptr_t CSignature::GetEngineSignature(const char *chPattern)
@ -147,10 +149,12 @@ uintptr_t CSignature::GetEngineSignature(const char *chPattern)
// we need to remap the address that we got from the pattern search from our
// mapped file to the actual memory we do this by rebasing the address
// (subbing the mmapped one and adding the dlopened one.
return dwFindPattern(((uintptr_t) module) + textOffset,
((uintptr_t) module) + textOffset + textSize,
chPattern) -
(uintptr_t)(module) + moduleMap->l_addr;
uintptr_t patr =
dwFindPattern(((uintptr_t) module) + textOffset,
((uintptr_t) module) + textOffset + textSize, chPattern);
if (!patr)
return NULL;
return patr - (uintptr_t)(module) + moduleMap->l_addr;
}
//===================================================================================
uintptr_t CSignature::GetVstdSignature(const char *chPattern)
@ -174,10 +178,12 @@ uintptr_t CSignature::GetVstdSignature(const char *chPattern)
// we need to remap the address that we got from the pattern search from our
// mapped file to the actual memory we do this by rebasing the address
// (subbing the mmapped one and adding the dlopened one.
return dwFindPattern(((uintptr_t) module) + textOffset,
((uintptr_t) module) + textOffset + textSize,
chPattern) -
(uintptr_t)(module) + moduleMap->l_addr;
uintptr_t patr =
dwFindPattern(((uintptr_t) module) + textOffset,
((uintptr_t) module) + textOffset + textSize, chPattern);
if (!patr)
return NULL;
return patr - (uintptr_t)(module) + moduleMap->l_addr;
}
CSignature gSignatures;

8
src/core/cvwrapper.cpp Executable file → Normal file
View File

@ -59,6 +59,10 @@ static CatCommand save_settings(
}
for (const auto &i : CatVarList())
{
if (!i)
continue;
if (!i->GetString())
continue;
if (i->GetBase() != std::string(i->GetString()))
{
file << CON_PREFIX << i->name << " \"" << i->GetString()
@ -91,6 +95,10 @@ static CatCommand save_settings_complete(
}
for (const auto &i : CatVarList())
{
if (!i)
continue;
if (!i->GetString())
continue;
file << CON_PREFIX << i->name << " \"" << i->GetString() << "\"\n";
}
file.close();

40
src/entityhitboxcache.cpp Executable file → Normal file
View File

@ -71,7 +71,6 @@ void EntityHitboxCache::Init()
if (!dynamic_cast<mstudiohitboxset_t *>(set))
return;
m_pLastModel = model;
m_pHitboxSet = set;
m_nNumHitboxes = 0;
if (set)
{
@ -152,7 +151,6 @@ void EntityHitboxCache::Reset()
m_bInit = false;
m_bModelSet = false;
m_bSuccess = false;
m_pHitboxSet = nullptr;
m_pLastModel = nullptr;
bones_setup = false;
}
@ -167,22 +165,28 @@ CachedHitbox *EntityHitboxCache::GetHitbox(int id)
return 0;
if (!m_bSuccess)
return 0;
if (!m_CacheValidationFlags[id])
{
box = m_pHitboxSet->pHitbox(id);
if (!box)
return 0;
if (box->bone < 0 || box->bone >= MAXSTUDIOBONES)
return 0;
VectorTransform(box->bbmin, GetBones()[box->bone],
m_CacheInternal[id].min);
VectorTransform(box->bbmax, GetBones()[box->bone],
m_CacheInternal[id].max);
m_CacheInternal[id].bbox = box;
m_CacheInternal[id].center =
(m_CacheInternal[id].min + m_CacheInternal[id].max) / 2;
m_CacheValidationFlags[id] = true;
}
if (CE_BAD(parent_ref))
return 0;
auto model = (model_t *) RAW_ENT(parent_ref)->GetModel();
if (!model)
return 0;
auto shdr = g_IModelInfo->GetStudiomodel(model);
if (!shdr)
return 0;
auto set = shdr->pHitboxSet(CE_INT(parent_ref, netvar.iHitboxSet));
if (!dynamic_cast<mstudiohitboxset_t *>(set))
return 0;
box = set->pHitbox(id);
if (!box)
return 0;
if (box->bone < 0 || box->bone >= MAXSTUDIOBONES)
return 0;
VectorTransform(box->bbmin, GetBones()[box->bone], m_CacheInternal[id].min);
VectorTransform(box->bbmax, GetBones()[box->bone], m_CacheInternal[id].max);
m_CacheInternal[id].bbox = box;
m_CacheInternal[id].center =
(m_CacheInternal[id].min + m_CacheInternal[id].max) / 2;
m_CacheValidationFlags[id] = true;
return &m_CacheInternal[id];
}

View File

@ -33,8 +33,9 @@ static CatVar aimkey_mode(aimkey_modes_enum, "aimbot_aimkey_mode", "1",
static CatVar autoshoot(CV_SWITCH, "aimbot_autoshoot", "1", "Autoshoot",
"Shoot automatically when the target is locked, isn't "
"compatible with 'Enable when attacking'");
static CatVar autoshoot_disguised(CV_SWITCH, "aimbot_autoshoot_disguised", "1", "Autoshoot while disguised",
"Shoot automatically if disguised.");
static CatVar autoshoot_disguised(CV_SWITCH, "aimbot_autoshoot_disguised", "1",
"Autoshoot while disguised",
"Shoot automatically if disguised.");
static CatVar multipoint(CV_SWITCH, "aimbot_multipoint", "0", "Multipoint",
"Multipoint aimbot");
static CatEnum hitbox_mode_enum({ "AUTO", "AUTO-CLOSEST", "STATIC" });
@ -239,7 +240,6 @@ void CreateMove()
return;
// Attemt to auto-shoot
DoAutoshoot();
// flNextPrimaryAttack meme
if (only_can_shoot)
@ -248,6 +248,7 @@ void CreateMove()
// Handle Compound bow
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFCompoundBow))
{
DoAutoshoot();
static bool currently_charging_huntsman = false;
// Hunstman started charging
@ -267,17 +268,23 @@ void CreateMove()
// Not release type weapon
}
else if (GetWeaponMode() == weapon_melee &&
(g_pUserCmd->buttons & IN_ATTACK))
else if (GetWeaponMode() == weapon_melee)
{
DoAutoshoot();
Aim(target_entity);
}
else if (CanShoot() && (g_pUserCmd->buttons & IN_ATTACK) &&
else if (CanShoot() &&
CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) != 0)
{
Aim(target_entity);
DoAutoshoot();
}
}
else
{
DoAutoshoot();
Aim(target_entity);
}
return;
}
@ -490,8 +497,8 @@ bool IsTargetStateGood(CachedEntity *entity)
}
IF_GAME(IsTF())
{
//don't aim if holding sapper
if (g_pLocalPlayer->holding_sapper)
// don't aim if holding sapper
if (g_pLocalPlayer->holding_sapper)
return false;
// Wait for charge
@ -591,8 +598,8 @@ bool IsTargetStateGood(CachedEntity *entity)
}
else if (entity->m_Type() == ENTITY_BUILDING)
{
//Don't aim if holding sapper
if (g_pLocalPlayer->holding_sapper)
// Don't aim if holding sapper
if (g_pLocalPlayer->holding_sapper)
return false;
// Enabled check
if (!(buildings_other || buildings_sentry))
@ -774,6 +781,7 @@ void Aim(CachedEntity *entity)
}
// A function to check whether player can autoshoot
bool begancharge = false;
void DoAutoshoot()
{
// Enable check
@ -790,19 +798,25 @@ void DoAutoshoot()
CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flChargeBeginTime);
// Release hunstman if over huntsmans limit
if (g_GlobalVars->curtime - begincharge >= (float) huntsman_autoshoot)
if ((g_GlobalVars->curtime - begincharge >=
(float) huntsman_autoshoot) &&
begancharge)
{
g_pUserCmd->buttons &= ~IN_ATTACK;
hacks::shared::antiaim::SetSafeSpace(3);
begancharge = false;
// Pull string if charge isnt enough
}
else
{
g_pUserCmd->buttons |= IN_ATTACK;
begancharge = true;
}
return;
}
bool attack = true;
else
begancharge = false;
bool attack = true;
// Rifle check
IF_GAME(IsTF())
@ -843,6 +857,7 @@ void DoAutoshoot()
if (attack)
g_pUserCmd->buttons |= IN_ATTACK;
hacks::shared::antiaim::SetSafeSpace(1);
return;
}
@ -1195,7 +1210,7 @@ bool UpdateAimkey()
float EffectiveTargetingRange()
{
if (GetWeaponMode() == weapon_melee)
return (float) re::C_TFWeaponBaseMelee::GetSwingRange(LOCAL_W);
return (float) re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W));
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFFlameThrower))
return 185.0f; // Pyros only have so much untill their flames hit

View File

@ -65,7 +65,7 @@ static CatVar aaaa_mode(aaaa_modes_enum, "aa_aaaa_mode", "0", "Mode",
"Anti-Anti-Anti-Aim Mode");
static CatVar aaaa_flip_key(CV_KEY, "aa_aaaa_flip_key", "0", "Flip key",
"If you press that key, current AA will change");
static CatVar test(CV_KEY, "aa_test", "0", "debug", "test");
float cur_yaw = 0.0f;
int safe_space = 0;
@ -262,14 +262,11 @@ bool ShouldAA(CUserCmd *cmd)
return false;
int classid = LOCAL_W->m_iClassID();
if ((cmd->buttons & IN_ATTACK) &&
!(IsTF2() &&
classid == CL_CLASS(CTFCompoundBow)) &&
CanShoot())
!(IsTF2() && classid == CL_CLASS(CTFCompoundBow)) && CanShoot())
{
return false;
}
if ((cmd->buttons & IN_ATTACK2) &&
classid == CL_CLASS(CTFLunchBox))
if ((cmd->buttons & IN_ATTACK2) && classid == CL_CLASS(CTFLunchBox))
return false;
switch (GetWeaponMode())
{
@ -478,6 +475,13 @@ void ProcessUserCmd(CUserCmd *cmd)
float &y = cmd->viewangles.y;
static bool flip = false;
bool clamp = !no_clamping;
if (test)
{
cmd->viewangles.x = FLT_MAX;
cmd->viewangles.y = FLT_MAX;
g_pLocalPlayer->bUseSilentAngles = true;
return;
}
if (!*bSendPackets)
switch ((int) true_yaw_mode)
{

3
src/hacks/AntiCheat.cpp Executable file → Normal file
View File

@ -49,7 +49,8 @@ static CatVar skip_local(CV_SWITCH, "ac_ignore_local", "1", "Ignore Local");
void SetRage(player_info_t info)
{
if (autorage)
playerlist::AccessData(info.friendsID).state = playerlist::k_EState::RAGE;
playerlist::AccessData(info.friendsID).state =
playerlist::k_EState::RAGE;
}
void CreateMove()

View File

@ -27,7 +27,7 @@ const Vector GetWorldSpaceCenter(CachedEntity *ent)
static CatVar enabled(CV_SWITCH, "autobackstab", "0", "Auto Backstab",
"Does not depend on triggerbot!");
static CatVar value(CV_INT, "autobackstab_range", "110.0f",
static CatVar value(CV_INT, "autobackstab_range", "75.0f",
"Set Detection Distance to this much");
bool found;
// TODO improve
@ -47,63 +47,24 @@ void CreateMove()
{
if (!hacks::shared::backtrack::enable)
return;
found = false;
if (!CE_GOOD(LOCAL_E))
if (hacks::shared::backtrack::iBestTarget == -1)
return;
CachedEntity *ent;
for (int i = 0; i < 32; i++)
{
float scr = 0;
float scr_best = 0;
CachedEntity *pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
continue;
if (pEnt->m_Type() != ENTITY_PLAYER)
continue;
if (!pEnt->m_bAlivePlayer())
continue;
if (pEnt == LOCAL_E)
continue;
if (LOCAL_E->m_iTeam() == pEnt->m_iTeam())
continue;
scr = 4096.0f - pEnt->m_vecOrigin().DistTo(LOCAL_E->m_vecOrigin());
scr -= abs(g_pLocalPlayer->v_Eye.y -
NET_VECTOR(pEnt, netvar.m_angEyeAngles).y);
if (scr > scr_best)
{
scr_best = scr;
ent = pEnt;
found = true;
}
}
if (!found)
return;
if (!CE_GOOD(ent))
return;
Vector vecVictimForward = NET_VECTOR(ent, netvar.m_angEyeAngles);
vecVictimForward.z = 0.0f;
vecVictimForward.NormalizeInPlace();
int iBestTarget = hacks::shared::backtrack::iBestTarget;
int BestTick = hacks::shared::backtrack::BestTick;
// Get a vector from my origin to my targets origin
Vector vecToTarget;
float scr =
abs(g_pLocalPlayer->v_OrigViewangles.y -
hacks::shared::backtrack::headPositions[iBestTarget][BestTick]
.viewangles);
int tick = hacks::shared::backtrack::Besttick(ent);
vecToTarget =
hacks::shared::backtrack::headPositions[ent->m_IDX][tick].origin -
GetWorldSpaceCenter(LOCAL_E);
vecToTarget.z = 0.0f;
vecToTarget.NormalizeInPlace();
float flDot = DotProduct(vecVictimForward, vecToTarget);
bool isbehind = flDot > -0.1;
if (isbehind &&
hacks::shared::backtrack::headPositions[ent->m_IDX][tick]
if (scr < 40.0f &&
hacks::shared::backtrack::headPositions[iBestTarget][BestTick]
.origin.DistTo(g_pLocalPlayer->v_Eye) <=
re::C_TFWeaponBaseMelee::GetSwingRange(LOCAL_W))
re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W)))
{
hacks::shared::backtrack::dontbacktrack = true;
hacks::shared::backtrack::Backtrack(ent, tick);
g_pUserCmd->tick_count =
hacks::shared::backtrack::headPositions[iBestTarget][BestTick]
.tickcount;
g_pUserCmd->buttons |= IN_ATTACK;
}
}

View File

@ -27,14 +27,32 @@ bool IsProjectile(CachedEntity *ent)
ent->m_iClassID() == CL_CLASS(CTFGrenadePipebombProjectile) ||
ent->m_iClassID() == CL_CLASS(CTFProjectile_EnergyRing));
}
int NearbyEntities()
{
int ret = 0;
if (CE_BAD(LOCAL_E))
return ret;
for (int i = 0; i < HIGHEST_ENTITY; i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent))
continue;
if (ent == LOCAL_E)
continue;
if (!ent->m_bAlivePlayer())
continue;
if (ent->m_flDistance() <= 300.0f)
ret++;
}
return ret;
}
void CreateMove()
{
if (CE_BAD(LOCAL_E))
return;
if (!HasWeapon(LOCAL_E, 59) ||
CE_INT(LOCAL_E, netvar.m_bFeignDeathReady) == 1)
if (!HasWeapon(LOCAL_E, 59))
return;
if (CE_INT(LOCAL_E, netvar.iHealth) < 30)
if (CE_INT(LOCAL_E, netvar.iHealth) < 30 && NearbyEntities() > 2)
g_pUserCmd->buttons |= IN_ATTACK2;
for (int i = 0; i < HIGHEST_ENTITY; i++)
{
@ -43,6 +61,8 @@ void CreateMove()
continue;
if (!IsProjectile(ent))
continue;
if (ent->m_bCritProjectile())
g_pUserCmd->buttons |= IN_ATTACK2;
if (ent->m_flDistance() < 100.0f)
g_pUserCmd->buttons |= IN_ATTACK2;
}

View File

@ -49,33 +49,45 @@ Timer autoqueue_timer{};
Timer queuetime{};
Timer req_timer{};
/*CatVar party_bypass(CV_SWITCH, "party_bypass", "0", "Party Bypass",
"Bypass Party restrictions");*/
"Bypass Party restrictions");*/
void UpdateSearch()
{
// segfaults for no reason
/*static bool calld = false;
if (party_bypass && !calld) {
static unsigned char patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
static uintptr_t party_addr1 = gSignatures.GetClientSignature(
"0F 84 ? ? ? ? 8B 7B ? 8D 45");
static unsigned char patch2[] = { 0x90, 0xE9};
static uintptr_t party_addr2 = gSignatures.GetClientSignature(
"0F 8E ? ? ? ? 31 DB 0F B6 BD");
static unsigned char patch3[] = { 0x90, 0x90};
static uintptr_t party_addr3 = gSignatures.GetClientSignature(
"74 ? E8 ? ? ? ? 89 F1");
static unsigned char patch4[] = { 0x90, 0xE9};
static uintptr_t party_addr4 = gSignatures.GetClientSignature(
"0F 85 ? ? ? ? E8 ? ? ? ? C7 04 24 ? ? ? ? 89 44 24");
static unsigned char patch5[] = { 0x90, 0x90, 0x90, 0x90};
static uintptr_t party_addr5 = gSignatures.GetClientSignature(
"0F 84 ? ? ? ? 8B 45 ? 8B 70 ? 8B 78 ? 8D 45");
Patch((void *) party_addr1, (void *) patch, sizeof(patch));
Patch((void *) party_addr2, (void *) patch2, sizeof(patch2));
Patch((void *) party_addr3, (void *) patch3, sizeof(patch3));
Patch((void *) party_addr4, (void *) patch4, sizeof(patch4));
Patch((void *) party_addr5, (void *) patch5, sizeof(patch5));
calld = true;
if (party_bypass && !calld)
{
static unsigned char patch[] = { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
uintptr_t party_addr1 = gSignatures.GetClientSignature(
"55 89 E5 57 56 53 81 EC ? ? ? ? 8B 45 ? 8B 5D ? 8B 55 ? 89 85 ? ? "
"? ? 65 A1 ? ? ? ? 89 45 ? 31 C0 8B 45");
static unsigned char patch2[] = { 0x90, 0xE9 };
uintptr_t party_addr2 = gSignatures.GetClientSignature(
"55 89 E5 57 56 53 81 EC ? ? ? ? C7 85 ? ? ? ? ? ? ? ? C7 85 ? ? ? "
"? ? ? ? ? 8B 45 ? 89 85 ? ? ? ? 65 A1 ? ? ? ? 89 45 ? 31 C0 A1 ? "
"? ? ? 85 C0 0F 84");
static unsigned char patch3[] = { 0x90, 0x90 };
uintptr_t party_addr3 = gSignatures.GetClientSignature(
"8D 65 ? 5B 5E 5F 5D C3 31 F6 8B 87");
static unsigned char patch4[] = { 0x90, 0xE9 };
static unsigned char patch5[] = { 0x90, 0x90, 0x90, 0x90 };
uintptr_t party_addr4 = gSignatures.GetClientSignature(
"55 89 E5 57 56 53 83 EC ? 8B 5D ? 8B 75 ? 8B 7D ? 89 1C 24 89 74 24
? 89 7C 24 ? E8 ? ? ? ? 84 C0 74 ? 83 C4");
if (!party_addr1 || !party_addr2 || !party_addr3 || !party_addr4)
logging::Info("Invalid Party signature");
else
{
Patch((void *) (party_addr1 + 0x41), (void *) patch, sizeof(patch));
Patch((void *) (party_addr2 + 0x9FA), (void *) patch2,
sizeof(patch2));
Patch((void *) (party_addr3 + 0xC5), (void *) patch3,
sizeof(patch3));
Patch((void *) (party_addr3 + 0xF0), (void *) patch4,
sizeof(patch4));
Patch((void *) (party_addr4 + 0x7F), (void *) patch5,
sizeof(patch5));
calld = true;
}
}*/
if (!auto_queue)
return;

View File

@ -21,7 +21,11 @@ CatVar draw_bt(CV_SWITCH, "backtrack_draw", "0", "Draw",
"Draw backtrack ticks");
CatVar latency(CV_FLOAT, "backtrack_latency", "0", "fake lantency",
"Set fake latency to this many ms");
CatVar mindistance(CV_FLOAT, "mindistance", "60", "mindistance");
BacktrackData headPositions[32][66];
BestTickData sorted_ticks[66];
int highesttick[32]{};
int lastincomingsequencenumber = 0;
circular_buf sequences{ 2048 };
@ -49,7 +53,7 @@ void AddLatencyToNetchan(INetChannel *ch, float Latency)
Latency -= ch->GetLatency(MAX_FLOWS);
for (auto &seq : sequences)
{
if (g_GlobalVars->realtime - seq.curtime >= Latency / 1000.0f)
if (g_GlobalVars->realtime - seq.curtime > Latency / 1000.0f)
{
ch->m_nInReliableState = seq.inreliablestate;
ch->m_nInSequenceNr = seq.sequencenr;
@ -57,9 +61,8 @@ void AddLatencyToNetchan(INetChannel *ch, float Latency)
}
}
}
bool installed = false;
int ticks = 12;
bool dontbacktrack = false;
bool installed = false;
int ticks = 12;
void Init()
{
for (int i = 0; i < 32; i++)
@ -76,30 +79,24 @@ void Init()
installed = true;
}
}
std::pair<int, int> backtracked;
void setbesttick(CachedEntity *ent, int tick)
{
backtracked.first = ent->m_IDX;
backtracked.second = tick;
}
bool disabled = true;
int BestTick = 0;
int iBestTarget = -1;
void Run()
{
if (!enable)
{
if (!disabled)
Init();
disabled = true;
return;
}
disabled = true;
float bestFov = 99999;
if (CE_BAD(LOCAL_E))
return;
CUserCmd *cmd = g_pUserCmd;
float bestFov = 99999;
BestTick = 0;
iBestTarget = -1;
bool IsMelee = GetWeaponMode() == weapon_melee;
float prev_distance = 9999;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
{
CachedEntity *pEntity = ENTITY(i);
@ -107,9 +104,8 @@ void Run()
if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer())
{
for (BacktrackData &btd : headPositions[i])
btd = BacktrackData{
0, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }
};
btd = BacktrackData{ 0, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, 0 };
continue;
}
if (pEntity->m_iTeam() == LOCAL_E->m_iTeam())
@ -121,79 +117,69 @@ void Run()
Vector hitboxpos = pEntity->hitboxes.GetHitbox(0)->center;
Vector min = pEntity->hitboxes.GetHitbox(0)->min;
Vector max = pEntity->hitboxes.GetHitbox(0)->max;
headPositions[i][g_pUserCmd->command_number % ticks + 1] =
BacktrackData{ g_pUserCmd->tick_count, hitboxpos, min, max,
pEntity->m_vecOrigin() };
}
if ((g_pUserCmd->buttons & IN_ATTACK || g_pUserCmd->buttons & IN_ATTACK2) &&
!dontbacktrack && CanShoot())
{
CachedEntity *target = BestTarget();
if (CE_BAD(target))
return;
int tick = Besttick(target);
Backtrack(target, tick);
}
dontbacktrack = false;
}
int Besttick(CachedEntity *ent)
{
float tempFOV = 9999;
float bestFOV = 40.0f;
int bestTick = 0;
for (int t = 0; t < ticks; ++t)
{
if (!IsVectorVisible(g_pLocalPlayer->v_Eye,
headPositions[ent->m_IDX][t].hitboxpos))
continue;
if (GetWeaponMode() == weapon_melee)
if (g_pLocalPlayer->v_Eye.DistTo(
headPositions[ent->m_IDX][t].hitboxpos) >
re::C_TFWeaponBaseMelee::GetSwingRange(LOCAL_W))
continue;
tempFOV =
GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye,
headPositions[ent->m_IDX][t].hitboxpos);
if (bestFOV > tempFOV)
bestTick = t, bestFOV = tempFOV;
}
BestTick = bestTick;
return BestTick;
}
CachedEntity *BestTarget()
{
float bestFov = 99999;
iBestTarget = -1;
for (int i = 0; i < 32; i++)
{
for (int t = 0; t < ticks; ++t)
float _viewangles =
NET_VECTOR(RAW_ENT(pEntity), netvar.m_angEyeAngles).y;
float viewangles =
(_viewangles > 180) ? _viewangles - 360 : _viewangles;
Vector hitbox_spine = pEntity->hitboxes.GetHitbox(3)->center;
headPositions[i][cmd->command_number % ticks] =
BacktrackData{ cmd->tick_count, hitboxpos, min, max,
hitbox_spine, viewangles };
float FOVDistance = GetFov(g_pLocalPlayer->v_OrigViewangles,
g_pLocalPlayer->v_Eye, hitboxpos);
float distance = g_pLocalPlayer->v_Eye.DistTo(hitbox_spine);
if (!IsMelee && bestFov > FOVDistance && FOVDistance < 60.0f)
{
if (!IsVectorVisible(g_pLocalPlayer->v_Eye,
headPositions[iBestTarget][t].hitboxpos))
continue;
Vector hitboxpos = headPositions[i][t].hitboxpos;
float FOVDistance = GetFov(g_pLocalPlayer->v_OrigViewangles,
g_pLocalPlayer->v_Eye, hitboxpos);
if (bestFov > FOVDistance && FOVDistance < 40.0f)
{
bestFov = FOVDistance;
iBestTarget = i;
}
bestFov = FOVDistance;
iBestTarget = i;
}
if (IsMelee && distance < prev_distance)
{
prev_distance = distance;
iBestTarget = i;
}
}
if (iBestTarget != -1)
return ENTITY(iBestTarget);
else
return nullptr;
}
void Backtrack(CachedEntity *ent, int tick)
{
if (CE_GOOD(ent))
if (iBestTarget != -1 && CanShoot())
{
backtracked.first = ent->m_IDX;
backtracked.second = tick;
g_pUserCmd->tick_count = headPositions[ent->m_IDX][tick].tickcount;
int bestTick = 0;
float tempFOV = 9999;
float bestFOV = 40.0f;
float distance, prev_distance_ticks = 9999;
for (int t = 0; t < ticks; ++t)
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)
good_tick = true;
if (!good_tick)
continue;
tempFOV =
GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye,
headPositions[iBestTarget][t].hitboxpos);
if (IsMelee)
{
distance = g_pLocalPlayer->v_Eye.DistTo(
headPositions[iBestTarget][t].origin);
if (distance < (float) mindistance)
continue;
if (distance < prev_distance_ticks && tempFOV < 90.0f)
prev_distance_ticks = distance, bestTick = t;
}
else
{
if (bestFOV > tempFOV)
bestTick = t, bestFOV = tempFOV;
}
}
BestTick = bestTick;
if (cmd->buttons & IN_ATTACK)
cmd->tick_count = headPositions[iBestTarget][bestTick].tickcount;
}
}
void Draw()
@ -203,31 +189,40 @@ void Draw()
return;
if (!draw_bt)
return;
for (int i = 0; i < 32; i++)
for (int i = 0; i < g_IEngine->GetMaxClients(); i++)
{
for (int j = 0; j < ticks; j++)
{
bool good_tick = false;
for (int i = 0; i < 12; ++i)
if (j == sorted_ticks[i].tick)
good_tick = true;
if (!good_tick)
continue;
auto hbpos = headPositions[i][j].hitboxpos;
auto tickount = headPositions[i][j].tickcount;
auto min = headPositions[i][j].min;
auto max = headPositions[i][j].max;
if (!hbpos.x && !hbpos.y && !hbpos.z)
continue;
float size = 0.0f;
if (abs(max.x - min.x) > abs(max.y - min.y))
size = abs(max.x - min.x);
else
size = abs(max.y - min.y);
Vector out;
if (i == backtracked.first && j == backtracked.second)
if (draw::WorldToScreen(hbpos, out))
{
if (draw::WorldToScreen(hbpos, out))
float size = 0.0f;
if (abs(max.x - min.x) > abs(max.y - min.y))
size = abs(max.x - min.x);
else
size = abs(max.y - min.y);
if (i == iBestTarget && j == BestTick)
draw_api::draw_rect(out.x, out.y, size / 2, size / 2,
colors::red);
else
draw_api::draw_rect(out.x, out.y, size / 4, size / 4,
colors::green);
}
else if (draw::WorldToScreen(hbpos, out))
draw_api::draw_rect(out.x, out.y, size / 4, size / 4,
colors::green);
}
}
#endif
}
}

View File

@ -186,6 +186,39 @@ Timer level_init_timer{};
Timer micspam_on_timer{};
Timer micspam_off_timer{};
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);
if (!addr2)
return;
player_info_s local;
g_IEngine->GetPlayerInfo(g_pLocalPlayer->entity_idx, &local);
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
{
CachedEntity *ent = ENTITY(i);
// We only want a nullptr check since dormant entities are still on the
// server
if (!ent)
continue;
player_info_s info;
if (g_IEngine->GetPlayerInfo(i, &info))
{
if (info.friendsID == local.friendsID ||
playerlist::AccessData(info.friendsID).state ==
playerlist::k_EState::FRIEND ||
playerlist::AccessData(info.friendsID).state ==
playerlist::k_EState::IPC)
continue;
CSteamID id(info.friendsID, EUniverse::k_EUniversePublic,
EAccountType::k_EAccountTypeIndividual);
ReportPlayer_fn(id.ConvertToUint64(), 1);
}
}
}
CatCommand report("report_debug", "debug", []() { reportall(); });
void update()
{
if (!enabled)

View File

@ -523,7 +523,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent)
if (CE_BAD(ent))
return;
int classid = ent->m_iClassID();
int classid = ent->m_iClassID();
EntityType type = ent->m_Type();
// Grab esp data
ESPData &ent_data = data[ent->m_IDX];
@ -757,8 +757,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent)
rgba_t hp = colors::Transparent(
colors::Health(health, healthmax), fg.a);
rgba_t border =
((classid == RCC_PLAYER) &&
IsPlayerInvisible(ent))
((classid == RCC_PLAYER) && IsPlayerInvisible(ent))
? colors::FromRGBA8(160, 160, 160, fg.a * 255.0f)
: colors::Transparent(colors::black, fg.a);
// Get bar height
@ -1085,9 +1084,9 @@ void _FASTCALL ProcessEntity(CachedEntity *ent)
{
// Health pack esp
if (item_health_packs && (itemtype >= ITEM_HEALTH_SMALL &&
itemtype <= ITEM_HEALTH_LARGE ||
itemtype == ITEM_HL_BATTERY))
if (item_health_packs &&
(itemtype >= ITEM_HEALTH_SMALL && itemtype <= ITEM_HEALTH_LARGE ||
itemtype == ITEM_HL_BATTERY))
{
if (itemtype == ITEM_HEALTH_SMALL)
AddEntityString(ent, "[+]");
@ -1121,27 +1120,24 @@ void _FASTCALL ProcessEntity(CachedEntity *ent)
else if (item_powerups && itemtype >= ITEM_POWERUP_FIRST &&
itemtype <= ITEM_POWERUP_LAST)
{
AddEntityString(
ent, format(powerups[itemtype - ITEM_POWERUP_FIRST],
" PICKUP"));
AddEntityString(ent, format(powerups[itemtype - ITEM_POWERUP_FIRST],
" PICKUP"));
// TF2C weapon spawner esp
}
else if (item_weapon_spawners &&
itemtype >= ITEM_TF2C_W_FIRST &&
else if (item_weapon_spawners && itemtype >= ITEM_TF2C_W_FIRST &&
itemtype <= ITEM_TF2C_W_LAST)
{
AddEntityString(
ent,
format(tf2c_weapon_names[itemtype - ITEM_TF2C_W_FIRST],
" SPAWNER"));
ent, format(tf2c_weapon_names[itemtype - ITEM_TF2C_W_FIRST],
" SPAWNER"));
if (CE_BYTE(ent, netvar.bRespawning))
AddEntityString(ent, "-- RESPAWNING --");
// Halloween spell esp
}
else if (item_spellbooks && (itemtype == ITEM_SPELL ||
itemtype == ITEM_SPELL_RARE))
else if (item_spellbooks &&
(itemtype == ITEM_SPELL || itemtype == ITEM_SPELL_RARE))
{
if (itemtype == ITEM_SPELL)
{
@ -1176,9 +1172,8 @@ void _FASTCALL ProcessEntity(CachedEntity *ent)
const std::string &name =
(classid == CL_CLASS(CObjectTeleporter)
? "Teleporter"
: (classid == CL_CLASS(CObjectSentrygun)
? "Sentry Gun"
: "Dispenser"));
: (classid == CL_CLASS(CObjectSentrygun) ? "Sentry Gun"
: "Dispenser"));
int level = CE_INT(ent, netvar.iUpgradeLevel);
AddEntityString(ent, format("LV ", level, ' ', name));
}

View File

@ -30,8 +30,18 @@ static CatVar follow_activation(CV_INT, "fb_activation", "175",
"Activation Distance",
"How close a player should be until the "
"followbot will pick them as a target");
CatVar follow_steam(CV_INT, "fb_steam", "0", "Follow Steam Id",
"Set a steam id to let followbot prioritize players");
unsigned steamid = 0x0;
CatCommand follow_steam("fb_steam", "Follow Steam Id",
[](const CCommand &args) {
if (args.ArgC() < 1)
{
steamid = 0x0;
return;
}
unsigned tempid = atol(args.Arg(1));
steamid = *(unsigned int *) &tempid;
});
static CatVar mimic_slot(CV_SWITCH, "fb_mimic_slot", "0", "Mimic weapon slot",
"Mimic follow target's weapon slot");
static CatVar always_medigun(CV_SWITCH, "fb_always_medigun", "0",
@ -73,84 +83,80 @@ void WorldTick()
follow_target = 0;
}
// Target Selection
if (!follow_target)
{
breadcrumbs.clear(); // no target == no path
if (follow_steam)
// Target Selection
if (steamid)
{
// Find a target with the steam id, as it is prioritized
auto ent_count = HIGHEST_ENTITY;
for (int i = 0; i < ent_count; i++)
{
// Find a target with the steam id, as it is prioritized
auto ent_count = HIGHEST_ENTITY;
for (int i = 0; i < ent_count; i++)
{
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
continue;
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if ((int) follow_steam + 18 !=
entity->player_info.friendsID) // steamid check
continue;
logging::Info("Success");
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
continue;
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (steamid != entity->player_info.friendsID) // steamid check
continue;
logging::Info("Success");
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
if (!VisCheckEntFromEnt(LOCAL_E, entity))
continue;
follow_target = entity->m_IDX;
break;
}
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
if (!VisCheckEntFromEnt(LOCAL_E, entity))
continue;
follow_target = entity->m_IDX;
break;
}
// If we dont have a follow target from that, we look again for someone
// else who is suitable
if ((!follow_target || change) && roambot)
{
// Try to get a new target
auto ent_count = HIGHEST_ENTITY;
for (int i = 0; i < HIGHEST_ENTITY; i++)
{
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
continue;
if (!followcart)
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (entity == LOCAL_E) // Follow self lol
continue;
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
if (follow_activation &&
entity->m_flDistance() > (float) follow_activation)
continue;
if (!VisCheckEntFromEnt(LOCAL_E, entity))
continue;
const model_t *model =
ENTITY(follow_target)->InternalEntity()->GetModel();
if (followcart && model &&
(lagexploit::pointarr[0] || lagexploit::pointarr[1] ||
lagexploit::pointarr[2] || lagexploit::pointarr[3] ||
lagexploit::pointarr[4]) &&
(model == lagexploit::pointarr[0] ||
model == lagexploit::pointarr[1] ||
model == lagexploit::pointarr[2] ||
model == lagexploit::pointarr[3] ||
model == lagexploit::pointarr[4]))
follow_target = entity->m_IDX;
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (follow_target &&
ENTITY(follow_target)->m_flDistance() >
entity->m_flDistance()) // favor closer entitys
continue;
// ooooo, a target
follow_target = entity->m_IDX;
}
}
// last check for entity before we continue
if (!follow_target)
return;
}
// If we dont have a follow target from that, we look again for someone
// else who is suitable
if ((!follow_target || change) && roambot)
{
// Try to get a new target
auto ent_count = HIGHEST_ENTITY;
for (int i = 0; i < HIGHEST_ENTITY; i++)
{
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
continue;
if (!followcart)
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (entity == LOCAL_E) // Follow self lol
continue;
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
if (follow_activation &&
entity->m_flDistance() > (float) follow_activation)
continue;
if (!VisCheckEntFromEnt(LOCAL_E, entity))
continue;
const model_t *model =
ENTITY(follow_target)->InternalEntity()->GetModel();
if (followcart && model &&
(lagexploit::pointarr[0] || lagexploit::pointarr[1] ||
lagexploit::pointarr[2] || lagexploit::pointarr[3] ||
lagexploit::pointarr[4]) &&
(model == lagexploit::pointarr[0] ||
model == lagexploit::pointarr[1] ||
model == lagexploit::pointarr[2] ||
model == lagexploit::pointarr[3] ||
model == lagexploit::pointarr[4]))
follow_target = entity->m_IDX;
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (follow_target &&
ENTITY(follow_target)->m_flDistance() >
entity->m_flDistance()) // favor closer entitys
continue;
// ooooo, a target
follow_target = entity->m_IDX;
}
}
// last check for entity before we continue
if (!follow_target)
return;
// If the player is close enough, we dont need to follow the path
CachedEntity *followtar = ENTITY(follow_target);

View File

@ -301,12 +301,10 @@ void CreateMove()
amount = 2 * 90;
}
else if (CanShoot() && bIsHolding && !bWasHolding &&
classid !=
CL_CLASS(CTFFlareGun))
classid != CL_CLASS(CTFFlareGun))
amount = 1 * 90;
else if (CanShoot() && bIsHolding && !bWasHolding &&
classid ==
CL_CLASS(CTFFlareGun))
classid == CL_CLASS(CTFFlareGun))
amount = 2 * 90;
else if (bWasHolding && !bIsHolding)
amount = 1 * 90;
@ -321,12 +319,10 @@ void CreateMove()
if (not g_pLocalPlayer->holding_sniper_rifle)
{
if (CanShoot() && bIsHolding && !bWasHolding &&
classid !=
CL_CLASS(CTFFlareGun))
classid != CL_CLASS(CTFFlareGun))
amount = 1 * 90;
else if (CanShoot() && bIsHolding && !bWasHolding &&
classid ==
CL_CLASS(CTFFlareGun))
classid == CL_CLASS(CTFFlareGun))
amount = 2 * 90;
else if (bWasHolding && !bIsHolding)
amount = 1 * 90;
@ -373,8 +369,7 @@ void CreateMove()
if (stickyspam)
{
if (classid == (CL_CLASS(CTFCannon)) ||
classid ==
(CL_CLASS(CTFPipebombLauncher)))
classid == (CL_CLASS(CTFPipebombLauncher)))
{
static bool bSwitch = false;
bSwitch = !bSwitch;
@ -387,8 +382,7 @@ void CreateMove()
}
static int charge = 0;
if (g_pLocalPlayer->bAttackLastTick && infinitecharge &&
classid ==
(CL_CLASS(CTFPipebombLauncher)) &&
classid == (CL_CLASS(CTFPipebombLauncher)) &&
(g_pUserCmd->buttons & IN_ATTACK) &&
CE_BYTE(LOCAL_W, netvar.m_flChargeLevel))
{
@ -419,12 +413,10 @@ void CreateMove()
// If not the holding the same weapon as last tick or i(2) is smaller
// than 0.1f
// Get a new nextattack(2)
if (!nextattack || i < 0.1f ||
classid != lastwep)
if (!nextattack || i < 0.1f || classid != lastwep)
nextattack =
CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack);
if (!nextattack2 || i2 < 0.1f ||
classid != lastwep)
if (!nextattack2 || i2 < 0.1f || classid != lastwep)
nextattack2 = CE_FLOAT(g_pLocalPlayer->weapon(),
netvar.flNextSecondaryAttack);
// If the next attack (2) time would exceed 75 seconds, set it to 75 to

View File

@ -82,11 +82,11 @@ std::pair<int, int> WorldToRadar(int x, int y)
}
bool loaded = false;
textures::texture_atlas texture(DATA_PATH "/res/atlas.png", 1024, 512);
void DrawEntity(int x, int y, CachedEntity *ent)
{
static textures::texture_atlas texture(DATA_PATH "/res/atlas.png", 1024,
512);
if (!loaded)
{
if (texture.texture.handle == GLEZ_TEXTURE_INVALID &&
@ -99,28 +99,31 @@ void DrawEntity(int x, int y, CachedEntity *ent)
}
else if (texture.texture.handle != GLEZ_TEXTURE_INVALID)
loaded = true;
else
return;
return;
}
struct basesprite
{
textures::sprite sprite = texture.create_sprite(0, 0, 0, 0);
};
static std::array<std::array<basesprite, 9>, 3> tx_class;
static std::array<basesprite, 2> tx_teams;
static std::array<basesprite, 2> tx_items;
bool call = false;
if (call)
goto label1;
for (int i = 0; i < 3; i++)
for (int j = 0; j < 9; j++)
tx_class[i][j].sprite.setsprite(
64 * j, texture.height - 64 * (i + 1), 64, 64);
tx_teams[0].sprite.setsprite(11 * 64, texture.height - 128, 64, 64);
tx_teams[1].sprite.setsprite(11 * 64, texture.height - 64, 64, 64);
tx_items[0].sprite.setsprite(10 * 64, texture.height - 64, 64, 64);
tx_items[1].sprite.setsprite(10 * 64, texture.height - 128, 64, 64);
int idx;
tx_class[i][j].sprite.setsprite(64 * j, 64 * i, 64, 64);
tx_teams[0].sprite.setsprite(11 * 64, 128, 64, 64);
tx_teams[1].sprite.setsprite(11 * 64, 64, 64, 64);
tx_items[0].sprite.setsprite(10 * 64, 64, 64, 64);
tx_items[1].sprite.setsprite(10 * 64, 128, 64, 64);
call = true;
label1:
int idx = -1;
rgba_t clr;
float healthp;
float healthp = 0.0f;
if (CE_GOOD(ent))
{
@ -254,31 +257,24 @@ void Draw()
ent = ENTITY(i);
if (CE_BAD(ent))
continue;
if (!ent->m_bAlivePlayer())
continue;
if (i == g_IEngine->GetLocalPlayer())
continue;
if (ent->m_Type() == ENTITY_PLAYER)
{
if (!ent->m_bEnemy() && !show_teammates)
continue;
}
if (!show_teammates && ent->m_Type() == ENTITY_PLAYER &&
!ent->m_bEnemy())
continue;
if (!enemies_over_teammates || !show_teammates ||
ent->m_Type() != ENTITY_PLAYER)
DrawEntity(x, y, ent);
else if (ent->m_bEnemy())
enemies.push_back(ent);
else
{
if (ent->m_bEnemy())
enemies.push_back(ent);
else
DrawEntity(x, y, ent);
}
DrawEntity(x, y, ent);
}
if (enemies_over_teammates && show_teammates)
{
for (auto enemy : enemies)
{
DrawEntity(x, y, enemy);
}
}
if (CE_GOOD(LOCAL_E))
{
DrawEntity(x, y, LOCAL_E);

View File

@ -81,15 +81,12 @@ float target_time = 0.0f;
int last_hb_traced = 0;
Vector forward;
bool CanBacktrack(CachedEntity *entity)
bool CanBacktrack()
{
if (CE_BAD(entity))
return false;
if (entity->m_Type() != ENTITY_PLAYER)
return false;
int tick = hacks::shared::backtrack::Besttick(entity);
auto min = hacks::shared::backtrack::headPositions[entity->m_IDX][tick].min;
auto max = hacks::shared::backtrack::headPositions[entity->m_IDX][tick].max;
int target = hacks::shared::backtrack::iBestTarget;
int BestTick = hacks::shared::backtrack::BestTick;
auto min = hacks::shared::backtrack::headPositions[target][BestTick].min;
auto max = hacks::shared::backtrack::headPositions[target][BestTick].max;
if (!min.x && !max.x)
return false;
@ -114,14 +111,17 @@ bool CanBacktrack(CachedEntity *entity)
if (!IsVectorVisible(g_pLocalPlayer->v_Eye, minz) &&
!IsVectorVisible(g_pLocalPlayer->v_Eye, maxz))
return false;
if (CheckLineBox(minz, maxz, g_pLocalPlayer->v_Eye, forward, hit))
{
hacks::shared::backtrack::dontbacktrack = true;
hacks::shared::backtrack::Backtrack(entity, tick);
return true;
}
return false;
if (CheckLineBox(minz, maxz, g_pLocalPlayer->v_Eye, forward, hit))
{
g_pUserCmd->tick_count =
hacks::shared::backtrack::headPositions[target][BestTick].tickcount;
g_pUserCmd->buttons |= IN_ATTACK;
return false;
}
return true;
}
// The main "loop" of the triggerbot
void CreateMove()
@ -140,15 +140,14 @@ void CreateMove()
// Reset our last hitbox traced
last_hb_traced = -1;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++)
if (CanBacktrack(ENTITY(i)))
{
g_pUserCmd->buttons |= IN_ATTACK;
return;
}
// Get and ent in front of the player
CachedEntity *ent = FindEntInSight(EffectiveTargetingRange());
// Check if can backtrack, shoot if we can
if (!CanBacktrack())
return;
// Check if dormant or null to prevent crashes
if (CE_BAD(ent))
return;
@ -629,7 +628,7 @@ float EffectiveTargetingRange()
{
if (GetWeaponMode() == weapon_melee)
{
return re::C_TFWeaponBaseMelee::GetSwingRange(LOCAL_W);
return re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W));
// Pyros only have so much untill their flames hit
}
else if (g_pLocalPlayer->weapon()->m_iClassID() ==

View File

@ -149,7 +149,7 @@ const char *GetBuildingName(CachedEntity *ent)
{
if (!ent)
return "[NULL]";
int classid = ent->m_iClassID();
int classid = ent->m_iClassID();
if (classid == CL_CLASS(CObjectSentrygun))
return "Sentry";
if (classid == CL_CLASS(CObjectDispenser))
@ -513,7 +513,7 @@ bool VisCheckEntFromEntVector(Vector startVector, CachedEntity *startEnt,
Vector GetBuildingPosition(CachedEntity *ent)
{
Vector res;
res = ent->m_vecOrigin();
res = ent->m_vecOrigin();
int classid = ent->m_iClassID();
if (classid == CL_CLASS(CObjectDispenser))
res.z += 30;
@ -569,9 +569,10 @@ float DistToSqr(CachedEntity *entity)
void Patch(void *address, void *patch, size_t length)
{
void *page = (void *) ((uintptr_t) address & ~0xFFF);
mprotect(page, 0xFFF, PROT_WRITE | PROT_EXEC);
logging::Info("mprotect: %d",
mprotect(page, 0xFFF, PROT_READ | PROT_WRITE | PROT_EXEC));
memcpy(address, patch, length);
mprotect(page, 0xFFF, PROT_EXEC);
logging::Info("mprotect reverse: %d", mprotect(page, 0xFFF, PROT_EXEC));
}
bool IsProjectileCrit(CachedEntity *ent)
@ -598,7 +599,7 @@ weaponmode GetWeaponMode()
if (CE_BAD(weapon))
return weaponmode::weapon_invalid;
int classid = weapon->m_iClassID();
slot = re::C_BaseCombatWeapon::GetSlot(RAW_ENT(weapon));
slot = re::C_BaseCombatWeapon::GetSlot(RAW_ENT(weapon));
if (slot == 2)
return weaponmode::weapon_melee;
if (slot > 2)
@ -627,8 +628,7 @@ weaponmode GetWeaponMode()
{
return weaponmode::weapon_projectile;
}
else if (classid == CL_CLASS(CTFJar) ||
classid == CL_CLASS(CTFJarMilk))
else if (classid == CL_CLASS(CTFJar) || classid == CL_CLASS(CTFJarMilk))
{
return weaponmode::weapon_throwable;
}
@ -695,12 +695,11 @@ bool GetProjectileData(CachedEntity *weapon, float &speed, float &gravity)
else if (classid == CL_CLASS(CTFCompoundBow))
{
float chargetime =
g_GlobalVars->curtime - CE_FLOAT(weapon, netvar.flChargeBeginTime);
rspeed = (float) ((float) (fminf(fmaxf(chargetime, 0.0), 1.0) * 800.0) +
1800.0);
rgrav = (float) ((float) (fminf(fmaxf(chargetime, 0.0), 1.0) *
-0.40000001) +
0.5);
g_GlobalVars->curtime * g_GlobalVars->interval_per_tick -
CE_FLOAT(weapon, netvar.flChargeBeginTime) *
g_GlobalVars->interval_per_tick;
rspeed = (fminf(fmaxf(chargetime, 0.0f), 1.0f) * 800.0f) + 1800.0f;
rgrav = (fminf(fmaxf(chargetime, 0.0f), 1.0f) * -0.40000001f) + 0.5f;
}
else if (classid == CL_CLASS(CTFBat_Wood))
{
@ -1028,13 +1027,14 @@ void PrintChat(const char *fmt, ...)
CHudBaseChat *chat = (CHudBaseChat *) g_CHUD->FindElement("CHudChat");
if (chat)
{
std::unique_ptr<char> buf (new char[1024]);
std::unique_ptr<char> buf(new char[1024]);
va_list list;
va_start(list, fmt);
vsprintf(buf.get(), fmt, list);
va_end(list);
std::unique_ptr<char> str(strfmt("\x07%06X[\x07%06XCAT\x07%06X]\x01 %s",
0x5e3252, 0xba3d9a, 0x5e3252, buf.get()));
0x5e3252, 0xba3d9a, 0x5e3252,
buf.get()));
// FIXME DEBUG LOG
logging::Info("%s", str.get());
chat->Printf(str.get());

View File

@ -104,6 +104,11 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
float curtime_old, servertime, speed, yaw;
Vector vsilent, ang;
if (firstcm)
{
DelayTimer.update();
firstcm = false;
}
tickcount++;
g_pUserCmd = cmd;
#if not LAGBOT_MODE
@ -248,7 +253,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
if (CE_BAD(ent))
continue;
if (ent->player_info.friendsID ==
(int) hacks::shared::followbot::follow_steam)
hacks::shared::followbot::steamid)
{
found_entity = ent;
break;
@ -313,11 +318,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
hacks::tf::uberspam::CreateMove();
}
IF_GAME(IsTF2())
{
PROF_SECTION(CM_antibackstab);
hacks::tf2::antibackstab::CreateMove();
}
IF_GAME(IsTF2())
{
PROF_SECTION(CM_noisemaker);
hacks::tf2::noisemaker::CreateMove();
@ -341,6 +341,11 @@ 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;
@ -389,6 +394,11 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
PROF_SECTION(CM_autobackstab);
hacks::tf2::autobackstab::CreateMove();
}
IF_GAME(IsTF2())
{
PROF_SECTION(CM_autodeadringer);
hacks::shared::deadringer::CreateMove();
}
if (debug_projectiles)
projectile_logging::Update();
Prediction_CreateMove();
@ -503,9 +513,8 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
cmd->viewangles.y);
cmd->forwardmove = cos(yaw) * speed;
cmd->sidemove = sin(yaw) * speed;
if (hacks::tf2::antibackstab::noaa)
if (cmd->viewangles.x >= 90 && cmd->viewangles.x <= 270)
cmd->forwardmove = -cmd->forwardmove;
if (cmd->viewangles.x >= 90 && cmd->viewangles.x <= 270)
cmd->forwardmove = -cmd->forwardmove;
}
ret = false;
@ -516,6 +525,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
#endif
NET_StringCmd senddata(serverlag_string.GetString());
INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
senddata.SetNetChannel(ch);
senddata.SetReliable(false);
if (servercrash && DelayTimer.check((int) delay * 1000))
@ -540,12 +550,12 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
if (ch->GetAvgData(FLOW_INCOMING) != prevflow)
{
if (prevflowticks < 66 * (int) adjust)
serverlag_amount = (int) serverlag_amount + 1;
serverlag_amount = (int) serverlag_amount + 4;
prevflowticks = 0;
}
}
else if (votelogger::active &&
!votelogger::antikick.check(antikick_time * 1000))
if (votelogger::active &&
!votelogger::antikick.check(antikick_time * 1000))
{
static int additionallag = 1;
if (ch->GetAvgData(FLOW_INCOMING) == prevflow)
@ -561,7 +571,8 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
ch->SendNetMsg(senddata, false);
ch->Transmit();
}
else if (!votelogger::active && DelayTimer.check((int) delay * 1000))
else if (!votelogger::active && serverlag_amount &&
DelayTimer.check((int) delay * 1000))
{
for (int i = 0; i < (int) serverlag_amount; i++)
ch->SendNetMsg(senddata, false);

View File

@ -150,4 +150,4 @@ DEFINE_HOOKED_METHOD(GetFriendPersonaName, const char *, ISteamFriends *this_,
}
return original::GetFriendPersonaName(this_, steam_id);
}
}
}

View File

@ -89,7 +89,7 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
hacks::shared::backtrack::sequences.clear();
#endif
hacks::shared::autojoin::queuetime.update();
DelayTimer.update();
firstcm = true;
#if not LAGBOT_MODE
playerlist::Save();
#endif

View File

@ -12,7 +12,7 @@ static CatVar newlines_msg(CV_INT, "chat_newlines", "0", "Prefix newlines",
static CatVar log_sent(CV_SWITCH, "debug_log_sent_messages", "0",
"Log sent messages");
static CatVar airstuck(CV_KEY, "airstuck", "0", "Airstuck", "");
namespace hooked_methods
{
DEFINE_HOOKED_METHOD(SendNetMsg, bool, INetChannel *this_, INetMessage &msg,
@ -64,22 +64,6 @@ DEFINE_HOOKED_METHOD(SendNetMsg, bool, INetChannel *this_, INetMessage &msg,
{
lastcmd = g_GlobalVars->absoluteframetime;
}
if (airstuck.KeyDown() && !g_Settings.bInvalid)
{
if (CE_GOOD(LOCAL_E))
{
if (lastcmd + sv_player_usercommand_timeout->GetFloat() - 0.1f <
g_GlobalVars->curtime)
{
if (msg.GetType() == clc_Move)
return false;
}
else
{
lastcmd = g_GlobalVars->absoluteframetime;
}
}
}
if (log_sent && msg.GetType() != 3 && msg.GetType() != 9)
{
logging::Info("=> %s [%i] %s", msg.GetName(), msg.GetType(),

View File

@ -10,7 +10,7 @@ static CatVar die_if_vac(CV_SWITCH, "die_if_vac", "0", "Die if VAC banned");
static CatVar autoabandon(CV_SWITCH, "cbu_abandon", "0", "Auto abandon");
namespace hooked_methods
{
Timer t{};
DEFINE_HOOKED_METHOD(Shutdown, void, INetChannel *this_, const char *reason)
{
g_Settings.bInvalid = true;
@ -40,7 +40,15 @@ DEFINE_HOOKED_METHOD(Shutdown, void, INetChannel *this_, const char *reason)
}
if (autoabandon)
tfmm::dcandabandon();
{
t.update();
while (1)
if (t.test_and_set(5000))
{
tfmm::dcandabandon();
break;
}
}
if (hacks::shared::autojoin::auto_queue)
tfmm::queue_start();
}

View File

@ -3,6 +3,7 @@
*
* Created on: Jan 8, 2017
* Author: nullifiedcat
*
*/
#include "common.hpp"
@ -13,7 +14,7 @@
#include "netmessage.hpp"
#include <boost/algorithm/string.hpp>
#include <MiscTemporary.hpp>
#include "HookedMethods.hpp"
#if ENABLE_VISUALS
// This hook isn't used yet!
@ -69,6 +70,4 @@ static CatCommand minus_use_action_slot_item_server(
// static CatVar queue_messages(CV_SWITCH, "chat_queue", "0", "Queue messages",
// "Use this if you want to use spam/killsay and still be able to chat normally
// (without having your msgs eaten by valve cooldown)");
static CatVar server_crash_key(CV_KEY, "crash_server", "0", "Server crash key",
"hold key and wait...");
static CatVar airstuck(CV_KEY, "airstuck", "0", "Airstuck", "");

View File

@ -25,7 +25,8 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_,
if (!cathook ||
!(spectator_target || no_arms || no_hats ||
(clean_screenshots && g_IEngine->IsTakingScreenshot())))
(clean_screenshots && g_IEngine->IsTakingScreenshot()) ||
CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer()))
{
return original::DrawModelExecute(this_, state, info, bone);
}
@ -73,4 +74,4 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_,
return original::DrawModelExecute(this_, state, info, bone);
}
}
}

View File

@ -24,7 +24,10 @@ static CatVar
software_cursor_mode(software_cursor_enum, "software_cursor_mode", "0",
"Software cursor",
"Try to change this and see what works best for you");
static CatVar no_reportlimit(CV_SWITCH, "no_reportlimit", "0",
"no report limit",
"Remove playerlist report time limit");
bool replaced = false;
namespace hooked_methods
{
@ -47,6 +50,22 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
textures_loaded = true;
}
#endif
if (no_reportlimit && !replaced)
{
static unsigned char patch[] = { 0xB8, 0x01, 0x00, 0x00, 0x00 };
static uintptr_t report_addr = gSignatures.GetClientSignature(
"55 89 E5 57 56 53 81 EC ? ? ? ? 8B 5D ? 8B 7D ? 89 D8");
if (report_addr)
{
uintptr_t topatch = report_addr + 0x75;
logging::Info("No Report limit: 0x%08x", report_addr);
Patch((void *) topatch, (void *) patch, sizeof(patch));
replaced = true;
}
else
report_addr = gSignatures.GetClientSignature(
"55 89 E5 57 56 53 81 EC ? ? ? ? 8B 5D ? 8B 7D ? 89 D8");
}
if (pure_bypass)
{
if (!pure_addr)

10
src/localplayer.cpp Executable file → Normal file
View File

@ -19,17 +19,17 @@ void LocalPlayer::Update()
return;
}
holding_sniper_rifle = false;
holding_sapper = false;
holding_sapper = false;
wep = weapon();
if (CE_GOOD(wep))
{
weapon_mode = GetWeaponMode();
if (wep->m_iClassID() == CL_CLASS(CTFSniperRifle) ||
wep->m_iClassID() == CL_CLASS(CTFSniperRifleDecap))
holding_sniper_rifle = true;
wep->m_iClassID() == CL_CLASS(CTFSniperRifleDecap))
holding_sniper_rifle = true;
if (wep->m_iClassID() == CL_CLASS(CTFWeaponBuilder) ||
wep->m_iClassID() == CL_CLASS(CTFWeaponSapper))
holding_sapper = true;
wep->m_iClassID() == CL_CLASS(CTFWeaponSapper))
holding_sapper = true;
}
team = CE_INT(entity, netvar.iTeamNum);
life_state = CE_BYTE(entity, netvar.iLifeState);

View File

@ -78,7 +78,7 @@ void user_message(bf_read &buffer, int type)
int clz = g_pPlayerResource->GetClass(ENTITY(eid));
ReplaceString(msg, "$CLASS", format(tf_classes[clz]));
}
NET_StringCmd senddata(format("say", msg).c_str());
NET_StringCmd senddata(format("say ", msg).c_str());
INetChannel *ch =
(INetChannel *) g_IEngine->GetNetChannelInfo();
senddata.SetNetChannel(ch);