This commit is contained in:
nullifiedcat 2017-01-10 21:33:53 +03:00
parent 767eb360d6
commit 0e947aeab2
6 changed files with 52 additions and 194 deletions

View File

@ -81,6 +81,7 @@ Aimbot::Aimbot() {
v_fSmoothAutoshootTreshold = CREATE_CV(CV_FLOAT, "aimbot_smooth_autoshoot_treshold", "0.01", "Smooth autoshoot");
this->v_fSmoothRandomness = CREATE_CV(CV_FLOAT, "aimbot_smooth_randomness", "1.0", "Smooth randomness");
this->v_iSeenDelay = CREATE_CV(CV_INT, "aimbot_delay", "0", "Aimbot delay");
this->v_bProjectilePredictionWalls = CREATE_CV(CV_SWITCH, "aimbot_proj_nowallpred", "0", "Don't predict if enemy is hidden")
fix_silent = false;
}
@ -267,7 +268,7 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
}
void Aimbot::PaintTraverse(void*, unsigned int, bool, bool) {
if (!v_bEnabled->GetBool()) return;
/*if (!v_bEnabled->GetBool()) return;
if (IDX_BAD(m_iLastTarget)) return;
CachedEntity* ent = ENTITY(this->m_iLastTarget);
if (CE_BAD(ent)) return;
@ -277,12 +278,21 @@ void Aimbot::PaintTraverse(void*, unsigned int, bool, bool) {
AddCenterString(colors::yellow, colors::black, "Prey: %i HP %s (%s)", CE_INT(ent, netvar.iHealth), tfclasses[clazz], ent->m_pPlayerInfo->name);
} else if (ent->m_Type == ENTITY_BUILDING) {
AddCenterString(colors::yellow, colors::black, "Prey: %i HP LV %i %s", CE_INT(ent, netvar.iBuildingHealth), CE_INT(ent, netvar.iUpgradeLevel), GetBuildingName(ent));
}
}*/
}
int Aimbot::BestHitbox(CachedEntity* target, int preferred) {
if (!v_bAutoHitbox->GetBool()) return preferred;
if (m_bHeadOnly) return 0;
int flags = CE_INT(target, netvar.iFlags);
bool ground = (flags & (1 << 0));
if (!ground) {
if (GetWeaponMode(g_pLocalPlayer->entity) == weaponmode::weapon_projectile) {
if (g_pLocalPlayer->weapon()->m_iClassID != ClassID::CTFCompoundBow) {
preferred = hitbox_t::spine_1;
}
}
}
if (target->m_pHitboxCache->VisibilityCheck(preferred)) return preferred;
for (int i = m_bProjectileMode ? 1 : 0; i < target->m_pHitboxCache->m_nNumHitboxes; i++) {
if (target->m_pHitboxCache->VisibilityCheck(i)) return i;
@ -313,6 +323,10 @@ bool Aimbot::ShouldTarget(CachedEntity* entity) {
int hitbox = BestHitbox(entity, m_iPreferredHitbox);
if (m_bHeadOnly && hitbox) return false;
if (m_bProjectileMode) {
if (v_bProjectilePredictionWalls->GetBool()) {
if (!GetHitbox(entity, hitbox, resultAim)) return false;
if (!IsEntityVisible(entity, hitbox)) return false;
}
resultAim = ProjectilePrediction(entity, hitbox, m_flProjSpeed, m_flProjGravity);
if (!IsVectorVisible(g_pLocalPlayer->v_Eye, resultAim)) return false;
} else {

View File

@ -74,6 +74,7 @@ public:
CatVar* v_fSmoothAutoshootTreshold;
CatVar* v_fSmoothRandomness;
CatVar* v_ePriorityMode;
CatVar* v_bProjectilePredictionWalls;
};
DECLARE_HACK_SINGLETON(Aimbot);

View File

@ -10,102 +10,11 @@
#include "../fixsdk.h"
#include "../common.h"
#include "./others.h"
#include "hooks.h"
#include "../profiler.h"
bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
SEGV_BEGIN;
bool ret = ((CreateMove_t*)hooks::hkClientMode->GetMethod(hooks::offCreateMove))(thisptr, inputSample, cmd);
if (!cmd) return ret;
if (!g_Settings.bHackEnabled->GetBool()) return ret;
if (!interfaces::engineClient->IsInGame()) {
g_Settings.bInvalid = true;
return true;
}
PROF_BEGIN();
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
if (ch && !hooks::IsHooked((void*)((uintptr_t)ch))) {
logging::Info("Hooking INetChannel!");
hooks::hkNetChannel = new hooks::VMTHook();
hooks::hkNetChannel->Init(ch, 0);
hooks::hkNetChannel->HookMethod((void*)CanPacket_hook, hooks::offCanPacket);
hooks::hkNetChannel->HookMethod((void*)SendNetMsg_hook, hooks::offSendNetMsg);
hooks::hkNetChannel->HookMethod((void*)Shutdown_hook, hooks::offShutdown);
hooks::hkNetChannel->Apply();
logging::Info("NetChannel Hooked!");
}
//logging::Info("canpacket: %i", ch->CanPacket());
//if (!cmd) return ret;
bool time_replaced = false;
float curtime_old;
if (CE_GOOD(g_pLocalPlayer->entity)) {
float servertime = (float)CE_INT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick;
curtime_old = interfaces::gvars->curtime;
interfaces::gvars->curtime = servertime;
time_replaced = true;
}
if (g_Settings.bInvalid) {
gEntityCache.Invalidate();
}
PROF_BEGIN();
SAFE_CALL(gEntityCache.Update());
PROF_END("Entity Cache updating");
SAFE_CALL(g_pPlayerResource->Update());
SAFE_CALL(g_pLocalPlayer->Update());
if (CE_GOOD(g_pLocalPlayer->entity)) {
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
PROF_BEGIN();
//RunEnginePrediction(g_pLocalPlayer->entity, cmd);
SAFE_CALL(CREATE_MOVE(ESP));
if (!g_pLocalPlayer->life_state) {
SAFE_CALL(CREATE_MOVE(Bunnyhop));
SAFE_CALL(CREATE_MOVE(Aimbot));
SAFE_CALL(CREATE_MOVE(Airstuck));
SAFE_CALL(CREATE_MOVE(AntiAim));
SAFE_CALL(CREATE_MOVE(AutoSticky));
SAFE_CALL(CREATE_MOVE(AutoReflect));
SAFE_CALL(CREATE_MOVE(AutoStrafe));
SAFE_CALL(CREATE_MOVE(Triggerbot));
SAFE_CALL(CREATE_MOVE(HuntsmanCompensation));
}
SAFE_CALL(CREATE_MOVE(AntiDisguise));
SAFE_CALL(CREATE_MOVE(AutoHeal));
SAFE_CALL(CREATE_MOVE(FollowBot));
SAFE_CALL(CREATE_MOVE(Misc));
PROF_END("Hacks processing");
if (time_replaced) interfaces::gvars->curtime = curtime_old;
}
/*for (IHack* i_hack : hack::hacks) {
if (!i_hack->CreateMove(thisptr, inputSample, cmd)) {
ret = false;
}
}*/
g_Settings.bInvalid = false;
if (CE_GOOD(g_pLocalPlayer->entity)) {
if (g_pLocalPlayer->bUseSilentAngles) {
Vector vsilent(cmd->forwardmove, cmd->sidemove, cmd->upmove);
float speed = sqrt(vsilent.x * vsilent.x + vsilent.y * vsilent.y);
Vector ang;
VectorAngles(vsilent, ang);
float yaw = DEG2RAD(ang.y - g_pLocalPlayer->v_OrigViewangles.y + cmd->viewangles.y);
cmd->forwardmove = cos(yaw) * speed;
cmd->sidemove = sin(yaw) * speed;
ret = false;
}
}
if (cmd)
g_Settings.last_angles = cmd->viewangles;
PROF_END("CreateMove");
return ret;
SEGV_END;
return true;
}

View File

@ -10,95 +10,7 @@
#include "../segvcatch/segvcatch.h"
void PaintTraverse_hook(void* thisptr, unsigned int panel, bool b1, bool b2) {
if (!segvcatch::handler_fpe || !segvcatch::handler_segv) {
segvcatch::init_segv();
segvcatch::init_fpe();
logging::Info("segvcatch init!");
}
SEGV_BEGIN;
SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(thisptr, panel, b1, b2));
if (!g_Settings.bHackEnabled->GetBool()) return;
// Because of single-multi thread shit I'm gonna put this thing riiiight here.
if (g_phFollowBot->v_bEnabled->GetBool()) {
ipc_client_seg* seg_g = g_phFollowBot->m_pIPC->GetClientSegment(0);
ipc_client_seg* seg_l = g_phFollowBot->m_pIPC->GetClientSegment(g_phFollowBot->m_pIPC->client_id);
if (seg_g == 0) {
logging::Info("!!! seg_g == 0 !!!");
}
if (seg_l == 0) {
logging::Info("!!! seg_l == 0 !!!");
}
if (seg_g && seg_g->command_number > g_phFollowBot->last_command_global) {
logging::Info("Executing `%s`", seg_g->command_buffer);
if (g_phFollowBot->last_command_global) interfaces::engineClient->ExecuteClientCmd(seg_g->command_buffer);
g_phFollowBot->last_command_global = seg_g->command_number;
}
if (seg_l && seg_l->command_number > g_phFollowBot->last_command_local) {
logging::Info("Executing `%s`", seg_l->command_buffer);
if (g_phFollowBot->last_command_local) interfaces::engineClient->ExecuteClientCmd(seg_l->command_buffer);
g_phFollowBot->last_command_local = seg_l->command_number;
}
}
if (g_Settings.bNoVisuals->GetBool()) return;
if (!draw::width || !draw::height) {
interfaces::engineClient->GetScreenSize(draw::width, draw::height);
}
if (!draw::panel_top) {
const char* name = interfaces::panel->GetName(panel);
if (strlen(name) > 4) {
if (name[0] == 'M' && name[3] == 'S') {
draw::panel_top = panel;
logging::Info("Got top panel: %i", panel);
}
}
}
if (!interfaces::engineClient->IsInGame()) {
g_Settings.bInvalid = true;
}
if (g_Settings.bInvalid) return;
if (CE_BAD(g_pLocalPlayer->entity)) return;
if (draw::panel_top == panel) {
ResetStrings();
if (g_Settings.bShowLogo->GetBool()) {
AddSideString(colors::green, colors::black, "cathook by d4rkc4t");
AddSideString(colors::red, colors::black, "DEVELOPER BUILD");
}
for (IHack* i_hack : hack::hacks) {
//PROF_BEGIN();
SEGV_BEGIN
i_hack->PaintTraverse(thisptr, panel, b1, b2);
SEGV_END_INFO("Hack PaintTraverse")
//PROF_END(strfmt("%s PaintTraverse", i_hack->GetName()));
}
Vector screen;
for (int i = 0; i < HIGHEST_ENTITY; i++) {
CachedEntity* ce = gEntityCache.GetEntity(i);
if (CE_BAD(ce)) continue;
if (ce->m_ESPOrigin.IsZero(1.0f))
if (!draw::EntityCenterToScreen(ce, screen)) continue;
for (int j = 0; j < ce->m_nESPStrings; j++) {
ESPStringCompound str = ce->GetESPString(j);
//logging::Info("drawing [idx=%i][ns=%i] %s", i, ce->m_nESPStrings, str.m_String);
if (!ce->m_ESPOrigin.IsZero(1.0)) {
draw::DrawString(ce->m_ESPOrigin.x, ce->m_ESPOrigin.y, str.m_Color, str.m_Background, false, str.m_String);
ce->m_ESPOrigin.y += 11;
} else {
draw::DrawString(screen.x, screen.y, str.m_Color, str.m_Background, true, str.m_String);
screen.y += 11;
}
}
}
#if GUI_ENABLED == true
g_pGUI->UpdateKeys();
g_pGUI->Draw();
#endif
DrawStrings();
}
SEGV_END;
}

View File

@ -9,7 +9,7 @@
#include "../common.h"
#include "../netmessage.h"
bool CanPacket_hook(void* thisptr) {
bool CanPacketilerok(void* thisptr) {
SEGV_BEGIN;
return g_Settings.bSendPackets->GetBool() && ((CanPacket_t*)hooks::hkNetChannel->GetMethod(hooks::offCanPacket))(thisptr);
SEGV_END;

View File

@ -25,20 +25,41 @@ Vector SimpleLatencyPrediction(CachedEntity* ent, int hb) {
Vector ProjectilePrediction(CachedEntity* ent, int hb, float speed, float gravitymod) {
if (!ent) return Vector();
Vector result = ent->m_vecOrigin;
if (speed == 0.0f) return Vector();
float dtg = DistanceToGround(result);
int flags = CE_INT(ent, netvar.iFlags);
bool ground = (flags & (1 << 0));
if (ground) dtg = 0;
GetHitbox(ent, hb, result);
Vector vel = CE_VECTOR(ent, netvar.vVelocity);
// TODO ProjAim
/*float tt = g_pLocalPlayer->v_Eye.DistTo(result) + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING) - 0.20;
float besttime = tt + 0.20;
float mindelta = -1;
for (int steps = 0; steps < 40; steps++, tt += 0.01) {
float ott = g_pLocalPlayer->v_Eye.DistTo(result) / speed + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
float tt = ott - 0.5f;
if (tt <= 0.0f) tt = 0.01f;
float besttime = tt;
float mindelta = 65536.0f;
Vector bestpos = result;
int maxsteps = 100;
for (int steps = 0; steps < maxsteps; steps++, tt += ((float)1 / (float)maxsteps)) {
Vector curpos = result;
curpos += vel * tt;
Vector projpos = v_Eye +
}*/
float dtt = g_pLocalPlayer->v_Eye.DistTo(result);
if (dtg > 0.0f) {
curpos.z -= tt * tt * 400;
if (curpos.z < result.z - dtg) curpos.z = result.z - dtg;
}
float rockettime = g_pLocalPlayer->v_Eye.DistTo(curpos) / speed + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
//logging::Info("RocketTime: %.2f TT: %.2f Step: %i BestTime: %.2f", rockettime, tt, steps, besttime);
if (fabs(rockettime - tt) < mindelta) {
//if (mindelta != 65536.0) logging::Info("got better delta: %.2f at step %i (time: %.2f)", fabs(rockettime - tt), steps, tt);
besttime = tt;
bestpos = curpos;
mindelta = fabs(rockettime - tt);
}
}
/*float dtt = g_pLocalPlayer->v_Eye.DistTo(result);
float ttt = dtt / speed + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
float oz = result.z;
@ -47,9 +68,10 @@ Vector ProjectilePrediction(CachedEntity* ent, int hb, float speed, float gravit
if (!ground) result.z -= ttt * ttt * 400;
result += vel * ttt;
if (!ground) if (oz - result.z > dtg) { result.z = oz - dtg; }
result.z += (400 * ttt * ttt * gravitymod);
// S = at^2/2 ; t = sqrt(2S/a)
return result;
*/
bestpos.z += (400 * besttime * besttime * gravitymod);
// S = at^2/2 ; t = sqrt(2S/a)*/
return bestpos;
}
float DistanceToGround(Vector origin) {