Merge remote-tracking branch 'nullworks/master' into IRCLIb

This commit is contained in:
TotallyNotElite 2018-10-06 21:02:55 +02:00
commit 203e4e4737
7 changed files with 85 additions and 80 deletions

View File

@ -7,6 +7,8 @@
#pragma once #pragma once
#include "config.h"
#include "common.hpp"
#include <cstddef> #include <cstddef>
class KeyValues; class KeyValues;
@ -24,6 +26,7 @@ struct ac_data
extern int amount[32]; extern int amount[32];
void ResetEverything(); void ResetEverything();
std::unordered_map<int, Vector> &player_orgs();
void ResetPlayer(int idx); void ResetPlayer(int idx);
void Init(); void Init();

View File

@ -243,6 +243,8 @@ public:
struct MAP : public micropather::Graph struct MAP : public micropather::Graph
{ {
std::unique_ptr<micropather::MicroPather> pather; std::unique_ptr<micropather::MicroPather> pather;
std::unordered_map<std::pair<int, int>, int, boost::hash<std::pair<int, int>>> vischeck_cd;
Timer vischeck_t{};
// Maps already utilize dynamic allocation and we don't need a custom // Maps already utilize dynamic allocation and we don't need a custom
// constructor // constructor
inactivityTracker inactiveTracker; inactivityTracker inactiveTracker;
@ -321,8 +323,20 @@ struct MAP : public micropather::Graph
micropather::StateCost cost; micropather::StateCost cost;
cost.state = static_cast<void *>(&areas.at(id)); cost.state = static_cast<void *>(&areas.at(id));
cost.cost = area->m_center.DistTo(i.area->m_center); cost.cost = area->m_center.DistTo(i.area->m_center);
if (!inactiveTracker.vischeckConnection(connection)) if (vischeck_t.test_and_set(2000))
cost.cost *= 999; vischeck_cd.clear();
if (vischeck_cd[connection] == 0)
{
if (!inactiveTracker.vischeckConnection(connection))
{
cost.cost *= 99;
vischeck_cd[connection] = 2;
}
else
vischeck_cd[connection] = 1;
}
else if (vischeck_cd[connection] == 2)
cost.cost *= 99;
adjacent->push_back(cost); adjacent->push_back(cost);
} }
} }

View File

@ -10,6 +10,7 @@
#include <hacks/ac/bhop.hpp> #include <hacks/ac/bhop.hpp>
#include <settings/Bool.hpp> #include <settings/Bool.hpp>
#include "common.hpp" #include "common.hpp"
#include "PlayerTools.hpp"
#include "hack.hpp" #include "hack.hpp"
static settings::Bool enable{ "find-cheaters.enable", "0" }; static settings::Bool enable{ "find-cheaters.enable", "0" };
@ -57,18 +58,24 @@ void CreateMove()
if (!enable) if (!enable)
return; return;
angles::Update(); angles::Update();
for (int i = 1; i < 33; i++) ac::aimbot::player_orgs().clear();
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
{ {
if (skip_local && (i == g_IEngine->GetLocalPlayer())) if (skip_local && (i == g_IEngine->GetLocalPlayer()))
continue; continue;
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_GOOD(ent)) if (CE_GOOD(ent))
{ {
if ((CE_BYTE(ent, netvar.iLifeState) == 0)) if (ent->m_bAlivePlayer())
{ {
ac::aimbot::Update(ent); if (player_tools::shouldTarget(ent) ==
ac::antiaim::Update(ent); player_tools::IgnoreReason::DO_NOT_IGNORE ||
ac::bhop::Update(ent); ent == LOCAL_E)
{
ac::aimbot::Update(ent);
ac::antiaim::Update(ent);
ac::bhop::Update(ent);
}
} }
} }
} }

View File

