2023-09-20 19:40:32 -04:00
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
|
#include "features.h"
|
|
|
|
|
#include "../include/sdk.h"
|
|
|
|
|
#include "../include/cvars.h"
|
|
|
|
|
#include "../include/util.h"
|
|
|
|
|
|
|
|
|
|
float random_float(float min, float max) {
|
|
|
|
|
return (max - min) * ((float)rand() / (float)RAND_MAX) + min;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void anti_aim(usercmd_t* cmd) {
|
2023-09-20 23:19:16 -04:00
|
|
|
if (cmd->buttons & IN_ATTACK || cmd->buttons & IN_USE) {
|
|
|
|
|
if (cmd->buttons & IN_ATTACK) {
|
|
|
|
|
i_engine->pfnClientCmd("echo \"Attack detected. Spinbot stopped.\"");
|
|
|
|
|
} else if (cmd->buttons & IN_USE) {
|
|
|
|
|
i_engine->pfnClientCmd("echo \"Use key detected. Spinbot stopped.\"");
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 23:10:57 -04:00
|
|
|
if (!CVAR_ON(movement_antiaim)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_alive(localplayer)) {
|
2023-09-20 19:40:32 -04:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-20 23:43:31 -04:00
|
|
|
vec3_t view_angles;
|
|
|
|
|
i_engine->GetViewAngles(view_angles);
|
|
|
|
|
|
|
|
|
|
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;
|
2023-09-20 19:40:32 -04:00
|
|
|
|
|
|
|
|
if (CVAR_ON(movement_antiaim_view)) {
|
2023-09-20 23:43:31 -04:00
|
|
|
i_engine->SetViewAngles(view_angles);
|
2023-09-20 23:10:57 -04:00
|
|
|
i_engine->pfnClientCmd("echo \"Set view angles directly using movement_antiaim_view.\"");
|
|
|
|
|
} else {
|
2023-09-20 23:43:31 -04:00
|
|
|
vec_copy(cmd->viewangles, view_angles);
|
2023-09-20 23:10:57 -04:00
|
|
|
i_engine->pfnClientCmd("echo \"Set view angles silently.\"");
|
2023-09-20 19:40:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static float last_log_time = 0.0f;
|
|
|
|
|
if (cmd->msec - last_log_time >= 5000.0f) {
|
2023-09-20 23:43:31 -04:00
|
|
|
i_engine->pfnClientCmd("echo \"Advanced Anti-Aim has adjusted view angles.\"");
|
2023-09-20 19:40:32 -04:00
|
|
|
last_log_time = cmd->msec;
|
|
|
|
|
}
|
2023-09-20 23:43:31 -04:00
|
|
|
}
|