Update AutoBackstab.cpp

This commit is contained in:
BenCat07 2018-02-10 12:41:36 +01:00 committed by GitHub
parent 0396d38bfe
commit 449533e5d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,9 +13,18 @@ namespace tf2
{
namespace autobackstab
{
struct AimbotCalculatedData_s
{
unsigned long predict_tick{ 0 };
Vector aim_position{ 0 };
unsigned long vcheck_tick{ 0 };
bool visible{ false };
float fov{ 0 };
int hitbox{ 0 };
};
static CatVar enabled(CV_SWITCH, "autobackstab", "0", "Auto Backstab",
"Does not depend on triggerbot!");
AimbotCalculatedData_s calculated_data_array[2048]{};
// TODO improve
void CreateMove()
{
@ -31,6 +40,37 @@ void CreateMove()
{
g_pUserCmd->buttons |= IN_ATTACK;
}
else if (HasCondition<TFCond_Cloaked>(LOCAL_E)) {
CachedEntity* ent;
for (int i; i < 32; i++) {
float scr = 0;
float scr_best = 0;
CachedEntity* pEnt = ENTITY(i);
if (!CE_GOOD(pEnt))
continue;
if (!pEnt->m_Type == ENTITY_PLAYER)
continue;
if (pEnt == LOCAL_E)
continue;
if (LOCAL_E->m_iTeam == pEnt->m_iTeam)
continue;
scr = 4096.0f
- pEnt->m_vecOrigin.DistTo(
LOCAL_E->m_vecOrigin);
if (scr > scr_best) {
scr_best = scr;
ent = pEnt;
}
}
if (!CE_GOOD(ent))
return;
if (CE_FLOAT(LOCAL_E, netvar.angEyeAngles + 4) + 35.0f >= CE_FLOAT(ent, netvar.angEyeAngles + 4) || CE_FLOAT(LOCAL_E, netvar.angEyeAngles + 4) - 35.0f <= CE_FLOAT(ent, netvar.angEyeAngles + 4))
{
if (LOCAL_E->m_vecOrigin.DistTo(ent->m_vecOrigin) <= 67) {
g_pUserCmd->buttons |= IN_ATTACK;
}
}
}
}
}
}