kinda fixed airstuck, added "infinite healthpacks" (work in progress)

This commit is contained in:
nullifiedcat 2017-07-09 14:55:32 +03:00
parent 583ba016c3
commit 90efebb3ba
3 changed files with 31 additions and 5 deletions

View File

@ -58,6 +58,7 @@ bool ExploitActive() {
static CatVar mini_lag_exploit(CV_INT, "lagexploit_mini", "0", "Mini Lag Exploit");
static CatVar instant_weapon_switch(CV_SWITCH, "instant_weapon_switch", "0", "Instant weapon switch");
static CatVar infinite_packs(CV_SWITCH, "infinite_healthpacks", "0", "Infinite Healthpacks", "Activate removecond when standing on healthpack while having not full HP");
void CreateMove() {
if (CE_BAD(LOCAL_E)) return;
@ -145,6 +146,31 @@ void CreateMove() {
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();
const Vector& min1 = p->OBBMins();
for (int i = 1; i < entity_cache::max; i++) {
CachedEntity* e = ENTITY(i);
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;
if (e->m_flDistance < 54.0f) amount = 900;
// Not working for some reason?
/*ICollideable* c = RAW_ENT(e)->GetCollideable();
const Vector& max2 = c->OBBMaxs();
const Vector& min2 = c->OBBMins();
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

View File

@ -356,7 +356,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
if (CE_GOOD(g_pLocalPlayer->entity)) {
static int fakelag_queue = 0;
if (fakelag_amount) {
if (fakelag_queue == int(fakelag_amount)) {
if (fakelag_queue == int(fakelag_amount) || (g_pUserCmd->buttons & IN_ATTACK)) {
*bSendPackets = true;
} else if (fakelag_queue < int(fakelag_amount)) {
*bSendPackets = false;

View File

@ -169,15 +169,15 @@ bool SendNetMsg_hook(void* _this, INetMessage& msg, bool bForceReliable = false,
}
static ConVar* sv_player_usercommand_timeout = g_ICvar->FindVar("sv_player_usercommand_timeout");
static float lastcmd = 0.0f;
if (lastcmd > g_GlobalVars->curtime) {
lastcmd = g_GlobalVars->curtime;
if (lastcmd > g_GlobalVars->absoluteframetime) {
lastcmd = g_GlobalVars->absoluteframetime;
}
if (airstuck.KeyDown() && !g_Settings.bInvalid) {
if (CE_GOOD(LOCAL_E)) {
if (lastcmd + sv_player_usercommand_timeout->GetFloat() - 0.05f < g_GlobalVars->curtime) {
if (lastcmd + sv_player_usercommand_timeout->GetFloat() - 0.1f < g_GlobalVars->curtime) {
if (msg.GetType() == clc_Move) return false;
} else {
lastcmd = g_GlobalVars->curtime;
lastcmd = g_GlobalVars->absoluteframetime;
}
}
}