Add the worst aimbot ever known to man
This commit is contained in:
parent
762368d75f
commit
e43eeb2d3b
2
Makefile
2
Makefile
|
@ -5,7 +5,7 @@ INCLUDES=-Isrc/include/sdk/common -Isrc/include/sdk/public -Isrc/include/sdk/pm_
|
||||||
CFLAGS=-Wall -Wextra -Wno-write-strings -m32 -fPIC $(INCLUDES)
|
CFLAGS=-Wall -Wextra -Wno-write-strings -m32 -fPIC $(INCLUDES)
|
||||||
LDFLAGS=-lm
|
LDFLAGS=-lm
|
||||||
|
|
||||||
OBJS=obj/main.c.o obj/globals.c.o obj/cvars.c.o obj/hooks.c.o obj/detour.c.o obj/util.c.o obj/features/movement.c.o obj/features/esp.c.o obj/features/chams.c.o obj/features/misc.c.o
|
OBJS=obj/main.c.o obj/globals.c.o obj/cvars.c.o obj/hooks.c.o obj/detour.c.o obj/util.c.o obj/features/movement.c.o obj/features/esp.c.o obj/features/chams.c.o obj/features/aim.c.o obj/features/misc.c.o
|
||||||
BIN=libhlcheat.so
|
BIN=libhlcheat.so
|
||||||
|
|
||||||
.PHONY: clean all inject
|
.PHONY: clean all inject
|
||||||
|
|
|
@ -14,7 +14,7 @@ DECL_CVAR(clmove);
|
||||||
bool cvars_init(void) {
|
bool cvars_init(void) {
|
||||||
REGISTER_CVAR(bhop, 1);
|
REGISTER_CVAR(bhop, 1);
|
||||||
REGISTER_CVAR(autostrafe, 0);
|
REGISTER_CVAR(autostrafe, 0);
|
||||||
REGISTER_CVAR(aimbot, 1);
|
REGISTER_CVAR(aimbot, 0);
|
||||||
REGISTER_CVAR(esp, 3);
|
REGISTER_CVAR(esp, 3);
|
||||||
REGISTER_CVAR(chams, 1);
|
REGISTER_CVAR(chams, 1);
|
||||||
REGISTER_CVAR(crosshair, 0);
|
REGISTER_CVAR(crosshair, 0);
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "features.h"
|
||||||
|
#include "../include/sdk.h"
|
||||||
|
#include "../include/cvars.h"
|
||||||
|
#include "../include/util.h"
|
||||||
|
|
||||||
|
enum aimbot_settings {
|
||||||
|
OFF = 0,
|
||||||
|
CLOSEST = 1,
|
||||||
|
LOWEST_HEALTH = 2, /* TODO */
|
||||||
|
};
|
||||||
|
|
||||||
|
static vec3_t get_closest_delta(vec3_t viewangles) {
|
||||||
|
vec3_t view_height;
|
||||||
|
i_engine->pEventAPI->EV_LocalPlayerViewheight(view_height);
|
||||||
|
vec3_t local_eyes = vec_add(localplayer->origin, view_height);
|
||||||
|
/* TODO: Compensate aim punch */
|
||||||
|
|
||||||
|
/* These 2 vars are used to store the best target across iterations.
|
||||||
|
* NOTE: The default value of best_fov is the aimbot fov */
|
||||||
|
float best_fov = 5.0f;
|
||||||
|
vec3_t best_delta = { 0, 0, 0 };
|
||||||
|
|
||||||
|
for (int i = 1; i <= i_engine->GetMaxClients(); i++) {
|
||||||
|
cl_entity_t* ent = get_player(i);
|
||||||
|
|
||||||
|
if (!valid_player(ent) || !is_alive(ent) || is_friend(ent))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* TODO: Get bones origin */
|
||||||
|
const vec3_t head_pos = vec_add(ent->origin, vec3(0, 0, 0.6f));
|
||||||
|
const vec3_t enemy_angle = vec_to_ang(vec_sub(head_pos, local_eyes));
|
||||||
|
|
||||||
|
const vec3_t delta = vec_sub(enemy_angle, viewangles);
|
||||||
|
vec_norm(delta);
|
||||||
|
|
||||||
|
const float fov = hypotf(delta.x, delta.y);
|
||||||
|
|
||||||
|
if (fov < best_fov) {
|
||||||
|
best_fov = fov;
|
||||||
|
vec_copy(best_delta, delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return best_delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
void aimbot(usercmd_t* cmd) {
|
||||||
|
const int setting = cv_aimbot->value;
|
||||||
|
if (setting == OFF || !(cmd->buttons & IN_ATTACK))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Calculate delta with the engine viewangles, not with the cmd ones */
|
||||||
|
vec3_t engine_viewangles;
|
||||||
|
i_engine->GetViewAngles(engine_viewangles);
|
||||||
|
|
||||||
|
vec3_t best_delta = get_closest_delta(engine_viewangles);
|
||||||
|
if (!vec_is_zero(best_delta)) {
|
||||||
|
/* NOTE: We can divide the best delta here to add smoothing */
|
||||||
|
|
||||||
|
engine_viewangles.x += best_delta.x;
|
||||||
|
engine_viewangles.y += best_delta.y;
|
||||||
|
engine_viewangles.z += best_delta.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec_copy(cmd->viewangles, engine_viewangles);
|
||||||
|
}
|
|
@ -26,6 +26,9 @@ void correct_movement(usercmd_t* cmd, vec3_t old_angles);
|
||||||
extern visible_flags visible_mode;
|
extern visible_flags visible_mode;
|
||||||
bool chams(void* this_ptr);
|
bool chams(void* this_ptr);
|
||||||
|
|
||||||
|
/* src/features/aim.c */
|
||||||
|
void aimbot(usercmd_t* cmd);
|
||||||
|
|
||||||
/* src/features/misc.c */
|
/* src/features/misc.c */
|
||||||
void custom_crosshair(void);
|
void custom_crosshair(void);
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) {
|
||||||
localplayer = i_engine->GetLocalPlayer();
|
localplayer = i_engine->GetLocalPlayer();
|
||||||
|
|
||||||
bhop(cmd);
|
bhop(cmd);
|
||||||
|
aimbot(cmd);
|
||||||
|
|
||||||
correct_movement(cmd, old_angles);
|
correct_movement(cmd, old_angles);
|
||||||
vec_clamp(cmd->viewangles);
|
vec_clamp(cmd->viewangles);
|
||||||
|
|
Loading…
Reference in New Issue