sticky!!!
This commit is contained in:
parent
bc91c94b3e
commit
9920521559
@ -48,6 +48,7 @@ void EntityVariables::Init() {
|
||||
this->iItemDefinitionIndex = gNetvars.get_offset("DT_EconEntity", "m_AttributeManager", "m_Item", "m_iItemDefinitionIndex");
|
||||
this->flChargeBeginTime = gNetvars.get_offset("DT_WeaponPipebombLauncher", "PipebombLauncherLocalData", "m_flChargeBeginTime");
|
||||
this->flLastFireTime = gNetvars.get_offset("DT_TFWeaponBase", "LocalActiveTFWeaponData", "m_flLastFireTime");
|
||||
this->hThrower = gNetvars.get_offset("DT_BaseGrenade", "m_hThrower");
|
||||
}
|
||||
|
||||
void InitEntityOffsets() {
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
|
||||
offset_t flChargeBeginTime;
|
||||
offset_t flLastFireTime;
|
||||
offset_t hThrower;
|
||||
};
|
||||
|
||||
// TODO globals
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "drawing.h"
|
||||
#include "hacks/Airstuck.h"
|
||||
#include "hacks/AutoStrafe.h"
|
||||
#include "hacks/AutoSticky.h"
|
||||
#include "entity.h"
|
||||
#include "localplayer.h"
|
||||
#include "playerresource.h"
|
||||
@ -186,6 +187,7 @@ void hack::InitHacks() {
|
||||
hack::AddHack(g_phBunnyhop = new HBunnyhop());
|
||||
hack::AddHack(g_phEsp = new HEsp());
|
||||
hack::AddHack(g_phTrigger = new HTrigger());
|
||||
hack::AddHack(g_phAutoSticky = new AutoSticky());
|
||||
hack::AddHack(g_phAirstuck = new Airstuck());
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,10 @@
|
||||
#include "../interfaces.h"
|
||||
#include "../entitycache.h"
|
||||
#include "../helpers.h"
|
||||
#include "../localplayer.h"
|
||||
#include "../usercmd.h"
|
||||
#include "../sdk/in_buttons.h"
|
||||
#include "../logging.h"
|
||||
#include "../fixsdk.h"
|
||||
#include <icliententitylist.h>
|
||||
#include <icliententity.h>
|
||||
@ -21,27 +25,41 @@ const char* AutoSticky::GetName() {
|
||||
|
||||
// TODO scottish cyclops
|
||||
AutoSticky::AutoSticky() {
|
||||
this->v_flDetonateDistance = CreateConVar("u_sticky_distance", "200", "Sticky detonation distance");
|
||||
this->v_bBuildings = CreateConVar("u_sticky_buildings", "1", "Stickies detonate at enemies' buildings");
|
||||
this->v_bEnabled = CreateConVar("u_sticky_enabled", "1", "Enable stickybot");
|
||||
this->v_bScottish = CreateConVar("u_sticky_scottish", "0", "Enable stickybot scottish resistance compatability");
|
||||
}
|
||||
|
||||
bool AutoSticky::ShouldDetonate(IClientEntity* bomb) {
|
||||
//logging::Info("Should detonate?");
|
||||
for (int i = 0; i < gEntityCache.m_nMax; i++) {
|
||||
CachedEntity* ent = gEntityCache.GetEntity(i);
|
||||
if (ent->m_iClassID != ClassID::CTFPlayer && !(this->v_bBuildings->GetBool() && IsBuilding(ent->m_pEntity))) return false;
|
||||
if (ent->m_iTeam == GetEntityValue<int>(bomb, eoffsets.iTeamNum)) return false;
|
||||
if (ent->m_pEntity->GetAbsOrigin().DistToSqr(bomb->GetAbsOrigin())) return false;
|
||||
if (ent->m_bNULL) continue;
|
||||
if (ent->m_iClassID != ClassID::CTFPlayer && !(this->v_bBuildings->GetBool() && IsBuilding(ent->m_pEntity))) continue;
|
||||
if (ent->m_iTeam == GetEntityValue<int>(bomb, eoffsets.iTeamNum)) continue;
|
||||
if (ent->m_pEntity->GetAbsOrigin().DistToSqr(bomb->GetAbsOrigin()) > this->v_flDetonateDistance->GetFloat() * this->v_flDetonateDistance->GetFloat()) continue;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AutoSticky::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (!this->v_bEnabled->GetBool()) return true;
|
||||
for (int i = 0; i < gEntityCache.m_nMax; i++) {
|
||||
CachedEntity* ent = gEntityCache.GetEntity(i);
|
||||
if (ent->m_iClassID != ClassID::CTFGrenadePipebombProjectile) return true;
|
||||
|
||||
if (ent->m_bNULL) continue;
|
||||
if (ent->m_iClassID != ClassID::CTFGrenadePipebombProjectile) continue;
|
||||
if (g_pLocalPlayer->entity) {
|
||||
IClientEntity* owner = interfaces::entityList->GetClientEntity(ent->Var<int>(eoffsets.hThrower) & 0xFFF);
|
||||
//logging::Info("Owner: 0x%08x", owner);
|
||||
if (!owner) continue;
|
||||
if (owner != g_pLocalPlayer->entity) continue;
|
||||
} else continue;
|
||||
if (ShouldDetonate(ent->m_pEntity)) {
|
||||
//logging::Info("Detonate!");
|
||||
cmd->buttons |= IN_ATTACK2;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -49,3 +67,5 @@ bool AutoSticky::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
void AutoSticky::PaintTraverse(void*, unsigned int, bool, bool) {
|
||||
|
||||
}
|
||||
|
||||
DEFINE_HACK_SINGLETON(AutoSticky);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
class IClientEntity;
|
||||
|
||||
class AutoSticky {
|
||||
class AutoSticky : public IHack {
|
||||
public:
|
||||
DECLARE_HACK_METHODS();
|
||||
AutoSticky();
|
||||
|
@ -21,6 +21,9 @@ typedef unsigned int uint32;
|
||||
void PaintTraverse(void*, unsigned int, bool, bool);
|
||||
|
||||
#define DECLARE_HACK_SINGLETON(x) \
|
||||
extern x* g_ph##x;
|
||||
|
||||
#define DEFINE_HACK_SINGLETON(x) \
|
||||
x* g_ph##x = 0;
|
||||
|
||||
class IHack {
|
||||
|
Reference in New Issue
Block a user