109 lines
3.6 KiB
C++
109 lines
3.6 KiB
C++
/*
|
|
* LagExploit.cpp
|
|
*
|
|
* Created on: May 7, 2017
|
|
* Author: nullifiedcat
|
|
*/
|
|
|
|
#include "LagExploit.hpp"
|
|
|
|
namespace hacks { namespace shared { namespace lagexploit {
|
|
|
|
CatVar toggle(CV_SWITCH, "removecond_toggle", "0", "Toggle Lag Exploit", "Toggle lag exploit (RemoveCond)");
|
|
CatVar key(CV_KEY, "removecond_key", "0", "RemoveCond Key");
|
|
|
|
CatCommand do_lagexploit("removecond", "RemoveCond (for use in scripts)", []() {
|
|
AddExploitTicks(6);
|
|
});
|
|
|
|
CatVar clear_fire(CV_SWITCH, "removecond_fire", "0", "Remove Fire");
|
|
CatVar clear_taunt(CV_SWITCH, "removecond_taunt", "0", "Remove Taunting");
|
|
CatVar clear_bleeding(CV_SWITCH, "removecond_bleeding", "0", "Remove Bleeding");
|
|
CatVar clear_stun(CV_SWITCH, "removecond_stun", "0", "Remove Stun");
|
|
CatVar instant_uncloak(CV_SWITCH, "instant_decloak", "0", "Insta Decloak", "Decloaks you on attack");
|
|
|
|
CatCommand reset_command_number("debug_reset_cmd_number", "", []() {
|
|
*(int*)((unsigned)g_IBaseClientState + offsets::lastoutgoingcommand()) = 1;
|
|
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
|
int& m_nOutSequenceNr = *(int*)((unsigned)ch + offsets::m_nOutSequenceNr());
|
|
m_nOutSequenceNr = 1;
|
|
});
|
|
|
|
int exticks = 0;
|
|
void AddExploitTicks(int ticks) {
|
|
exticks = max(ticks, exticks);
|
|
}
|
|
|
|
float instant_rezoom_tick = 0;
|
|
bool instant_rezoom_timer_active = false;
|
|
int instant_rezoom_timer_step = 0;
|
|
|
|
//Instant zoom
|
|
void InstantZoom() {
|
|
if (!instant_rezoom_timer_active) {
|
|
//Setup
|
|
instant_rezoom_timer_active = true;
|
|
instant_rezoom_timer_step = 0;
|
|
instant_rezoom_tick = 12;
|
|
} else if (instant_rezoom_tick > 0 && instant_rezoom_timer_step == 0){
|
|
instant_rezoom_tick--;
|
|
} else if (instant_rezoom_timer_step == 0) {
|
|
//Remove zoom cond
|
|
AddExploitTicks(6);
|
|
instant_rezoom_tick = 75;
|
|
instant_rezoom_timer_step = 1;
|
|
} else if (instant_rezoom_tick > 35 && instant_rezoom_timer_step == 1) {
|
|
instant_rezoom_tick--;
|
|
} else if (!g_pLocalPlayer->bZoomed && instant_rezoom_tick > 0) {
|
|
//Re-Zoom
|
|
instant_rezoom_timer_step == 2;
|
|
instant_rezoom_tick--;
|
|
if (!g_pLocalPlayer->bZoomed) g_pUserCmd->buttons |= IN_ATTACK2;
|
|
} else {
|
|
//Stop the function
|
|
instant_rezoom_timer_active = false;
|
|
hacks::shared::aimbot::instant_rezoom_shoot = false;
|
|
}
|
|
}
|
|
|
|
bool ExploitActive() {
|
|
if (toggle) return true;
|
|
if (exticks > 0) {
|
|
return true;
|
|
}
|
|
if (g_IInputSystem->IsButtonDown((ButtonCode_t)((int)key))) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void CreateMove() {
|
|
if (exticks > 0) exticks--;
|
|
//Var from aimbot.cpp to tell when a shot is made
|
|
if (hacks::shared::aimbot::instant_rezoom_shoot) InstantZoom();
|
|
|
|
if (!exticks) {
|
|
if (instant_uncloak && HasCondition<TFCond_Cloaked>(LOCAL_E)) {
|
|
if (g_pUserCmd->buttons & IN_ATTACK) AddExploitTicks(1);
|
|
}
|
|
if (clear_fire && HasCondition<TFCond_OnFire>(LOCAL_E)) AddExploitTicks(3);
|
|
if (clear_bleeding && HasCondition<TFCond_Bleeding>(LOCAL_E)) AddExploitTicks(3);
|
|
if (clear_taunt && HasCondition<TFCond_Taunting>(LOCAL_E)) AddExploitTicks(3);
|
|
if (clear_stun && HasCondition<TFCond_Dazed>(LOCAL_E)) AddExploitTicks(3);
|
|
}
|
|
}
|
|
|
|
void GetUserCmd(CUserCmd* cmd, int sequence_number) {
|
|
if (!ExploitActive()) return;
|
|
if (!cmd) return;
|
|
if (!cmd->command_number) return;
|
|
cmd->command_number += 450;
|
|
*(int*)((unsigned)g_IBaseClientState + offsets::lastoutgoingcommand()) += 450;
|
|
//*(INetChannel**)((unsigned)g_IBaseClientState + offsets::m_NetChannel());
|
|
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
|
|
int& m_nOutSequenceNr = *(int*)((unsigned)ch + offsets::m_nOutSequenceNr());
|
|
m_nOutSequenceNr += 450;
|
|
}
|
|
|
|
}}}
|