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

View File

@ -243,6 +243,8 @@ public:
struct MAP : public micropather::Graph
{
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
// constructor
inactivityTracker inactiveTracker;
@ -321,8 +323,20 @@ struct MAP : public micropather::Graph
micropather::StateCost cost;
cost.state = static_cast<void *>(&areas.at(id));
cost.cost = area->m_center.DistTo(i.area->m_center);
if (!inactiveTracker.vischeckConnection(connection))
cost.cost *= 999;
if (vischeck_t.test_and_set(2000))
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);
}
}

View File

@ -10,6 +10,7 @@
#include <hacks/ac/bhop.hpp>
#include <settings/Bool.hpp>
#include "common.hpp"
#include "PlayerTools.hpp"
#include "hack.hpp"
static settings::Bool enable{ "find-cheaters.enable", "0" };
@ -57,18 +58,24 @@ void CreateMove()
if (!enable)
return;
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()))
continue;
CachedEntity *ent = ENTITY(i);
if (CE_GOOD(ent))
{
if ((CE_BYTE(ent, netvar.iLifeState) == 0))
if (ent->m_bAlivePlayer())
{
ac::aimbot::Update(ent);
ac::antiaim::Update(ent);
ac::bhop::Update(ent);
if (player_tools::shouldTarget(ent) ==
player_tools::IgnoreReason::DO_NOT_IGNORE ||
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 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;
float bestscr = FLT_MAX;
@ -21,7 +22,8 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
{
CachedEntity *ent = ENTITY(i);
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;
if (!teammate && ent->m_iTeam() == LOCAL_E->m_iTeam())
continue;
@ -30,7 +32,7 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
Vector target{};
if (Predict)
target = ProjectilePrediction(ent, 1, sandwich_speed, grav,
PlayerGravityMod(ent));
PlayerGravityMod(ent));
else
target = ent->hitboxes.GetHitbox(1)->center;
if (!IsEntityVectorVisible(ent, target))
@ -42,12 +44,12 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
scr *= 0.1f;
if (scr < bestscr)
{
bestent = ent;
bestent = ent;
predicted = target;
bestscr = scr;
bestscr = scr;
}
}
return {bestent, predicted};
return { bestent, predicted };
}
static HookedFunction
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() {
@ -76,7 +78,7 @@ static HookedFunction
Vector Predict;
CachedEntity *bestent = nullptr;
std::pair<CachedEntity *, Vector> result{};
result = FindBestEnt(true, true, false);
result = FindBestEnt(true, true, false);
bestent = result.first;
Predict = result.second;
if (bestent)
@ -91,26 +93,27 @@ static HookedFunction
g_pLocalPlayer->bUseSilentAngles = true;
}
});
static settings::Bool charge_aim{ "chargeaim.enable", "false"};
static HookedFunction ChargeAimbot(HookedFunctions_types::HF_CreateMove, "ChargeAim", 1, [](){
if (!*charge_aim)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
return;
if (!HasCondition<TFCond_Charging>(LOCAL_E))
return;
std::pair<CachedEntity *, Vector> result{};
result = FindBestEnt(false, false, true);
CachedEntity *bestent = result.first;
if (bestent && result.second.IsValid())
{
Vector tr = result.second - g_pLocalPlayer->v_Eye;
Vector angles;
VectorAngles(tr, angles);
// Clamping is important
fClampAngle(angles);
current_user_cmd->viewangles = angles;
current_user_cmd->buttons |= IN_ATTACK2;
g_pLocalPlayer->bUseSilentAngles = true;
}
});
static settings::Bool charge_aim{ "chargeaim.enable", "false" };
static HookedFunction
ChargeAimbot(HookedFunctions_types::HF_CreateMove, "ChargeAim", 1, []() {
if (!*charge_aim)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
return;
if (!HasCondition<TFCond_Charging>(LOCAL_E))
return;
std::pair<CachedEntity *, Vector> result{};
result = FindBestEnt(false, false, true);
CachedEntity *bestent = result.first;
if (bestent && result.second.IsValid())
{
Vector tr = result.second - g_pLocalPlayer->v_Eye;
Vector angles;
VectorAngles(tr, angles);
// Clamping is important
fClampAngle(angles);
current_user_cmd->viewangles = angles;
current_user_cmd->buttons |= IN_ATTACK2;
g_pLocalPlayer->bUseSilentAngles = true;
}
});

View File

@ -361,8 +361,15 @@ bool NavToEnemy()
{
int nearestvalid{};
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
nearestvalid =
nav::FindNearestValidbyDist(ent->m_vecOrigin(), 200, 1000);

View File

@ -20,15 +20,22 @@ namespace ac::aimbot
ac_data data_table[32];
int amount[32];
std::unordered_map<int, Vector> Player_origs{};
std::unordered_map<int, Vector> & player_orgs()
{
return Player_origs;
}
void ResetEverything()
{
memset(&data_table, 0, sizeof(ac_data) * 32);
Player_origs.clear();
}
void ResetPlayer(int idx)
{
memset(&data_table[idx - 1], 0, sizeof(ac_data));
Player_origs.clear();
}
void Init()
@ -40,6 +47,7 @@ void Update(CachedEntity *player)
{
if (!enable)
return;
Player_origs[player->m_IDX] = player->m_vecOrigin();
auto &data = data_table[player->m_IDX - 1];
auto &am = amount[player->m_IDX - 1];
if (data.check_timer)
@ -107,12 +115,12 @@ void Event(KeyValues *event)
int victim = event->GetInt("userid");
int eid = g_IEngine->GetPlayerForUserID(attacker);
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 *attacker = ENTITY(eid);
if (CE_GOOD(victim) && CE_GOOD(attacker))
if (victim->m_vecOrigin().DistTo(attacker->m_vecOrigin()) > 250)
if (Player_origs[vid].z != 0 && Player_origs[eid].z != 0)
if (Player_origs[vid].DistTo(Player_origs[eid]) > 250)
{
data_table[eid - 1].check_timer = 1;
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)
{
static bool textures_loaded = false;
static unsigned long panel_focus = 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 cur;
static ConVar *software_cursor = g_ICvar->FindVar("cl_software_cursor");
static const char *name;
static std::string name_s, name_stripped, reason_stripped;
#if ENABLE_VISUALS
if (!textures_loaded)
@ -175,33 +172,6 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
original::PaintTraverse(this_, panel, force, allow_force);
// 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)
{
name = g_IPanel->GetName(panel);
@ -215,13 +185,6 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
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)
return;