Merge pull request #351 from BenCat07/patch-16
Fix some Cloaked backstab stuff + increase range
This commit is contained in:
commit
759351045f
@ -16,6 +16,7 @@ namespace autobackstab
|
||||
|
||||
static CatVar enabled(CV_SWITCH, "autobackstab", "0", "Auto Backstab",
|
||||
"Does not depend on triggerbot!");
|
||||
bool found;
|
||||
// TODO improve
|
||||
void CreateMove()
|
||||
{
|
||||
@ -31,36 +32,80 @@ void CreateMove()
|
||||
{
|
||||
g_pUserCmd->buttons |= IN_ATTACK;
|
||||
}
|
||||
else if (HasCondition<TFCond_Cloaked>(LOCAL_E)) {
|
||||
CachedEntity* ent;
|
||||
for (int i; i < 32; i++) {
|
||||
else if (HasCondition<TFCond_Cloaked>(LOCAL_E))
|
||||
{
|
||||
found = false;
|
||||
if (!CE_GOOD(LOCAL_E))
|
||||
return;
|
||||
CachedEntity *ent;
|
||||
for (int i; i < 32; i++)
|
||||
{
|
||||
float scr = 0;
|
||||
float scr_best = 0;
|
||||
CachedEntity* pEnt = ENTITY(i);
|
||||
CachedEntity *pEnt = ENTITY(i);
|
||||
if (!CE_GOOD(pEnt))
|
||||
continue;
|
||||
if (!pEnt->m_bAlivePlayer)
|
||||
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 = 4096.0f - pEnt->m_vecOrigin.DistTo(LOCAL_E->m_vecOrigin);
|
||||
if (scr > scr_best)
|
||||
{
|
||||
scr_best = scr;
|
||||
ent = pEnt;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
logging::Info("1");
|
||||
if (!found)
|
||||
return;
|
||||
logging::Info("2");
|
||||
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) {
|
||||
float ent_eye = CE_FLOAT(ent, netvar.m_angEyeAngles + 4);
|
||||
float min = CE_FLOAT(LOCAL_E, netvar.m_angEyeAngles + 4) - 39.0f;
|
||||
float min2;
|
||||
if (min < 1.0f)
|
||||
min2 = 360.0f - min;
|
||||
float max = CE_FLOAT(LOCAL_E, netvar.m_angEyeAngles + 4) + 39.0f;
|
||||
float max2;
|
||||
if (max > 360.0f)
|
||||
max2 = max - 360.0f;
|
||||
logging::Info("%f %f %f", ent_eye, min, max);
|
||||
if (min2 || max2) {
|
||||
if (min2 && min2 > max) {
|
||||
if (ent_eye >= max && ent_eye <= min2) {
|
||||
if (LOCAL_E->m_vecOrigin.DistTo(ent->m_vecOrigin) <= 67)
|
||||
g_pUserCmd->buttons |= IN_ATTACK;
|
||||
}
|
||||
}
|
||||
else if (min2 && min2 < max) {
|
||||
if (ent_eye >= min2 && ent_eye <= max)
|
||||
if (LOCAL_E->m_vecOrigin.DistTo(ent->m_vecOrigin) <= 67)
|
||||
g_pUserCmd->buttons |= IN_ATTACK;
|
||||
}
|
||||
else if (max2 && max2 < min) {
|
||||
if (ent_eye >= max2 && ent_eye <= min)
|
||||
if (LOCAL_E->m_vecOrigin.DistTo(ent->m_vecOrigin) <= 67)
|
||||
g_pUserCmd->buttons |= IN_ATTACK;
|
||||
}
|
||||
else if (max && max2 > min) {
|
||||
if (ent_eye >= min && ent_eye >= min)
|
||||
if (LOCAL_E->m_vecOrigin.DistTo(ent->m_vecOrigin) <= 67)
|
||||
g_pUserCmd->buttons |= IN_ATTACK;
|
||||
}
|
||||
|
||||
}
|
||||
else if (ent_eye >= min && ent_eye <= max)
|
||||
{
|
||||
if (LOCAL_E->m_vecOrigin.DistTo(ent->m_vecOrigin) <= 67)
|
||||
g_pUserCmd->buttons |= IN_ATTACK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user