@ -12,7 +12,8 @@ static settings::Int aimkey_mode{ "sandwichaim.aimkey-mode", "0" };
float sandwich_speed = 350.0f; float sandwich_speed = 350.0f;
float grav = 0.25f; float grav = 0.25f;
std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool zcheck) std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict,
bool zcheck)
{ {
CachedEntity *bestent = nullptr; CachedEntity *bestent = nullptr;
float bestscr = FLT_MAX; float bestscr = FLT_MAX;
@ -21,7 +22,8 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || !(ent->m_bAlivePlayer()) || if (CE_BAD(ent) || !(ent->m_bAlivePlayer()) ||
(teammate && ent->m_iTeam() != LOCAL_E->m_iTeam()) || ent == LOCAL_E) (teammate && ent->m_iTeam() != LOCAL_E->m_iTeam()) ||
ent == LOCAL_E)
continue; continue;
if (!teammate && ent->m_iTeam() == LOCAL_E->m_iTeam()) if (!teammate && ent->m_iTeam() == LOCAL_E->m_iTeam())
continue; continue;
@ -30,7 +32,7 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
Vector target{}; Vector target{};
if (Predict) if (Predict)
target = ProjectilePrediction(ent, 1, sandwich_speed, grav, target = ProjectilePrediction(ent, 1, sandwich_speed, grav,
PlayerGravityMod(ent)); PlayerGravityMod(ent));
else else
target = ent->hitboxes.GetHitbox(1)->center; target = ent->hitboxes.GetHitbox(1)->center;
if (!IsEntityVectorVisible(ent, target)) if (!IsEntityVectorVisible(ent, target))
@ -42,12 +44,12 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
scr *= 0.1f; scr *= 0.1f;
if (scr < bestscr) if (scr < bestscr)
{ {
bestent = ent; bestent = ent;
predicted = target; predicted = target;
bestscr = scr; bestscr = scr;
} }
} }
return {bestent, predicted}; return { bestent, predicted };
} }
static HookedFunction static HookedFunction
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() { SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() {
@ -76,7 +78,7 @@ static HookedFunction
Vector Predict; Vector Predict;
CachedEntity *bestent = nullptr; CachedEntity *bestent = nullptr;
std::pair<CachedEntity *, Vector> result{}; std::pair<CachedEntity *, Vector> result{};
result = FindBestEnt(true, true, false); result = FindBestEnt(true, true, false);
bestent = result.first; bestent = result.first;
Predict = result.second; Predict = result.second;
if (bestent) if (bestent)
@ -91,26 +93,27 @@ static HookedFunction
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
} }
}); });
static settings::Bool charge_aim{ "chargeaim.enable", "false"}; static settings::Bool charge_aim{ "chargeaim.enable", "false" };
static HookedFunction ChargeAimbot(HookedFunctions_types::HF_CreateMove, "ChargeAim", 1, [](){ static HookedFunction
if (!*charge_aim) ChargeAimbot(HookedFunctions_types::HF_CreateMove, "ChargeAim", 1, []() {
return; if (!*charge_aim)
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer()) return;
return; if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (!HasCondition<TFCond_Charging>(LOCAL_E)) return;
return; if (!HasCondition<TFCond_Charging>(LOCAL_E))
std::pair<CachedEntity *, Vector> result{}; return;
result = FindBestEnt(false, false, true); std::pair<CachedEntity *, Vector> result{};
CachedEntity *bestent = result.first; result = FindBestEnt(false, false, true);
if (bestent && result.second.IsValid()) CachedEntity *bestent = result.first;
{ if (bestent && result.second.IsValid())
Vector tr = result.second - g_pLocalPlayer->v_Eye; {
Vector angles; Vector tr = result.second - g_pLocalPlayer->v_Eye;
VectorAngles(tr, angles); Vector angles;
// Clamping is important VectorAngles(tr, angles);
fClampAngle(angles); // Clamping is important
current_user_cmd->viewangles = angles; fClampAngle(angles);
current_user_cmd->buttons |= IN_ATTACK2; current_user_cmd->viewangles = angles;
g_pLocalPlayer->bUseSilentAngles = true; current_user_cmd->buttons |= IN_ATTACK2;
} g_pLocalPlayer->bUseSilentAngles = true;
}); }
});

View File

