More advanced antiaim, also added fakeduck

This commit is contained in:
Wizzard 2023-09-20 23:43:31 -04:00
parent d3b6c64003
commit 0b0664e4cf
1 changed files with 38 additions and 15 deletions

View File

@ -29,29 +29,52 @@ void anti_aim(usercmd_t* cmd) {
return;
}
vec3_t random_angles;
i_engine->GetViewAngles(random_angles);
vec3_t view_angles;
i_engine->GetViewAngles(view_angles);
random_angles.x = random_float(-89.0f, 89.0f);
random_angles.y = random_float(-180.0f, 180.0f);
random_angles.z = 0.0f;
char logMsg[128];
snprintf(logMsg, sizeof(logMsg), "echo \"Generated random angles: [%f, %f, %f]\"", random_angles.x, random_angles.y, random_angles.z);
i_engine->pfnClientCmd(logMsg);
static bool lbyBreak = false;
if (lbyBreak) {
view_angles.y += 120.0f;
}
lbyBreak = !lbyBreak;
static bool flipPitch = false;
if (flipPitch) {
view_angles.x = 89.0f;
} else {
view_angles.x = -89.0f;
}
flipPitch = !flipPitch;
view_angles.y += 30.0f;
// This shit busted right now
if (CVAR_ON(movement_fakeduck) && cmd->forwardmove == 0.0f && cmd->sidemove == 0.0f) {
static int duckCounter = 0;
if (duckCounter < 5) {
cmd->buttons |= IN_DUCK;
} else if (duckCounter < 10) {
cmd->buttons &= ~IN_DUCK;
} else {
duckCounter = 0;
}
duckCounter++;
}
if (view_angles.y > 180.0f) view_angles.y -= 360.0f;
if (view_angles.y < -180.0f) view_angles.y += 360.0f;
if (CVAR_ON(movement_antiaim_view)) {
i_engine->SetViewAngles(random_angles);
i_engine->SetViewAngles(view_angles);
i_engine->pfnClientCmd("echo \"Set view angles directly using movement_antiaim_view.\"");
} else {
vec_copy(cmd->viewangles, random_angles);
vec_copy(cmd->viewangles, view_angles);
i_engine->pfnClientCmd("echo \"Set view angles silently.\"");
}
static float last_log_time = 0.0f;
if (cmd->msec - last_log_time >= 5000.0f) {
i_engine->pfnClientCmd("echo \"Anti-Aim has adjusted view angles.\"");
i_engine->pfnClientCmd("echo \"Advanced Anti-Aim has adjusted view angles.\"");
last_log_time = cmd->msec;
}
}