From 6164a0d3daf769034670a8f88ab0f898470c08ed Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sat, 22 Apr 2017 11:27:36 +0300 Subject: [PATCH] kinda fixed autosticky, aimbot will no longer try to aim with stickybomb launcher --- TODO | 4 +++- src/hacks/Aimbot.cpp | 1 + src/hacks/AutoSticky.cpp | 47 ++++++++++++++++++++++++++-------------- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index 6b14263d..45290e6f 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,9 @@ TF2C teams TF2C merc HL2DM teams +Fix Autosticky +Proj Aimbot + fullbright toggle Hunter Rifle inspect shit @@ -18,7 +21,6 @@ namesteal autovote voice command spam (not like 1 voice command every 1 ms but like just spamming it on the menu) -Player List dominatesay assistsay worldsay AutoDetonator diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 11e5d065..e523ddd7 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -74,6 +74,7 @@ void CreateMove() { headonly = false; if (g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFGrapplingHook) return; + if (g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFPipebombLauncher) return; projectile_mode = (GetProjectileData(g_pLocalPlayer->weapon(), cur_proj_speed, cur_proj_grav)); if (proj_speed) diff --git a/src/hacks/AutoSticky.cpp b/src/hacks/AutoSticky.cpp index 65eedfc0..68249abf 100644 --- a/src/hacks/AutoSticky.cpp +++ b/src/hacks/AutoSticky.cpp @@ -14,19 +14,25 @@ namespace hacks { namespace tf { namespace autosticky { CatVar enabled(CV_SWITCH, "sticky_enabled", "0", "AutoSticky", "Master AutoSticky switch"); CatVar buildings(CV_SWITCH, "sticky_buildings", "1", "Detonate buildings", "Stickies react to buildings"); -CatVar distance(CV_INT, "sticky_distance", "200", "Distance", "Maximum distance to detonate"); +CatVar distance(CV_INT, "sticky_distance", "150", "Distance", "Maximum distance to detonate"); -bool ShouldDetonate(CachedEntity* bomb) { - for (int i = 0; i < HIGHEST_ENTITY; i++) { - CachedEntity* ent = ENTITY(i); - if (CE_BAD(ent)) continue; - if (ent->m_Type != ENTITY_PLAYER && (ent->m_Type != ENTITY_BUILDING || !buildings)) continue; - if (ent->m_iTeam == CE_INT(bomb, netvar.iTeamNum)) continue; - if (ent->m_Type == ENTITY_PLAYER) { - if (CE_BYTE(ent, netvar.iLifeState) != LIFE_ALIVE) continue; - } - if (ent->m_vecOrigin.DistToSqr(bomb->m_vecOrigin) > SQR((float)distance)) continue; +std::vector bombs; +std::vector targets; + +bool IsBomb(CachedEntity* ent) { + if (ent->m_iClassID != g_pClassID->CTFGrenadePipebombProjectile) return false; + if (CE_INT(ent, netvar.iPipeType) != 1) return false; + if ((CE_INT(ent, netvar.hThrower) & 0xFFF) != g_pLocalPlayer->entity->m_IDX) return false; + return true; +} + +bool IsTarget(CachedEntity* ent) { + if (!ent->m_bEnemy) return false; + if (ent->m_Type == ENTITY_PLAYER) { + if (CE_BYTE(ent, netvar.iLifeState)) return false; return true; + } else if (ent->m_Type == ENTITY_BUILDING) { + return buildings; } return false; } @@ -34,14 +40,23 @@ bool ShouldDetonate(CachedEntity* bomb) { void CreateMove() { if (!enabled) return; if (g_pLocalPlayer->clazz != tf_demoman) return; + bombs.clear(); + targets.clear(); for (int i = 0; i < HIGHEST_ENTITY; i++) { CachedEntity* ent = ENTITY(i); if (CE_BAD(ent)) continue; - if (ent->m_iClassID != g_pClassID->CTFGrenadePipebombProjectile) continue; - if (CE_INT(ent, netvar.iPipeType) != 1) continue; - if ((CE_INT(ent, netvar.hThrower) & 0xFFF) != g_pLocalPlayer->entity->m_IDX) continue; - if (ShouldDetonate(ent)) { - g_pUserCmd->buttons |= IN_ATTACK2; + if (IsBomb(ent)) { + bombs.push_back(ent); + } else if (IsTarget(ent)) { + targets.push_back(ent); + } + } + for (auto bomb : bombs) { + for (auto target : targets) { + if (bomb->m_vecOrigin.DistToSqr(target->m_vecOrigin) < ((float)distance * (float)distance)) { + g_pUserCmd->buttons |= IN_ATTACK2; + return; + } } } return;