Fix AutoReflect, AutoHeal, SpyAlert

This commit is contained in:
nullifiedcat 2016-12-05 20:52:29 +03:00
parent 6a509974b7
commit abd6a7a442
8 changed files with 76 additions and 99 deletions

View File

@ -15,6 +15,7 @@ Proper AutoHitbox
Smoothe the smooth aim
Jumping ProjAim
Aim Key mode (inverse/normal/disabled)
Flare aim on fire
Trigger ambassador correction
ESP Icons
ESP Distance sort
@ -36,7 +37,9 @@ Auto trigger DR before rockets
AutoHeal
Critical rifles bodyshotting
Show spectators
Tracers/Spy Alert/Spy Cam
Spy alert uses angles
More esp tweaking
Tracers/Spy Cam
Glow Hack
Proper medic followbot AI
Bot option for aiming at owner's prey (just for fun)

View File

@ -38,6 +38,7 @@
#include "followbot/ipcctl.h"
#include "common.h"
#include "sharedobj.h"
#include "hooks.h"
#include "targeting/ITargetSystem.h"
@ -148,21 +149,21 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
gEntityCache.Update();
g_phBunnyhop->CreateMove(thisptr, inputSample, cmd);
CREATE_MOVE(Bunnyhop);
//RunEnginePrediction(g_pLocalPlayer->entity, cmd);
g_phESP->CreateMove(thisptr, inputSample, cmd);
g_phAimbot->CreateMove(thisptr, inputSample, cmd);
g_phAirstuck->CreateMove(thisptr, inputSample, cmd);
g_phAntiAim->CreateMove(thisptr, inputSample, cmd);
g_phAntiDisguise->CreateMove(thisptr, inputSample, cmd);
g_phAutoHeal->CreateMove(thisptr, inputSample, cmd);
g_phAutoReflect->CreateMove(thisptr, inputSample, cmd);
g_phAutoSticky->CreateMove(thisptr, inputSample, cmd);
g_phAutoStrafe->CreateMove(thisptr, inputSample, cmd);
g_phFollowBot->CreateMove(thisptr, inputSample, cmd);
g_phMisc->CreateMove(thisptr, inputSample, cmd);
g_phTriggerbot->CreateMove(thisptr, inputSample, cmd);
g_phHuntsmanCompensation->CreateMove(thisptr, inputSample, cmd);
CREATE_MOVE(ESP);
CREATE_MOVE(Aimbot);
CREATE_MOVE(Airstuck);
CREATE_MOVE(AntiAim);
CREATE_MOVE(AntiDisguise);
CREATE_MOVE(AutoHeal);
CREATE_MOVE(AutoSticky);
CREATE_MOVE(AutoReflect);
CREATE_MOVE(AutoStrafe);
CREATE_MOVE(FollowBot);
CREATE_MOVE(Misc);
CREATE_MOVE(Triggerbot);
CREATE_MOVE(HuntsmanCompensation);
/*for (IHack* i_hack : hack::hacks) {
if (!i_hack->CreateMove(thisptr, inputSample, cmd)) {
@ -186,7 +187,7 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
void hack::Hk_FrameStageNotify(void* thisptr, int stage) {
//logging::Info("FrameStageNotify %i", stage);
// Ambassador to festive ambassador changer. simple.
if (g_Settings.bNoFlinch->GetBool()) {
if (stage == 5 && g_Settings.bNoFlinch->GetBool()) {
static Vector oldPunchAngles = Vector();
Vector punchAngles = GetEntityValue<Vector>(g_pLocalPlayer->entity, eoffsets.vecPunchAngle);
QAngle viewAngles;
@ -241,6 +242,7 @@ void hack::InitHacks() {
ADD_HACK(Airstuck);
ADD_HACK(AutoHeal);
ADD_HACK(HuntsmanCompensation);
ADD_HACK(SpyAlert);
}
void hack::Initialize() {

View File

@ -13,6 +13,9 @@
#define ADD_HACK(x) \
hack::AddHack(g_ph##x = new x());
#define CREATE_MOVE(x) \
g_ph##x->CreateMove(thisptr, inputSample, cmd)
class IHack;
class CUserCmd;
class CViewSetup;

View File

@ -56,8 +56,9 @@ bool AutoHeal::CanHeal(int idx) {
if (ent->GetClientClass()->m_ClassID != ClassID::CTFPlayer) return false;
if (GetEntityValue<char>(ent, eoffsets.iLifeState)) return false;
if (g_pLocalPlayer->team != GetEntityValue<int>(ent, eoffsets.iTeamNum)) return false;
if (g_pLocalPlayer->v_Origin.DistToSqr(ent->GetAbsOrigin()) > 500 * 500) return false;
if (g_pLocalPlayer->v_Origin.DistToSqr(ent->GetAbsOrigin()) > 420 * 420) return false;
if (!IsEntityVisible(ent, 7)) return false;
if (GetEntityValue<int>(ent, eoffsets.iCond) & cond::cloaked) return false;
return true;
}
@ -84,8 +85,8 @@ bool AutoHeal::CreateMove(void*, float, CUserCmd* cmd) {
Vector out;
GetHitboxPosition(target, 7, out);
AimAt(g_pLocalPlayer->v_Eye, out, cmd);
g_pLocalPlayer->bUseSilentAngles = true;
if (!m_iNewTarget) cmd->buttons |= IN_ATTACK;
if (v_bSilent->GetBool()) g_pLocalPlayer->bUseSilentAngles = true;
if (!m_iNewTarget && (interfaces::gvars->tickcount % 60)) cmd->buttons |= IN_ATTACK;
return false;
}

View File

@ -279,86 +279,6 @@ void ESP::ProcessEntity(CachedEntity* ent) {
break;
}
}
/*
int ClassID = ent->GetClientClass()->m_ClassID;
scr.y -= 32;
if (v_bShowEntityID->GetBool()) {
//draw::DrawString(scr.x, scr.y, draw::white, true, "IDX %i CLASS %i", idx, ent->GetClientClass()->m_ClassID);
//scr.y += ESP_HEIGHT;
}
switch (ClassID) {
case 241: {
int team = GetEntityValue<int>(ent, eoffsets.iTeamNum);
int health = GetEntityValue<int>(ent, eoffsets.iHealth);
int pclass = GetEntityValue<int>(ent, eoffsets.iClass);
int pcond = GetEntityValue<int>(ent, eoffsets.iCond);
if (GetEntityValue<char>(ent, eoffsets.iLifeState) || (team != 2 && team != 3)) return;
Color clr = ((team == 2) ? draw::red : (team == 3 ? draw::blue : draw::white));
player_info_t info;
if (!interfaces::engineClient->GetPlayerInfo(idx, &info)) return;
powerup_type power = GetPowerupOnPlayer(ent);
bool teammate = (team == my_team);
// If target is enemy, always show powerups, if player is teammate, show powerups
// only if bTeammatePowerup or bTeammates is true
if (power >= 0 && (!teammate || this->v_bTeammatePowerup->GetBool() || this->v_bTeammates->GetBool())) {
Color clr = (team == 3 ? draw::blue : (team == 2 ? draw::red : draw::white));
draw::DrawString(scr.x, scr.y, clr, true, "HAS [%s]", powerups[power]);
scr.y += ESP_HEIGHT;
}
if (teammate && !this->v_bTeammates->GetBool()) return;
if (v_bShowTargetScore->GetBool()) {
draw::DrawString(scr.x, scr.y, clr, true, "Threat: %i", GetScoreForEntity(ent));
scr.y += ESP_HEIGHT;
}
draw::DrawString(scr.x, scr.y, clr, true, "%im %s", (int)(distance / 64 * 1.22f), info.name);
scr.y += ESP_HEIGHT;
if (pclass < 10 && pclass > 0)
draw::DrawString(scr.x, scr.y, clr, true, "%s - %i HP", classes[pclass - 1], health);
scr.y += ESP_HEIGHT;
if (pcond & cond::cloaked) {
draw::DrawString(scr.x, scr.y, clr, true, "CLOAKED");
scr.y += ESP_HEIGHT;
}
if (IsPlayerInvulnerable(ent)) {
draw::DrawString(scr.x, scr.y, clr, true, "INVULNERABLE");
scr.y += ESP_HEIGHT;
}
if (IsPlayerCritBoosted(ent)) {
draw::DrawString(scr.x, scr.y, clr, true, "CRIT BOOSTED");
scr.y += ESP_HEIGHT;
}
} break;
case 89:
case 88:
case 86: { // builds
int team = GetEntityValue<int>(ent, eoffsets.iTeamNum);
if (team == my_team && !this->v_bTeammates->GetBool()) return;
int health = GetEntityValue<int>(ent, eoffsets.iBuildingHealth);
int level = GetEntityValue<int>(ent, eoffsets.iUpgradeLevel);
const char* name = (ClassID == 89 ? "Teleporter" : (ClassID == 88 ? "Sentry Gun" : "Dispenser"));
Color clr = ((team == 2) ? draw::red : (team == 3 ? draw::blue : draw::white));
draw::DrawString(scr.x, scr.y, clr, true, "LV %i %s HP %i", level, name, health);
scr.y += ESP_HEIGHT;
draw::DrawString(scr.x, scr.y, clr, true, "%iu", (int)distance);
scr.y += ESP_HEIGHT;
} break;
case 212: { // pipes
int team = GetEntityValue<int>(ent, eoffsets.iTeamNum);
if (team == my_team && !this->v_bTeammates->GetBool()) return;
int type = GetEntityValue<int>(ent, eoffsets.iPipeType);
Color clr = ((team == 2) ? draw::red : (team == 3 ? draw::blue : draw::white));
draw::DrawString(scr.x, scr.y, clr, true, type ? "STICKY" : "PIPE", type);
scr.y += ESP_HEIGHT;
draw::DrawString(scr.x, scr.y, clr, true, "%iu", (int)distance);
scr.y += ESP_HEIGHT;
} break;
}
if (this->v_bEntityESP->GetBool()) {
draw::DrawString(scr.x, scr.y, draw::white, true, "%s [%i]", ent->GetClientClass()->GetName(), ent->GetClientClass()->m_ClassID);
scr.y += ESP_HEIGHT;
draw::DrawString(scr.x, scr.y, draw::white, true, "%s %iu", GetModelPath(ent), (int)distance);
scr.y += ESP_HEIGHT;
}*/
}
bool ESP::CreateMove(void*, float, CUserCmd*) {

View File

@ -210,6 +210,7 @@ int sa_switch = 0;
bool Misc::CreateMove(void*, float, CUserCmd* cmd) {
//SetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.iCond, g_pLocalPlayer->cond_0 &~ cond::taunting);
/*if (v_strName->m_StringLength) {
logging::Info("Creating NetMsg!");
NET_SetConVar setname("name", v_strName->GetString());

View File

@ -0,0 +1,44 @@
/*
* SpyAlert.cpp
*
* Created on: Dec 5, 2016
* Author: nullifiedcat
*/
#include "SpyAlert.h"
#include "../common.h"
#include "../sdk.h"
DEFINE_HACK_SINGLETON(SpyAlert);
const char* SpyAlert::GetName() { return "SPY ALERT"; }
SpyAlert::SpyAlert() {
this->v_bEnabled = CreateConVar("u_spyalert_enabled", "1", "Spy alert enabled");
this->v_flWarningDistance = CreateConVar("u_spyalert_warning", "500.0", "Spy warning distance");
this->v_flBackstabDistance = CreateConVar("u_spyalert_backstab", "200.0", "Spy backstab warning distance");
}
bool SpyAlert::CreateMove(void*, float, CUserCmd* cmd) {
return true;
}
void SpyAlert::PaintTraverse(void*, unsigned int, bool, bool) {
if (!v_bEnabled->GetBool()) return;
for (int i = 0; i < interfaces::entityList->GetHighestEntityIndex() && i < 64; i++) {
IClientEntity* ent = interfaces::entityList->GetClientEntity(i);
if (!ent) continue;
if (GetEntityValue<char>(ent, eoffsets.iLifeState)) continue;
if (GetEntityValue<int>(ent, eoffsets.iClass) != tf_class::tf_spy) continue;
if (GetEntityValue<int>(ent, eoffsets.iTeamNum) == g_pLocalPlayer->team) continue;
Vector spypos = ent->GetAbsOrigin();
Vector mypos = g_pLocalPlayer->v_Origin;
float distance = spypos.DistTo(mypos);
if (distance < this->v_flBackstabDistance->GetFloat()) {
AddCenterString(colors::yellow, colors::tf_red, "BACKSTAB WARNING! %im", (int)(distance / 64 * 1.22f));
} else if (distance < this->v_flWarningDistance->GetFloat()) {
AddCenterString(colors::yellow, colors::black, "Incoming spy! %im", (int)(distance / 64 * 1.22f));
}
}
}

View File

@ -14,6 +14,9 @@ class SpyAlert : public IHack {
public:
DECLARE_HACK_METHODS();
SpyAlert();
ConVar* v_bEnabled;
ConVar* v_flWarningDistance;
ConVar* v_flBackstabDistance;
};
DECLARE_HACK_SINGLETON(SpyAlert);