Improve anti-backstab
This commit is contained in:
parent
f5d4e8a4a0
commit
0d538523bf
@ -19,8 +19,6 @@ static CatVar enabled(CV_SWITCH, "antibackstab", "0", "Enable",
|
|||||||
"Main anti-backstab switch");
|
"Main anti-backstab switch");
|
||||||
static CatVar distance(CV_FLOAT, "antibackstab_distance", "200", "Distance",
|
static CatVar distance(CV_FLOAT, "antibackstab_distance", "200", "Distance",
|
||||||
"Distance Until anti-backstab reacts");
|
"Distance Until anti-backstab reacts");
|
||||||
static CatVar silent(CV_SWITCH, "antibackstab_silent", "1", "Silent",
|
|
||||||
"Works silently without moving your view");
|
|
||||||
static CatVar angle(CV_FLOAT, "antibackstab_angle", "150", "Detection Angle");
|
static CatVar angle(CV_FLOAT, "antibackstab_angle", "150", "Detection Angle");
|
||||||
static CatVar sayno(CV_SWITCH, "antibackstab_nope", "0", "Nope!", "Memes");
|
static CatVar sayno(CV_SWITCH, "antibackstab_nope", "0", "Nope!", "Memes");
|
||||||
|
|
||||||
@ -34,7 +32,6 @@ void SayNope()
|
|||||||
hack::ExecuteCommand("voicemenu 0 7");
|
hack::ExecuteCommand("voicemenu 0 7");
|
||||||
last_say = g_GlobalVars->curtime;
|
last_say = g_GlobalVars->curtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
float GetAngle(CachedEntity *spy)
|
float GetAngle(CachedEntity *spy)
|
||||||
{
|
{
|
||||||
float yaw, yaw2, anglediff;
|
float yaw, yaw2, anglediff;
|
||||||
@ -55,7 +52,6 @@ float GetAngle(CachedEntity *spy)
|
|||||||
// yaw - yaw2);
|
// yaw - yaw2);
|
||||||
return anglediff;
|
return anglediff;
|
||||||
}
|
}
|
||||||
|
|
||||||
CachedEntity *ClosestSpy()
|
CachedEntity *ClosestSpy()
|
||||||
{
|
{
|
||||||
CachedEntity *closest, *ent;
|
CachedEntity *closest, *ent;
|
||||||
@ -91,7 +87,8 @@ CachedEntity *ClosestSpy()
|
|||||||
}
|
}
|
||||||
return closest;
|
return closest;
|
||||||
}
|
}
|
||||||
|
static CatVar test(CV_FLOAT, "a_t", "180", "");
|
||||||
|
static CatVar test2(CV_SWITCH, "a_t2", "0", "");
|
||||||
void CreateMove()
|
void CreateMove()
|
||||||
{
|
{
|
||||||
CachedEntity *spy;
|
CachedEntity *spy;
|
||||||
@ -101,53 +98,24 @@ void CreateMove()
|
|||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
spy = ClosestSpy();
|
spy = ClosestSpy();
|
||||||
if (spy)
|
static float backup;
|
||||||
|
if (spy && CE_GOOD(spy))
|
||||||
{
|
{
|
||||||
const Vector &A = LOCAL_E->m_vecOrigin;
|
ConVar *var = g_ICvar->FindVar("cl_pitchdown");
|
||||||
const Vector &B = spy->m_vecOrigin;
|
if (!var)
|
||||||
diff = (A - B);
|
return;
|
||||||
yaw2 = acos(diff.x / diff.Length()) * 180.0f / PI;
|
if (!backup)
|
||||||
if (diff.y < 0)
|
backup = var->GetFloat();
|
||||||
yaw2 = -yaw2;
|
var->SetValue(140.0f);
|
||||||
if (yaw2 < -180)
|
g_pUserCmd->viewangles.x = 140.0f;
|
||||||
yaw2 += 360;
|
|
||||||
if (yaw2 > 180)
|
|
||||||
yaw2 -= 360;
|
|
||||||
resultangle = -180 + yaw2;
|
|
||||||
if (resultangle < -180)
|
|
||||||
resultangle += 360;
|
|
||||||
g_pUserCmd->viewangles.y = resultangle;
|
|
||||||
if (silent)
|
|
||||||
{
|
|
||||||
// This isn't a spy aimbot.
|
|
||||||
if (!(g_pUserCmd->buttons & IN_ATTACK))
|
|
||||||
g_pLocalPlayer->bUseSilentAngles = true;
|
g_pLocalPlayer->bUseSilentAngles = true;
|
||||||
}
|
|
||||||
if (sayno)
|
if (sayno)
|
||||||
SayNope();
|
SayNope();
|
||||||
}
|
}
|
||||||
}
|
else if (!spy || CE_BAD(spy)) {
|
||||||
|
ConVar *var = g_ICvar->FindVar("cl_pitchdown");
|
||||||
void PaintTraverse()
|
var->SetValue(backup);
|
||||||
{
|
}
|
||||||
if (!enabled)
|
|
||||||
return;
|
|
||||||
/*CachedEntity* spy = ClosestSpy();
|
|
||||||
if (!spy) return;
|
|
||||||
const Vector& A = LOCAL_E->m_vecOrigin;
|
|
||||||
const Vector& B = spy->m_vecOrigin;
|
|
||||||
const float yaw = g_pLocalPlayer->v_OrigViewangles.y;
|
|
||||||
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;
|
|
||||||
AddSideString(format("closest: ", B.x, ' ', B.y, ' ', B.z));
|
|
||||||
AddSideString(format("yaw: ", yaw));
|
|
||||||
AddSideString(format("diff: ", diff.x, ' ', diff.y, ' ', diff.z));
|
|
||||||
AddSideString(format("yaw2: ", yaw2));
|
|
||||||
AddSideString(format("anglediff: ", anglediff));*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,8 +437,8 @@ void CreateMove()
|
|||||||
g_pLocalPlayer->weapon()->m_iClassID != lastwep)
|
g_pLocalPlayer->weapon()->m_iClassID != lastwep)
|
||||||
nextattack =
|
nextattack =
|
||||||
CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack);
|
CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack);
|
||||||
if (servertime - nextattack > 30.0f)
|
if (servertime - nextattack > 75.0f)
|
||||||
nextattack = servertime - 30.0f;
|
nextattack = servertime - 75.0f;
|
||||||
if (doom && servertime - nextattack > 0.0f &&
|
if (doom && servertime - nextattack > 0.0f &&
|
||||||
(g_pUserCmd->buttons & IN_ATTACK ||
|
(g_pUserCmd->buttons & IN_ATTACK ||
|
||||||
g_pUserCmd->buttons & IN_ATTACK2))
|
g_pUserCmd->buttons & IN_ATTACK2))
|
||||||
|
@ -702,7 +702,6 @@ static const std::string list_tf2 = R"(
|
|||||||
"antibackstab"
|
"antibackstab"
|
||||||
"antibackstab_nope"
|
"antibackstab_nope"
|
||||||
"antibackstab_angle"
|
"antibackstab_angle"
|
||||||
"antibackstab_silent"
|
|
||||||
"antibackstab_distance"
|
"antibackstab_distance"
|
||||||
]
|
]
|
||||||
"Spyalert" [
|
"Spyalert" [
|
||||||
|
Reference in New Issue
Block a user