Clang
This commit is contained in:
parent
2fd853593b
commit
7fab504b3e
@ -7,9 +7,12 @@
|
|||||||
|
|
||||||
#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",
|
||||||
@ -26,75 +29,88 @@ 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))) {
|
if (g_IInputSystem->IsButtonDown((ButtonCode_t)((int) key)))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
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",
|
||||||
|
"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();
|
ICollideable *p = RAW_ENT(LOCAL_E)->GetCollideable();
|
||||||
const Vector &max1 = p->OBBMaxs()
|
const Vector &max1 =
|
||||||
+ RAW_ENT(LOCAL_E)->GetAbsOrigin();
|
p->OBBMaxs() + RAW_ENT(LOCAL_E)->GetAbsOrigin();
|
||||||
const Vector &min1 = p->OBBMins()
|
const Vector &min1 =
|
||||||
+ RAW_ENT(LOCAL_E)->GetAbsOrigin();
|
p->OBBMins() + RAW_ENT(LOCAL_E)->GetAbsOrigin();
|
||||||
for (int i = 1; i < entity_cache::max; i++) {
|
for (int i = 1; i < entity_cache::max; i++)
|
||||||
|
{
|
||||||
CachedEntity *e = ENTITY(i);
|
CachedEntity *e = ENTITY(i);
|
||||||
// CE_BAD is used to prevent removeconding on empty spaces where
|
// CE_BAD is used to prevent removeconding on empty spaces where
|
||||||
// the item hasn't respawned Class check to ensure entity is
|
// the item hasn't respawned Class check to ensure entity is
|
||||||
// pickup item
|
// pickup item
|
||||||
if (CE_BAD(e) || e->m_iClassID != CL_CLASS(CBaseAnimating)) {
|
if (CE_BAD(e) || e->m_iClassID != CL_CLASS(CBaseAnimating))
|
||||||
|
{
|
||||||
continue;
|
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
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,50 +129,60 @@ void CreateMove() {
|
|||||||
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_ATTACK;
|
||||||
g_pUserCmd->buttons |= IN_ATTACK2;
|
g_pUserCmd->buttons |= IN_ATTACK2;
|
||||||
amount = 2 * 90;
|
amount = 2 * 90;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (CanShoot() && bIsHolding && !bWasHolding)
|
else if (CanShoot() && bIsHolding && !bWasHolding)
|
||||||
amount = 1 * 90;
|
amount = 1 * 90;
|
||||||
else if (bWasHolding && !bIsHolding)
|
else if (bWasHolding && !bIsHolding)
|
||||||
amount = 1 * 90;
|
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 (!cloak) {
|
}
|
||||||
if (shoot) {
|
else if (!cloak)
|
||||||
|
{
|
||||||
|
if (shoot)
|
||||||
|
{
|
||||||
if (CanShoot() && bIsHolding && !bWasHolding)
|
if (CanShoot() && bIsHolding && !bWasHolding)
|
||||||
amount = 1 * 90;
|
amount = 1 * 90;
|
||||||
else if (bWasHolding && !bIsHolding)
|
else if (bWasHolding && !bIsHolding)
|
||||||
amount = 1 * 90;
|
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) {
|
else if (!shoot)
|
||||||
if (g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFKnife)) {
|
{
|
||||||
|
if (cloak)
|
||||||
|
{
|
||||||
|
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_ATTACK;
|
||||||
g_pUserCmd->buttons |= IN_ATTACK2;
|
g_pUserCmd->buttons |= IN_ATTACK2;
|
||||||
amount = 2 * 90;
|
amount = 2 * 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK)
|
bWasHolding = (g_pUserCmd->buttons & IN_ATTACK) ||
|
||||||
|| (g_pUserCmd->buttons & IN_ATTACK2);
|
(g_pUserCmd->buttons & IN_ATTACK2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,8 +198,8 @@ void CreateMove() {
|
|||||||
// amount;
|
// amount;
|
||||||
|
|
||||||
INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
|
INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
|
||||||
int &m_nOutSequenceNr = *(int *) ((unsigned) ch
|
int &m_nOutSequenceNr =
|
||||||
+ offsets::m_nOutSequenceNr());
|
*(int *) ((unsigned) ch + offsets::m_nOutSequenceNr());
|
||||||
m_nOutSequenceNr += amount;
|
m_nOutSequenceNr += amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user