autobackstab

This commit is contained in:
nullifiedcat 2017-04-14 15:13:58 +03:00
parent 11f9678cf6
commit 15e38a3c32
7 changed files with 74 additions and 0 deletions

View File

@ -128,6 +128,7 @@ List& MainList() {
"Trigger Bot" [
"Trigger Bot Menu"
"autobackstab"
"trigger_enabled"
"trigger_accuracy"
"trigger_ambassador"

View File

@ -0,0 +1,50 @@
/*
* AutoBackstab.cpp
*
* Created on: Apr 14, 2017
* Author: nullifiedcat
*/
#include "../common.h"
namespace hacks { namespace tf2 { namespace autobackstab {
static CatVar enabled(CV_SWITCH, "autobackstab", "0", "Auto Backstab", "Does not depend on triggerbot!");
/*float GetAngle(CachedEntity* target) {
const Vector& A = target->m_vecOrigin;
const Vector& B = LOCAL_E->m_vecOrigin;
const float yaw = CE_FLOAT(target, netvar.m_angEyeAngles + 4);
const Vector diff = (A - B);
float yaw2 = acos(diff.x / diff.Length()) * 180.0f / PI;
if (diff.y < 0) yaw2 = -yaw2;
float anglediff = yaw - yaw2;
if (anglediff > 180) anglediff -= 360;
if (anglediff < -180) anglediff += 360;
//logging::Info("Angle: %.2f | %.2f | %.2f | %.2f", yaw, yaw2, anglediff, yaw - yaw2);
return anglediff;
}*/
// TODO improve
void CreateMove() {
// lmao thanks valve
if (!enabled) return;
if (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife) return;
if (CE_BYTE(g_pLocalPlayer->weapon(), netvar.m_bReadyToBackstab)) {
g_pUserCmd->buttons |= IN_ATTACK;
return;
}
/*if (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife) return;
for (int i = 1; i < g_IEntityList->GetHighestEntityIndex() && i < 32; i++) {
CachedEntity* ent = ENTITY(i);
if (CE_BAD(ent)) continue;
if (!ent->m_bEnemy) continue;
if (CE_BYTE(ent, netvar.iLifeState) != LIFE_ALIVE) continue;
if (IsPlayerInvulnerable(ent)) continue;
if (ent->m_flDistance > 75) continue;
if (fabs(GetAngle(ent)) < 100) g_pUserCmd->buttons |= IN_ATTACK;
}*/
}
}}}

View File

@ -0,0 +1,17 @@
/*
* AutoBackstab.hpp
*
* Created on: Apr 14, 2017
* Author: nullifiedcat
*/
#ifndef HACKS_AUTOBACKSTAB_HPP_
#define HACKS_AUTOBACKSTAB_HPP_
namespace hacks { namespace tf2 { namespace autobackstab {
void CreateMove();
}}}
#endif /* HACKS_AUTOBACKSTAB_HPP_ */

View File

@ -18,6 +18,7 @@
#include "Bunnyhop.h"
#include "ESP.h"
#include "AntiBackstab.hpp"
#include "AutoBackstab.hpp"
#include "FollowBot.h"
#include "Misc.h"
#include "SpyAlert.h"

View File

@ -165,6 +165,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
if (TF) SAFE_CALL(hacks::tf::autoreflect::CreateMove());
SAFE_CALL(hacks::shared::triggerbot::CreateMove());
if (TF) SAFE_CALL(hacks::tf::autoheal::CreateMove());
if (TF2) SAFE_CALL(hacks::tf2::autobackstab::CreateMove());
}
//SAFE_CALL(CREATE_MOVE(FollowBot));
SAFE_CALL(hacks::shared::misc::CreateMove());

View File

@ -21,6 +21,7 @@ void NetVars::Init() {
this->vVelocity = gNetvars.get_offset("DT_BasePlayer", "localdata", "m_vecVelocity[0]");
this->movetype = gNetvars.get_offset("DT_BaseEntity", "movetype");
if (TF2) {
m_angEyeAngles = gNetvars.get_offset("DT_TFPlayer", "tfnonlocaldata", "m_angEyeAngles[0]");
this->bGlowEnabled = gNetvars.get_offset("DT_TFPlayer", "m_bGlowEnabled");
this->iMaxBuffedHealth = gNetvars.get_offset("DT_TFPlayerResource", "m_iMaxBuffedHealth");
//this->iDecapitations = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_iDecapitations");
@ -35,6 +36,7 @@ void NetVars::Init() {
this->m_flStealthNoAttackExpire = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "tfsharedlocaldata", "m_flStealthNoAttackExpire");
}
if (TF2 || TF2C) {
this->m_bReadyToBackstab = gNetvars.get_offset("DT_TFWeaponKnife", "m_bReadyToBackstab");
this->m_bDucked = gNetvars.get_offset("DT_TFPlayer", "localdata", "m_Local", "m_bDucked");
this->m_flDuckTimer = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_flDuckTimer");
this->iCond = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_nPlayerCond");

View File

@ -120,6 +120,8 @@ public:
offset_t m_flStealthNoAttackExpire;
offset_t m_flDuckTimer;
offset_t m_bDucked;
offset_t m_angEyeAngles;
offset_t m_bReadyToBackstab;
};
extern NetVars netvar;