@ -361,8 +361,15 @@ bool NavToEnemy()
{ {
int nearestvalid{}; int nearestvalid{};
if (!*heavy_mode) if (!*heavy_mode)
nearestvalid = {
nav::FindNearestValidbyDist(ent->m_vecOrigin(), 1000, 4000); int range = 0;
while (nearestvalid == -1 && range < 5000)
{
nearestvalid = nav::FindNearestValidbyDist(
ent->m_vecOrigin(), 2000 - range / 4, 6000 - range);
range += 300.0f;
}
}
else else
nearestvalid = nearestvalid =
nav::FindNearestValidbyDist(ent->m_vecOrigin(), 200, 1000); nav::FindNearestValidbyDist(ent->m_vecOrigin(), 200, 1000);

View File

@ -20,15 +20,22 @@ namespace ac::aimbot
ac_data data_table[32]; ac_data data_table[32];
int amount[32]; int amount[32];
std::unordered_map<int, Vector> Player_origs{};
std::unordered_map<int, Vector> & player_orgs()
{
return Player_origs;
}
void ResetEverything() void ResetEverything()
{ {
memset(&data_table, 0, sizeof(ac_data) * 32); memset(&data_table, 0, sizeof(ac_data) * 32);
Player_origs.clear();
} }
void ResetPlayer(int idx) void ResetPlayer(int idx)
{ {
memset(&data_table[idx - 1], 0, sizeof(ac_data)); memset(&data_table[idx - 1], 0, sizeof(ac_data));
Player_origs.clear();
} }
void Init() void Init()
@ -40,6 +47,7 @@ void Update(CachedEntity *player)
{ {
if (!enable) if (!enable)
return; return;
Player_origs[player->m_IDX] = player->m_vecOrigin();
auto &data = data_table[player->m_IDX - 1]; auto &data = data_table[player->m_IDX - 1];
auto &am = amount[player->m_IDX - 1]; auto &am = amount[player->m_IDX - 1];
if (data.check_timer) if (data.check_timer)
@ -107,12 +115,12 @@ void Event(KeyValues *event)
int victim = event->GetInt("userid"); int victim = event->GetInt("userid");
int eid = g_IEngine->GetPlayerForUserID(attacker); int eid = g_IEngine->GetPlayerForUserID(attacker);
int vid = g_IEngine->GetPlayerForUserID(victim); int vid = g_IEngine->GetPlayerForUserID(victim);
if (eid > 0 && eid < 33) if (eid > 0 && eid < 33 && vid > 0 && vid < 33)
{ {
CachedEntity *victim = ENTITY(vid); CachedEntity *victim = ENTITY(vid);
CachedEntity *attacker = ENTITY(eid); CachedEntity *attacker = ENTITY(eid);
if (CE_GOOD(victim) && CE_GOOD(attacker)) if (Player_origs[vid].z != 0 && Player_origs[eid].z != 0)
if (victim->m_vecOrigin().DistTo(attacker->m_vecOrigin()) > 250) if (Player_origs[vid].DistTo(Player_origs[eid]) > 250)
{ {
data_table[eid - 1].check_timer = 1; data_table[eid - 1].check_timer = 1;
data_table[eid - 1].last_weapon = event->GetInt("weaponid"); data_table[eid - 1].last_weapon = event->GetInt("weaponid");

View File

@ -40,14 +40,11 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
unsigned int panel, bool force, bool allow_force) unsigned int panel, bool force, bool allow_force)
{ {
static bool textures_loaded = false; static bool textures_loaded = false;
static unsigned long panel_focus = 0;
static unsigned long panel_scope = 0; static unsigned long panel_scope = 0;
static unsigned long panel_top = 0;
static bool cur, draw_flag = false;
static bool call_default = true; static bool call_default = true;
static bool cur;
static ConVar *software_cursor = g_ICvar->FindVar("cl_software_cursor"); static ConVar *software_cursor = g_ICvar->FindVar("cl_software_cursor");
static const char *name; static const char *name;
static std::string name_s, name_stripped, reason_stripped;
#if ENABLE_VISUALS #if ENABLE_VISUALS
if (!textures_loaded) if (!textures_loaded)
@ -175,33 +172,6 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
original::PaintTraverse(this_, panel, force, allow_force); original::PaintTraverse(this_, panel, force, allow_force);
// To avoid threading problems. // To avoid threading problems.
if (panel == panel_top)
draw_flag = true;
if (!isHackActive())
return;
if (!panel_top)
{
name = g_IPanel->GetName(panel);
if (strlen(name) > 4)
{
if (name[0] == 'M' && name[3] == 'S')
{
panel_top = panel;
}
}
}
if (!panel_focus)
{
name = g_IPanel->GetName(panel);
if (strlen(name) > 5)
{
if (name[0] == 'F' && name[5] == 'O')
{
panel_focus = panel;
}
}
}
if (!panel_scope) if (!panel_scope)
{ {
name = g_IPanel->GetName(panel); name = g_IPanel->GetName(panel);
@ -215,13 +185,6 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
g_Settings.bInvalid = true; g_Settings.bInvalid = true;
} }
if (panel != panel_focus)
return;
g_IPanel->SetTopmostPopup(panel_focus, true);
if (!draw_flag)
return;
draw_flag = false;
if (disable_visuals) if (disable_visuals)
return; return;