Fixes + additions

- Fix cat_se_do
- Fix infinite pickups
- Add instant cloak/decloak (slight delay before being able to instant decloak again)
- Added instant rev up (slight delay before being able to instant rev up again)
This commit is contained in:
BenCat07 2018-01-23 21:25:27 +01:00 committed by GitHub
parent 129ad02595
commit 2fd853593b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,139 +7,174 @@
#include "common.hpp" #include "common.hpp"
namespace hacks namespace hacks {
{ namespace shared {
namespace shared namespace lagexploit {
{
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",
"Allows instant revving up or shooting two shots at once");
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)
if (toggle) return true;
return true; if (exticks > 0) {
if (exticks > 0) return true;
{ }
return true; if (g_IInputSystem->IsButtonDown((ButtonCode_t) ((int) key))) {
} 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", "Infinite Pickups", "Activate sequence exploit when standing on "
"Activate sequence exploit when standing on " "pickups while having not full HP/Ammo");
"pickups while having not full HP/Ammo");
void CreateMove() void CreateMove() {
{ if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E)) return;
return; if (exticks > 0)
if (exticks > 0) exticks--;
exticks--;
if (!exticks) if (!exticks) {
{ // Infinite pickups (health and ammo)
// Infinite pickups (health and ammo) if (infinite_packs && CE_GOOD(LOCAL_E)) {
if (infinite_packs && CE_GOOD(LOCAL_E)) ICollideable *p = RAW_ENT(LOCAL_E)->GetCollideable();
{ const Vector &max1 = p->OBBMaxs()
ICollideable *p = RAW_ENT(LOCAL_E)->GetCollideable(); + RAW_ENT(LOCAL_E)->GetAbsOrigin();
const Vector &max1 = const Vector &min1 = p->OBBMins()
p->OBBMaxs() + RAW_ENT(LOCAL_E)->GetAbsOrigin(); + RAW_ENT(LOCAL_E)->GetAbsOrigin();
const Vector &min1 = for (int i = 1; i < entity_cache::max; i++) {
p->OBBMins() + RAW_ENT(LOCAL_E)->GetAbsOrigin(); CachedEntity *e = ENTITY(i);
for (int i = 1; i < entity_cache::max; i++) // CE_BAD is used to prevent removeconding on empty spaces where
{ // the item hasn't respawned Class check to ensure entity is
CachedEntity *e = ENTITY(i); // pickup item
// CE_BAD is used to prevent removeconding on empty spaces where if (CE_BAD(e) || e->m_iClassID != CL_CLASS(CBaseAnimating)) {
// the item hasn't respawned Class check to ensure entity is continue;
// 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 = const Vector &max2 = c->OBBMaxs() + e->m_vecOrigin
c->OBBMaxs() + e->m_vecOrigin + Vector(8, 8, 8); + Vector(8, 8, 8);
const Vector &min2 = const Vector &min2 = c->OBBMins() + e->m_vecOrigin
c->OBBMins() + e->m_vecOrigin - Vector(8, 8, 8); - 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
// Lag for ammo / metal // TODO: Alternative to - LOCAL_E->m_iAmmo <
// TODO: Alternative to - LOCAL_E->m_iAmmo < // LOCAL_E->m_iMaxAmmo That is pseudocode but checking each
// LOCAL_E->m_iMaxAmmo That is pseudocode but checking each // weapon for ammo + engie for metal would be ideal
// weapon for ammo + engie for metal would be ideal if ((e->m_ItemType == ITEM_AMMO_SMALL
if ((e->m_ItemType == ITEM_AMMO_SMALL || || e->m_ItemType == ITEM_AMMO_MEDIUM
e->m_ItemType == ITEM_AMMO_MEDIUM || || e->m_ItemType == ITEM_AMMO_LARGE)) {
e->m_ItemType == ITEM_AMMO_LARGE)) AddExploitTicks(3);
{ }
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;
if (key.KeyDown()) static bool bWasHolding = false;
amount = int(value); bool bIsHolding = ((g_pUserCmd->buttons & IN_ATTACK)
|| (g_pUserCmd->buttons & IN_ATTACK2));
if (!LOCAL_E->m_bAlivePlayer)
return;
if (cloak && shoot) {
if (g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFKnife)) {
if (!amount) if ((g_pUserCmd->buttons & IN_ATTACK) && !bWasHolding
return; && HasCondition<TFCond_Cloaked>(LOCAL_E)) {
// Modifying command_number and lastoutgoingcommand turned out to be useless g_pUserCmd->buttons &= ~IN_ATTACK;
g_pUserCmd->buttons |= IN_ATTACK2;
amount = 2 * 90;
}
// cmd->command_number += amount; } else if (CanShoot() && bIsHolding && !bWasHolding)
//*(int*)((unsigned)g_IBaseClientState + offsets::lastoutgoingcommand()) += amount = 1 * 90;
// amount; else if (bWasHolding && !bIsHolding)
amount = 1 * 90;
INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo(); bWasHolding = (g_pUserCmd->buttons & IN_ATTACK)
int &m_nOutSequenceNr = || (g_pUserCmd->buttons & IN_ATTACK2);
*(int *) ((unsigned) ch + offsets::m_nOutSequenceNr()); } else if (!cloak) {
m_nOutSequenceNr += amount; 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)) {
if ((g_pUserCmd->buttons & IN_ATTACK) && !bWasHolding
&& HasCondition<TFCond_Cloaked>(LOCAL_E)) {
g_pUserCmd->buttons &= ~IN_ATTACK;
g_pUserCmd->buttons |= IN_ATTACK2;
amount = 2 * 90;
}
}
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK)
|| (g_pUserCmd->buttons & IN_ATTACK2);
}
}
if (key.KeyDown() || exticks)
amount = int(value);
if (!amount)
return;
// Modifying command_number and lastoutgoingcommand turned out to be useless
// 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;
} }
} }
} }