kinda fixed autosticky, aimbot will no longer try to aim with stickybomb

launcher
This commit is contained in:
nullifiedcat 2017-04-22 11:27:36 +03:00
parent 280da4d06e
commit 6164a0d3da
3 changed files with 35 additions and 17 deletions

4
TODO
View File

@ -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

View File

@ -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)

View File

@ -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<CachedEntity*> bombs;
std::vector<CachedEntity*> 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;