static catvars: spyalert

This commit is contained in:
nullifiedcat 2017-03-17 19:33:26 +03:00
parent 9af8f4883a
commit 81187e1972
5 changed files with 27 additions and 34 deletions

View File

@ -66,7 +66,6 @@ void hack::InitHacks() {
ADD_HACK(ESP);
if (TF) ADD_HACK(AutoSticky);
if (TF) ADD_HACK(AutoHeal);
if (TF) ADD_HACK(SpyAlert);
if (TF2) ADD_HACK(Glow);
ADD_HACK(KillSay);
ADD_HACK(Spam);
@ -202,7 +201,6 @@ void hack::Shutdown() {
DELETE_HACK(ESP);
if (TF) DELETE_HACK(AutoSticky);
if (TF) DELETE_HACK(AutoHeal);
DELETE_HACK(SpyAlert);
if (TF) DELETE_HACK(Glow);
DELETE_HACK(KillSay);
if (TF2) DELETE_HACK(Noisemaker);

View File

@ -10,18 +10,14 @@
#include "../common.h"
#include "../sdk.h"
DEFINE_HACK_SINGLETON(SpyAlert);
namespace hacks { namespace tf { namespace spyalert {
SpyAlert::SpyAlert() {
this->v_bEnabled = new CatVar(CV_SWITCH, "spyalert_enabled", "0", "Enable", NULL, "Master SpyAlert switch");
this->v_flWarningDistance = new CatVar(CV_FLOAT, "spyalert_warning", "500.0", "Warning distance", NULL, "Distance where yellow warning shows");
this->v_flBackstabDistance = new CatVar(CV_FLOAT, "spyalert_backstab", "200.0", "Backstab distance", NULL, "Distance where red warning shows");
}
CatVar enabled(CV_SWITCH, "spyalert_enabled", "0", "Enable", "Master SpyAlert switch");
CatVar distance_warning(CV_FLOAT, "spyalert_warning", "500.0", "Warning distance", "Distance where yellow warning shows");
CatVar distance_backstab(CV_FLOAT, "spyalert_backstab", "200.0", "Backstab distance", NULL, "Distance where red warning shows");
void SpyAlert::Draw() {
if (CE_BAD(g_pLocalPlayer->entity)) return;
if (g_pLocalPlayer->life_state) return;
if (!v_bEnabled->GetBool()) return;
void Draw() {
if (!enabled) return;
for (int i = 0; i < HIGHEST_ENTITY && i < 64; i++) {
CachedEntity* ent = ENTITY(i);
if (CE_BAD(ent)) continue;
@ -29,10 +25,12 @@ void SpyAlert::Draw() {
if (CE_INT(ent, netvar.iClass) != tf_class::tf_spy) continue;
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team) continue;
float distance = ent->m_flDistance;
if (distance < this->v_flBackstabDistance->GetFloat()) {
if (distance < (float)distance_backstab) {
AddCenterString(colors::red, "BACKSTAB WARNING! %im", (int)(distance / 64 * 1.22f));
} else if (distance < this->v_flWarningDistance->GetFloat()) {
} else if (distance < (float)distance_warning) {
AddCenterString(colors::yellow, "Incoming spy! %im", (int)(distance / 64 * 1.22f));
}
}
}
}}}

View File

@ -10,17 +10,14 @@
#include "IHack.h"
class SpyAlert : public IHack {
public:
SpyAlert();
namespace hacks { namespace tf { namespace spyalert {
virtual void Draw() override;
extern CatVar enabled;
extern CatVar distance_warning;
extern CatVar distance_backstab;
CatVar* v_bEnabled;
CatVar* v_flWarningDistance;
CatVar* v_flBackstabDistance;
};
void Draw();
DECLARE_HACK_SINGLETON(SpyAlert);
}}}
#endif /* HACKS_SPYALERT_H_ */

View File

@ -16,22 +16,22 @@
namespace hacks { namespace shared { namespace triggerbot {
CatVar enabled(CV_SWITCH, "trigger_enabled", "0", "Enable", NULL, "Master Triggerbot switch");
CatVar respect_cloak(CV_SWITCH, "trigger_respect_cloak", "1", "Respect cloak", NULL, "Don't shoot at cloaked spies");
CatVar zoomed_only(CV_SWITCH, "trigger_zoomed", "1", "Zoomed only", NULL, "Don't shoot if you aren't zoomed in");
CatVar enabled(CV_SWITCH, "trigger_enabled", "0", "Enable", "Master Triggerbot switch");
CatVar respect_cloak(CV_SWITCH, "trigger_respect_cloak", "1", "Respect cloak", "Don't shoot at cloaked spies");
CatVar zoomed_only(CV_SWITCH, "trigger_zoomed", "1", "Zoomed only", "Don't shoot if you aren't zoomed in");
CatEnum hitbox_enum({
"ANY", "HEAD", "PELVIS", "SPINE 0", "SPINE 1", "SPINE 2", "SPINE 3", "UPPER ARM L", "LOWER ARM L",
"HAND L", "UPPER ARM R", "LOWER ARM R", "HAND R", "HIP L", "KNEE L", "FOOT L", "HIP R",
"KNEE R", "FOOT R"
}, -1);
CatVar hitbox(hitbox_enum, "trigger_hitbox", "-1", "Hitbox", "Triggerbot hitbox. Only useful settings are ANY and HEAD. Use ANY for scatter or any other shotgun-based weapon, HEAD for ambassador/sniper rifle");
CatVar bodyshot(CV_SWITCH, "trigger_bodyshot", "1", "Bodyshot", NULL, "Triggerbot will bodyshot enemies if you have enough charge to 1tap them");
CatVar finishing_hit(CV_SWITCH, "trigger_finish", "1", "Noscope weak enemies", NULL, "If enemy has <50 HP, noscope them");
CatVar max_range(CV_INT, "trigger_range", "0", "Max range", NULL, "Triggerbot won't shoot if enemy is too far away", true, 4096.0f);
CatVar buildings(CV_SWITCH, "trigger_buildings", "1", "Trigger at buildings", NULL, "Shoot buildings");
CatVar ignore_vaccinator(CV_SWITCH, "trigger_respect_vaccinator", "1", "Respect vaccinator", NULL, "Don't shoot at bullet-vaccinated enemies");
CatVar ambassador(CV_SWITCH, "trigger_ambassador", "1", "Smart Ambassador", NULL, "Don't shoot if your ambassador can't headshot yet (Keep that enabled!)");
CatVar accuracy(CV_SWITCH, "trigger_accuracy", "0", "Improve accuracy (NOT WORKING)", NULL, "Might cause more lag (NOT WORKING YET!)");
CatVar bodyshot(CV_SWITCH, "trigger_bodyshot", "1", "Bodyshot", "Triggerbot will bodyshot enemies if you have enough charge to 1tap them");
CatVar finishing_hit(CV_SWITCH, "trigger_finish", "1", "Noscope weak enemies", "If enemy has <50 HP, noscope them");
CatVar max_range(CV_INT, "trigger_range", "0", "Max range", "Triggerbot won't shoot if enemy is too far away", true, 4096.0f);
CatVar buildings(CV_SWITCH, "trigger_buildings", "1", "Trigger at buildings", "Shoot buildings");
CatVar ignore_vaccinator(CV_SWITCH, "trigger_respect_vaccinator", "1", "Respect vaccinator", "Don't shoot at bullet-vaccinated enemies");
CatVar ambassador(CV_SWITCH, "trigger_ambassador", "1", "Smart Ambassador", "Don't shoot if your ambassador can't headshot yet (Keep that enabled!)");
CatVar accuracy(CV_SWITCH, "trigger_accuracy", "0", "Improve accuracy (NOT WORKING)", "Might cause more lag (NOT WORKING YET!)");
std::unique_ptr<trace_t> trace(new trace_t);

View File

@ -88,7 +88,7 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
if (TF) SAFE_CALL(HACK_DRAW(AntiDisguise));
SAFE_CALL(HACK_DRAW(Misc));
SAFE_CALL(HACK_DRAW(ESP));
if (TF) SAFE_CALL(HACK_DRAW(SpyAlert));
if (TF) SAFE_CALL(hacks::tf::spyalert::Draw());
Vector screen;
for (int i = 0; i < HIGHEST_ENTITY; i++) {
CachedEntity* ce = gEntityCache.GetEntity(i);