Improve LagExploit and Finally add a better Followbot

This commit is contained in:
BenCat07 2018-04-20 18:41:10 +02:00
parent 7c2f59c7d0
commit 1b717af47a
11 changed files with 300 additions and 1156 deletions

View File

@ -1,55 +1,23 @@
/*
* FollowBot.h
*
* Created on: Mar 19, 2017
* Author: nullifiedcat
*
*
*
*/
#pragma once
#include "common.hpp";
#if ENABLE_IPC == 1
namespace hacks {
namespace shared {
namespace followbot {
#include "common.hpp"
// Followed entity, externed for highlight color
extern int follow_target;
extern CatVar followbot;
extern CatVar follow_steam;
void DrawTick();
void WorldTick();
namespace hacks
{
namespace shared
{
namespace followbot
{
enum class EFollowType
{
VECTOR, // When we need to goto a vector
ENTITY // when we dont have a specific steamid, but we still want to follow
// an entity
};
// extern CatCommand move_to_crosshair;
// extern CatCommand follow;
// extern CatCommand follow_entity;
extern CatVar bot;
extern unsigned follow_steamid;
extern int following_idx;
bool IsBot(CachedEntity *entity);
void AddMessageHandlers(ipc::peer_t *peer);
void AfterCreateMove();
#if ENABLE_VISUALS == 1
void Draw();
#endif
void CrumbReset();
void CrumbTopAdd(Vector crumbToAdd);
void CrumbBottomAdd();
void DoWalking();
void DrawFollowbot();
std::pair<float, float> ComputeMove(const Vector &a, const Vector &b);
void WalkTo(const Vector &vector);
unsigned MakeMask();
void SelectEntity(int idx);
}
}
}
#endif

View File

@ -18,11 +18,8 @@ namespace shared
{
namespace lagexploit
{
extern const model_t *point;
extern const model_t *point2;
extern const model_t *point3;
extern const model_t *point4;
extern const model_t *point5;
extern const model_t *pointarr[5];
extern bool bcalled;
void CreateMove();
void Draw();
void AddExploitTicks(int ticks);

View File

@ -554,8 +554,8 @@ int HealingPriority(int idx)
#if ENABLE_IPC == 1
if (ipc::peer)
{
if (hacks::shared::followbot::bot &&
hacks::shared::followbot::following_idx == idx)
if (hacks::shared::followbot::followbot &&
hacks::shared::followbot::follow_target == idx)
{
priority *= 3.0f;
}

File diff suppressed because it is too large Load Diff

View File

@ -46,15 +46,12 @@ CatVar master_switch(CV_SWITCH, "se_master", "1", "Enable sequence exploit",
"disables everything else that uses it");
CatVar value(CV_INT, "se_value", "900", "Sequence exploit value",
"Value of user cmds to spam with");
CatVar cap_range(CV_FLOAT, "se_cap_range", "200.0f", "Autocap range", "Autocap range, increase if you notice that you only lagy once you are already in the cap zone");
CatCommand do_lagexploit("se_do", "Sequence exploit (for use in scripts)",
[]() { AddExploitTicks(6); });
int exticks = 0;
const model_t *point = nullptr;
const model_t *point2 = nullptr;
const model_t *point3 = nullptr;
const model_t *point4 = nullptr;
const model_t *point5 = nullptr;
int exticks = 0;
const model_t *pointarr[5] = { nullptr, nullptr, nullptr, nullptr, nullptr };
bool bcalled = false;
void AddExploitTicks(int ticks)
{
exticks = std::max(ticks, exticks);
@ -159,9 +156,8 @@ void CreateMove()
if (!g_pUserCmd->command_number)
return;
int amount = 0;
for (int i = 1; i < HIGHEST_ENTITY; i++)
{
if (!point2)
if (!bcalled)
for (int i = 1; i < HIGHEST_ENTITY; i++)
{
CachedEntity *pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
@ -170,51 +166,23 @@ void CreateMove()
if (!model)
continue;
const char *model_name = g_IModelInfo->GetModelName(model);
if (strstr("models/props_gameplay/cap_point_base.mdl", model_name))
pointarr[0] = model;
if (strstr("models/props_trainyard/bomb_cart.mdl", model_name))
point2 = model;
}
if (!point3)
{
CachedEntity *pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
continue;
const model_t *model = RAW_ENT(pEnt)->GetModel();
if (!model)
continue;
const char *model_name = g_IModelInfo->GetModelName(model);
pointarr[1] = model;
if (strstr("models/props_2fort/trainwheel001.mdl", model_name))
point3 = model;
}
if (!point4)
{
CachedEntity *pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
continue;
const model_t *model = RAW_ENT(pEnt)->GetModel();
if (!model)
continue;
const char *model_name = g_IModelInfo->GetModelName(model);
pointarr[2] = model;
if (strstr("models/custom/dirty_bomb_cart.mdl", model_name))
point4 = model;
}
if (!point5)
{
CachedEntity *pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
continue;
const model_t *model = RAW_ENT(pEnt)->GetModel();
if (!model)
continue;
const char *model_name = g_IModelInfo->GetModelName(model);
pointarr[3] = model;
if (strstr("models/props_trainyard/bomb_cart_red.mdl", model_name))
point5 = model;
pointarr[4] = model;
}
}
bcalled = true;
if (cart)
{
for (int i = 1; i < HIGHEST_ENTITY; i++)
{
if (!point2 && !point3 && !point4 && !point5)
if (!pointarr[1] && !pointarr[2] && !pointarr[3] && !pointarr[4])
continue;
CachedEntity *pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
@ -224,8 +192,8 @@ void CreateMove()
const model_t *model = RAW_ENT(pEnt)->GetModel();
if (!model)
continue;
if (model == point2 || model == point3 || model == point4 ||
model == point5)
if (model == pointarr[1] || model == pointarr[2] ||
model == pointarr[3] || model == pointarr[4])
{
if (!CE_GOOD(LOCAL_E))
continue;
@ -274,22 +242,7 @@ void CreateMove()
{
for (int i = 1; i < HIGHEST_ENTITY; i++)
{
if (!point)
{
CachedEntity *pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
continue;
const model_t *model = RAW_ENT(pEnt)->GetModel();
if (!model)
continue;
const char *model_name = g_IModelInfo->GetModelName(model);
if (strstr("models/props_gameplay/cap_point_base.mdl",
model_name))
point = model;
else
continue;
}
if (!point)
if (!pointarr[0])
continue;
CachedEntity *pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
@ -299,7 +252,7 @@ void CreateMove()
const model_t *model = RAW_ENT(pEnt)->GetModel();
if (!model)
continue;
if (model == point)
if (model == pointarr[0])
{
if (!CE_GOOD(LOCAL_E))
continue;
@ -310,9 +263,9 @@ void CreateMove()
const Vector &min1 =
p->OBBMins() + RAW_ENT(LOCAL_E)->GetAbsOrigin();
const Vector &max2 =
c->OBBMaxs() + pEnt->m_vecOrigin + Vector(200, 200, 200);
c->OBBMaxs() + pEnt->m_vecOrigin + Vector((float)cap_range, (float)cap_range, (float)cap_range);
const Vector &min2 =
c->OBBMins() + pEnt->m_vecOrigin - Vector(200, 200, 200);
c->OBBMins() + pEnt->m_vecOrigin - Vector((float)cap_range, (float)cap_range, (float)cap_range);
if ((min1.x <= max2.x && max1.x >= min2.x) &&
(min1.y <= max2.y && max1.y >= min2.y) &&
(min1.z <= max2.z && max1.z >= min2.z))
@ -407,15 +360,11 @@ void CreateMove()
(CL_CLASS(CTFPipebombLauncher)))
{
static bool bSwitch = false;
if ((g_pUserCmd->buttons & IN_ATTACK) && !bSwitch)
{
bSwitch = true;
}
else if (bSwitch)
bSwitch = !bSwitch;
if ((g_pUserCmd->buttons & IN_ATTACK) && bSwitch)
{
amount = 1 * 50;
g_pUserCmd->buttons &= ~IN_ATTACK;
bSwitch = false;
}
}
}
@ -430,53 +379,88 @@ void CreateMove()
// SHOUTOUTS TO BLACKFIRE
if (doom || razorback)
{
static int i = 0;
static int i2 = 0;
// Variablse to store Primary and secondary nextfire times
static float i = 0.0;
static float i2 = 0.0;
// Servertime to predict the next Primary and secondary times in seconds
servertime =
(float) (CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) *
g_GlobalVars->interval_per_tick;
if (!nextattack || !i ||
// 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 ||
g_pLocalPlayer->weapon()->m_iClassID != lastwep)
nextattack =
CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack);
if (!nextattack2 || !i ||
if (!nextattack2 || i2 < 0.1f ||
g_pLocalPlayer->weapon()->m_iClassID != lastwep)
nextattack2 = CE_FLOAT(g_pLocalPlayer->weapon(),
netvar.flNextSecondaryAttack);
// If the next attack (2) time would exceed 75 seconds, set it to 75 to prevent
// The server disconnecting you for lagging too much
if (servertime - nextattack > 75.0f)
nextattack = servertime - 75.0f;
if (servertime - nextattack2 > 75.0f)
nextattack2 = servertime - 75.0f;
// If doom is active and nextattack is positive (not reloading/holding m1 since a while)
// and you are holding m1 run the Doom code
if (doom && servertime - nextattack > 0.0f &&
g_pUserCmd->buttons & IN_ATTACK)
{
if (!i)
i = ((int) servertime - (int) nextattack);
static bool bSwitcc = true;
if (CE_INT(LOCAL_E, netvar.iItemDefinitionIndex) == 58)
bSwitcc = !bSwitcc;
else
bSwitcc = true;
if (bSwitcc)
{
amount = i * 66;
if (CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) == 0)
g_pUserCmd->buttons &= ~IN_ATTACK;
}
// Incase i ever goes below 0.1 recalculate it (or if it's just inited)
if (i < 0.1f)
i = servertime - (int) nextattack;
// Set amount to i * 66 (which lags for i seconds)
amount = i * 66;
// Don't attack if the clip is empty so you also instantly reload
if (!CE_BYTE(g_pLocalPlayer->weapon(), netvar.m_iClip1))
g_pUserCmd->buttons &= ~IN_ATTACK;
}
// If doom is active and nextattack2 is positive (not reloading/holding m2 since a while)
// and you are holding m2 run the Doom code
if (doom && servertime - nextattack2 > 0.0f &&
g_pUserCmd->buttons & IN_ATTACK2)
{
if (!i2)
i2 = ((int) servertime - (int) nextattack2);
// Incase i2 ever goes below 0.1 recalculate it (or if it's just inited)
if (i2 < 0.1f)
i2 = servertime - nextattack2;
// Set lagexploit amount (i * 66 = i seconds of lag)
amount = i2 * 66;
// if primary ammo is empty don't hold m2, not a byte check since many weapons may not have a secondary clip
if (CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip2) == 0)
g_pUserCmd->buttons &= ~IN_ATTACK2;
}
// if anti-razorback is active and you can stab through the shieled
if (razorback && servertime - nextattack > 3.0f &&
(g_pUserCmd->buttons & IN_ATTACK ||
g_pUserCmd->buttons & IN_ATTACK2))
(g_pUserCmd->buttons & IN_ATTACK))
{
CachedEntity* snoiper = nullptr;
for (int ii = 0; i < g_IEngine->GetMaxClients(); i++) {
CachedEntity* snooiper = ENTITY(i);
// nullptr and dormant check
if (CE_BAD(snooiper))
continue;
// Alive check
if (!snooiper->m_bAlivePlayer)
continue;
// Vischeck
if (!VisCheckEntFromEnt(LOCAL_E, snooiper))
continue;
// Range should be more than high enough
if (!snooiper->m_flDistance < 200.0f)
continue;
int clazz = CE_INT(snooiper, netvar.iClass);
if (clazz != tf_sniper)
continue;
// found entity
snoiper = snooiper;
// Break if you found an Entity, no need to go on further checking
break;
}
// Return if no snipers were found
if (CE_BAD(snoiper))
return;
// Only works with knife out obviously
if (g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFKnife))
{
if (!i)
@ -485,34 +469,41 @@ void CreateMove()
g_pUserCmd->buttons |= IN_ATTACK;
}
}
if (i)
i--;
// If i is not below 0.1f then substract one from it to slowly decrease lag amount
if (i > 0.1f)
i -= 1.0f;
// Set last weapon classid
lastwep = g_pLocalPlayer->weapon()->m_iClassID;
}
// if Jarate spam active
if (piss)
{
// Get Servertime
servertime =
(float) (CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) *
g_GlobalVars->interval_per_tick;
// Get nextattack when it's invalid or the player selected another weapon (which is a tick, not a time like 1 second, but servertime + 1 second)
if (!nextattack || g_pLocalPlayer->weapon()->m_iClassID != lastwep)
nextattack =
CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack);
// Set last weapon since it's not needed anymore this cycle
lastwep = g_pLocalPlayer->weapon()->m_iClassID;
// Check if holding JARAAATE
if (CE_INT(g_pLocalPlayer->weapon(), netvar.iItemDefinitionIndex) == 58)
{
// Setup Switch variable to not constantly spam jarate, since else the jarate may vanish
static int bSwitch = 0;
// Only play Piss.wav once every second
if ((g_pUserCmd->command_number % 66) == 0 &&
(g_pUserCmd->buttons & IN_ATTACK))
announcer::playsound("piss.wav");
// If in attack and bSwitch is 0 do not attack but increment bSwitch
if ((g_pUserCmd->buttons & IN_ATTACK) && !bSwitch)
{
static int bswitch2 = 0;
if (bswitch2 > 20)
{
announcer::playsound("piss.wav");
bswitch2 = 0;
}
bswitch2++;
bSwitch++;
g_pUserCmd->buttons &= ~IN_ATTACK;
}
// Else attack and set bSwitch to 0 once it's over 20
else if (bSwitch)
{
amount = 21 * 66;
@ -540,13 +531,13 @@ void Draw()
#if ENABLE_VISUALS == 1
if (doom && (servertime - nextattack > 0.0f || servertime - nextattack2))
{
auto amount = (int) servertime - (int) nextattack;
auto amount2 = (int) servertime - (int) nextattack2;
auto amount = servertime - nextattack;
auto amount2 = servertime - nextattack2;
if (amount > 0.0f)
AddCenterString(format("Fireable Primary amount: ", amount),
AddCenterString(format("Fireable Primary amount: ", (int)amount),
colors::orange);
if (amount2 > 0.0f)
AddCenterString(format("Fireable Secondary amount: ", amount2),
AddCenterString(format("Fireable Secondary amount: ", (int)amount2),
colors::orange);
}
if (razorback)
@ -569,7 +560,7 @@ void Draw()
else if (servertime - nextattack < 21.0f)
AddCenterString(
format("Can't spam piss, ",
(int) (((float) servertime - (float) nextattack) * 100 /
(int) ((servertime - nextattack) * 100 /
21),
"% charge"),
colors::red);

View File

@ -1198,8 +1198,8 @@ void Move()
if (boost::contains(prvlvlname, "pl_"))
{
bool ret = false;
if (lagexploit::point || lagexploit::point2 || lagexploit::point3 ||
lagexploit::point4 || lagexploit::point5)
if (lagexploit::pointarr[0] || lagexploit::pointarr[1] || lagexploit::pointarr[2] ||
lagexploit::pointarr[3] || lagexploit::pointarr[4])
for (int i = 0; i < MAX_ENTITIES; i++)
{
if (!ret)
@ -1212,10 +1212,10 @@ void Move()
const model_t *model = RAW_ENT(ent)->GetModel();
if (model)
{
if ((model == lagexploit::point2 ||
model == lagexploit::point3 ||
model == lagexploit::point4 ||
model == lagexploit::point5) &&
if ((model == lagexploit::pointarr[1] ||
model == lagexploit::pointarr[2] ||
model == lagexploit::pointarr[3] ||
model == lagexploit::pointarr[4]) &&
ent->m_flDistance < 400.0f &&
IsVectorVisible(g_pLocalPlayer->v_Eye,
ent->m_vecOrigin))

View File

@ -252,9 +252,9 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
static float last_jointeam_try = 0;
CachedEntity *found_entity, *ent;
if (hacks::shared::followbot::bot)
if (hacks::shared::followbot::followbot)
{
hacks::shared::followbot::WorldTick();
if (g_GlobalVars->curtime < last_jointeam_try)
{
team_joining_state = 0;
@ -287,7 +287,7 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
if (CE_BAD(ent))
continue;
if (ent->player_info.friendsID ==
hacks::shared::followbot::follow_steamid)
(int)hacks::shared::followbot::follow_steam)
{
found_entity = ent;
break;
@ -530,13 +530,6 @@ bool CreateMove_hook(void *thisptr, float inputSample, CUserCmd *cmd)
ret = false;
}
#if ENABLE_IPC == 1
if (CE_GOOD(g_pLocalPlayer->entity) && !g_pLocalPlayer->life_state)
{
PROF_SECTION(CM_followbot);
hacks::shared::followbot::AfterCreateMove();
}
#endif
if (cmd)
g_Settings.last_angles = cmd->viewangles;
}

View File

@ -1019,6 +1019,7 @@ void LevelInit_hook(void *_this, const char *newmap)
static const LevelInit_t original =
(LevelInit_t) hooks::clientmode.GetMethod(offsets::LevelInit());
playerlist::Save();
hacks::shared::lagexploit::bcalled = false;
typedef bool *(*LoadNamedSkys_Fn)(const char *);
uintptr_t addr =
gSignatures.GetEngineSignature("55 89 E5 57 31 FF 56 8D B5 ? ? ? ? 53 "
@ -1035,10 +1036,12 @@ void LevelInit_hook(void *_this, const char *newmap)
#endif
logging::Info("Loaded Skybox: %s", succ ? "true" : "false");
ConVar *holiday = g_ICvar->FindVar("tf_forced_holiday");
if (halloween_mode)
holiday->SetValue(2);
else if (holiday->m_nValue == 2)
holiday->SetValue(2);
g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec");
hacks::shared::aimbot::Reset();
chat_stack::Reset();

View File

@ -49,7 +49,6 @@ CatCommand connect("ipc_connect", "Connect to IPC server", []() {
hack::command_stack().push(
std::string((const char *) payload));
});
hacks::shared::followbot::AddMessageHandlers(peer);
user_data_s &data = peer->memory->peer_user_data[peer->client_id];
// Preserve accumulated data

View File

@ -678,7 +678,7 @@ static const std::string list_tf2 = R"(
"bptf_enable"
"Followbot"[
"Followbot Menu"
"fb_bot"
"fb"
"fb_autoteam"
"fb_autoclass"
"fb_activation"
@ -687,7 +687,7 @@ static const std::string list_tf2 = R"(
"fb_sync_taunt"
"fb_always_medigun"
"fb_roaming"
"fb_crumb_draw"
"fb_draw"
]
"Catbot Utilities"[
"Catbot Utilities Menu"

View File

@ -145,7 +145,7 @@ void DrawCheatVisuals()
hacks::tf::spyalert::Draw();
}
#if ENABLE_IPC == 1
IF_GAME(IsTF()) hacks::shared::followbot::Draw();
IF_GAME(IsTF()) hacks::shared::followbot::DrawTick();
#endif
{
PROF_SECTION(DRAW_esp);