diff --git a/src/hacks/LagExploit.cpp b/src/hacks/LagExploit.cpp index 15683245..66e76ea2 100644 --- a/src/hacks/LagExploit.cpp +++ b/src/hacks/LagExploit.cpp @@ -128,6 +128,42 @@ void CreateMove() { } } } + + // Infinite pickups (health and ammo) + if (infinite_packs && CE_GOOD(LOCAL_E)) { + ICollideable* p = RAW_ENT(LOCAL_E)->GetCollideable(); + const Vector& max1 = p->OBBMaxs() + RAW_ENT(LOCAL_E)->GetAbsOrigin(); + const Vector& min1 = p->OBBMins() + RAW_ENT(LOCAL_E)->GetAbsOrigin(); + for (int i = 1; i < entity_cache::max; i++) { + CachedEntity* e = ENTITY(i); + // CE_BAD is used to prevent removeconding on empty spaces where the item hasn't respawned + // Class check to ensure entity is pickup item + if (CE_BAD(e) || e->m_iClassID != CL_CLASS(CBaseAnimating)) { + continue; + } + + // Bounds check + const Vector& max2 = c->OBBMaxs() + e->m_vecOrigin + Vector(8, 8, 8); + const Vector& min2 = c->OBBMins() + e->m_vecOrigin - Vector(8, 8, 8); + if ( + (min1.x <= max2.x && max1.x >= min2.x) && + (min1.y <= max2.y && max1.y >= min2.y) && + (min1.z <= max2.z && max1.z >= min2.z) ) { + //logging::Info("Collision with %d", i); + + // Lag for health + if (LOCAL_E->m_iHealth < LOCAL_E->m_iMaxHealth && (e->m_ItemType == ITEM_HEALTH_SMALL || e->m_ItemType == ITEM_HEALTH_MEDIUM || e->m_ItemType == ITEM_HEALTH_LARGE) ) { + AddExploitTicks(3); + } + // Lag for ammo / metal + // TODO: Alternative to - LOCAL_E->m_iAmmo < LOCAL_E->m_iMaxAmmo + // That is pseudocode but checking each weapon for ammo + engie for metal would be ideal + if ((e->m_ItemType == ITEM_AMMO_SMALL || e->m_ItemType == ITEM_AMMO_MEDIUM || e->m_ItemType == ITEM_AMMO_LARGE) ) { + AddExploitTicks(3); + } + } + } + } } // More paste from kathook if (g_pUserCmd->buttons & (IN_ATTACK | IN_ATTACK2)) { @@ -145,31 +181,8 @@ void CreateMove() { int amount = int(lagValue); if (!ExploitActive()) { amount = int(mini_lag_exploit); - } - - - // Infinite healthpacks (I'll probably have to move this somewhere else) - if (infinite_packs && CE_GOOD(LOCAL_E) && LOCAL_E->m_iHealth < LOCAL_E->m_iMaxHealth) { - ICollideable* p = RAW_ENT(LOCAL_E)->GetCollideable(); - const Vector& max1 = p->OBBMaxs() + RAW_ENT(LOCAL_E)->GetAbsOrigin(); - const Vector& min1 = p->OBBMins() + RAW_ENT(LOCAL_E)->GetAbsOrigin(); - for (int i = 1; i < entity_cache::max; i++) { - CachedEntity* e = ENTITY(i); - if (CE_BAD(e)) continue; - if (e->m_iClassID != CL_CLASS(CBaseAnimating)) continue; - if (e->m_ItemType != ITEM_HEALTH_SMALL && e->m_ItemType != ITEM_HEALTH_MEDIUM && e->m_ItemType != ITEM_HEALTH_LARGE) continue; - ICollideable* c = RAW_ENT(e)->GetCollideable(); - const Vector& max2 = c->OBBMaxs() + e->m_vecOrigin + Vector(8, 8, 8); - const Vector& min2 = c->OBBMins() + e->m_vecOrigin - Vector(8, 8, 8); - if ( (min1.x <= max2.x && max1.x >= min2.x) && - (min1.y <= max2.y && max1.y >= min2.y) && - (min1.z <= max2.z && max1.z >= min2.z) ) { - //logging::Info("Collision with %d", i); - amount = 900; - break; - } - } - } + } + if (!amount) return; // Modifying command_number and lastoutgoingcommand turned out to be useless