This commit is contained in:
BenCat07 2018-01-24 10:04:50 +01:00 committed by GitHub
parent 2fd853593b
commit 7fab504b3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,174 +7,200 @@
#include "common.hpp" #include "common.hpp"
namespace hacks { namespace hacks
namespace shared { {
namespace lagexploit { namespace shared
{
namespace lagexploit
{
CatVar toggle(CV_SWITCH, "se_toggle", "0", "Toggle sequence exploit"); CatVar toggle(CV_SWITCH, "se_toggle", "0", "Toggle sequence exploit");
CatVar shoot(CV_SWITCH, "se_shoot", "0", CatVar shoot(CV_SWITCH, "se_shoot", "0",
"Allows instant revving up or shooting two shots at once"); "Allows instant revving up or shooting two shots at once");
CatVar cloak(CV_SWITCH, "se_cloak", "0", "Instant decloak/cloak"); CatVar cloak(CV_SWITCH, "se_cloak", "0", "Instant decloak/cloak");
CatVar key(CV_KEY, "se_key", "0", "Sequence exploit key"); CatVar key(CV_KEY, "se_key", "0", "Sequence exploit key");
CatVar master_switch(CV_SWITCH, "se_master", "1", "Enable sequence exploit", CatVar master_switch(CV_SWITCH, "se_master", "1", "Enable sequence exploit",
"Master switch for the sequence exploit\nDisabling this " "Master switch for the sequence exploit\nDisabling this "
"disables everything else that uses it"); "disables everything else that uses it");
CatVar value(CV_INT, "se_value", "900", "Sequence exploit value", CatVar value(CV_INT, "se_value", "900", "Sequence exploit value",
"Value of user cmds to spam with"); "Value of user cmds to spam with");
CatCommand do_lagexploit("se_do", "Sequence exploit (for use in scripts)", CatCommand do_lagexploit("se_do", "Sequence exploit (for use in scripts)",
[]() {AddExploitTicks(6);}); []() { AddExploitTicks(6); });
int exticks = 0; int exticks = 0;
void AddExploitTicks(int ticks) { void AddExploitTicks(int ticks)
exticks = std::max(ticks, exticks); {
exticks = std::max(ticks, exticks);
} }
bool ExploitActive() { bool ExploitActive()
if (toggle) {
return true; if (toggle)
if (exticks > 0) { return true;
return true; if (exticks > 0)
} {
if (g_IInputSystem->IsButtonDown((ButtonCode_t) ((int) key))) { return true;
return true; }
} if (g_IInputSystem->IsButtonDown((ButtonCode_t)((int) key)))
return false; {
return true;
}
return false;
} }
static CatVar infinite_packs(CV_SWITCH, "infinite_packs", "0", static CatVar infinite_packs(CV_SWITCH, "infinite_packs", "0",
"Infinite Pickups", "Activate sequence exploit when standing on " "Infinite Pickups",
"pickups while having not full HP/Ammo"); "Activate sequence exploit when standing on "
"pickups while having not full HP/Ammo");
void CreateMove() { void CreateMove()
if (CE_BAD(LOCAL_E)) {
return; if (CE_BAD(LOCAL_E))
if (exticks > 0) return;
exticks--; if (exticks > 0)
exticks--;
if (!exticks) { if (!exticks)
// Infinite pickups (health and ammo) {
if (infinite_packs && CE_GOOD(LOCAL_E)) { // Infinite pickups (health and ammo)
ICollideable *p = RAW_ENT(LOCAL_E)->GetCollideable(); if (infinite_packs && CE_GOOD(LOCAL_E))
const Vector &max1 = p->OBBMaxs() {
+ RAW_ENT(LOCAL_E)->GetAbsOrigin(); ICollideable *p = RAW_ENT(LOCAL_E)->GetCollideable();
const Vector &min1 = p->OBBMins() const Vector &max1 =
+ RAW_ENT(LOCAL_E)->GetAbsOrigin(); p->OBBMaxs() + RAW_ENT(LOCAL_E)->GetAbsOrigin();
for (int i = 1; i < entity_cache::max; i++) { const Vector &min1 =
CachedEntity *e = ENTITY(i); p->OBBMins() + RAW_ENT(LOCAL_E)->GetAbsOrigin();
// CE_BAD is used to prevent removeconding on empty spaces where for (int i = 1; i < entity_cache::max; i++)
// the item hasn't respawned Class check to ensure entity is {
// pickup item CachedEntity *e = ENTITY(i);
if (CE_BAD(e) || e->m_iClassID != CL_CLASS(CBaseAnimating)) { // CE_BAD is used to prevent removeconding on empty spaces where
continue; // the item hasn't respawned Class check to ensure entity is
} // pickup item
if (CE_BAD(e) || e->m_iClassID != CL_CLASS(CBaseAnimating))
{
continue;
}
ICollideable *c = RAW_ENT(e)->GetCollideable(); ICollideable *c = RAW_ENT(e)->GetCollideable();
// Bounds check // Bounds check
const Vector &max2 = c->OBBMaxs() + e->m_vecOrigin const Vector &max2 =
+ Vector(8, 8, 8); c->OBBMaxs() + e->m_vecOrigin + Vector(8, 8, 8);
const Vector &min2 = c->OBBMins() + e->m_vecOrigin const Vector &min2 =
- Vector(8, 8, 8); c->OBBMins() + e->m_vecOrigin - Vector(8, 8, 8);
if ((min1.x <= max2.x && max1.x >= min2.x) if ((min1.x <= max2.x && max1.x >= min2.x) &&
&& (min1.y <= max2.y && max1.y >= min2.y) (min1.y <= max2.y && max1.y >= min2.y) &&
&& (min1.z <= max2.z && max1.z >= min2.z)) { (min1.z <= max2.z && max1.z >= min2.z))
// logging::Info("Collision with %d", i); {
// logging::Info("Collision with %d", i);
// Lag for health // Lag for health
if (LOCAL_E->m_iHealth < LOCAL_E->m_iMaxHealth if (LOCAL_E->m_iHealth < LOCAL_E->m_iMaxHealth &&
&& (e->m_ItemType == ITEM_HEALTH_SMALL (e->m_ItemType == ITEM_HEALTH_SMALL ||
|| e->m_ItemType == ITEM_HEALTH_MEDIUM e->m_ItemType == ITEM_HEALTH_MEDIUM ||
|| e->m_ItemType == ITEM_HEALTH_LARGE)) { e->m_ItemType == ITEM_HEALTH_LARGE))
AddExploitTicks(3); {
} AddExploitTicks(3);
// Lag for ammo / metal }
// TODO: Alternative to - LOCAL_E->m_iAmmo < // Lag for ammo / metal
// LOCAL_E->m_iMaxAmmo That is pseudocode but checking each // TODO: Alternative to - LOCAL_E->m_iAmmo <
// weapon for ammo + engie for metal would be ideal // LOCAL_E->m_iMaxAmmo That is pseudocode but checking each
if ((e->m_ItemType == ITEM_AMMO_SMALL // weapon for ammo + engie for metal would be ideal
|| e->m_ItemType == ITEM_AMMO_MEDIUM if ((e->m_ItemType == ITEM_AMMO_SMALL ||
|| e->m_ItemType == ITEM_AMMO_LARGE)) { e->m_ItemType == ITEM_AMMO_MEDIUM ||
AddExploitTicks(3); e->m_ItemType == ITEM_AMMO_LARGE))
} {
} AddExploitTicks(3);
} }
} }
} }
}
}
// Previously was in GetUserCmd // Previously was in GetUserCmd
// Thanks Blackfire for helping me improve removecond! // Thanks Blackfire for helping me improve removecond!
if (!g_pUserCmd) if (!g_pUserCmd)
return; return;
if (!g_pUserCmd->command_number) if (!g_pUserCmd->command_number)
return; return;
if (!master_switch) if (!master_switch)
return; return;
int amount = 0; int amount = 0;
static bool bWasHolding = false; static bool bWasHolding = false;
bool bIsHolding = ((g_pUserCmd->buttons & IN_ATTACK) bool bIsHolding = ((g_pUserCmd->buttons & IN_ATTACK) ||
|| (g_pUserCmd->buttons & IN_ATTACK2)); (g_pUserCmd->buttons & IN_ATTACK2));
if (!LOCAL_E->m_bAlivePlayer) if (!LOCAL_E->m_bAlivePlayer)
return; return;
if (cloak && shoot) { if (cloak && shoot)
if (g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFKnife)) { {
if (g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFKnife))
{
if ((g_pUserCmd->buttons & IN_ATTACK) && !bWasHolding if ((g_pUserCmd->buttons & IN_ATTACK) && !bWasHolding &&
&& HasCondition<TFCond_Cloaked>(LOCAL_E)) { HasCondition<TFCond_Cloaked>(LOCAL_E))
g_pUserCmd->buttons &= ~IN_ATTACK; {
g_pUserCmd->buttons |= IN_ATTACK2; g_pUserCmd->buttons &= ~IN_ATTACK;
amount = 2 * 90; g_pUserCmd->buttons |= IN_ATTACK2;
} amount = 2 * 90;
}
}
else if (CanShoot() && bIsHolding && !bWasHolding)
amount = 1 * 90;
else if (bWasHolding && !bIsHolding)
amount = 1 * 90;
} else if (CanShoot() && bIsHolding && !bWasHolding) bWasHolding = (g_pUserCmd->buttons & IN_ATTACK) ||
amount = 1 * 90; (g_pUserCmd->buttons & IN_ATTACK2);
else if (bWasHolding && !bIsHolding) }
amount = 1 * 90; else if (!cloak)
{
if (shoot)
{
if (CanShoot() && bIsHolding && !bWasHolding)
amount = 1 * 90;
else if (bWasHolding && !bIsHolding)
amount = 1 * 90;
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK) ||
(g_pUserCmd->buttons & IN_ATTACK2);
}
}
else if (!shoot)
{
if (cloak)
{
if (g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFKnife))
{
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK) if ((g_pUserCmd->buttons & IN_ATTACK) && !bWasHolding &&
|| (g_pUserCmd->buttons & IN_ATTACK2); HasCondition<TFCond_Cloaked>(LOCAL_E))
} else if (!cloak) { {
if (shoot) { g_pUserCmd->buttons &= ~IN_ATTACK;
if (CanShoot() && bIsHolding && !bWasHolding) g_pUserCmd->buttons |= IN_ATTACK2;
amount = 1 * 90; amount = 2 * 90;
else if (bWasHolding && !bIsHolding) }
amount = 1 * 90; }
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK) bWasHolding = (g_pUserCmd->buttons & IN_ATTACK) ||
|| (g_pUserCmd->buttons & IN_ATTACK2); (g_pUserCmd->buttons & IN_ATTACK2);
} }
} else if (!shoot) { }
if (cloak) {
if (g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFKnife)) {
if ((g_pUserCmd->buttons & IN_ATTACK) && !bWasHolding if (key.KeyDown() || exticks)
&& HasCondition<TFCond_Cloaked>(LOCAL_E)) { amount = int(value);
g_pUserCmd->buttons &= ~IN_ATTACK;
g_pUserCmd->buttons |= IN_ATTACK2;
amount = 2 * 90;
}
} if (!amount)
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK) return;
|| (g_pUserCmd->buttons & IN_ATTACK2); // Modifying command_number and lastoutgoingcommand turned out to be useless
}
}
if (key.KeyDown() || exticks) // cmd->command_number += amount;
amount = int(value); //*(int*)((unsigned)g_IBaseClientState + offsets::lastoutgoingcommand()) +=
// amount;
if (!amount) INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
return; int &m_nOutSequenceNr =
// Modifying command_number and lastoutgoingcommand turned out to be useless *(int *) ((unsigned) ch + offsets::m_nOutSequenceNr());
m_nOutSequenceNr += amount;
// cmd->command_number += amount;
//*(int*)((unsigned)g_IBaseClientState + offsets::lastoutgoingcommand()) +=
// amount;
INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
int &m_nOutSequenceNr = *(int *) ((unsigned) ch
+ offsets::m_nOutSequenceNr());
m_nOutSequenceNr += amount;
} }
} }
} }