-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathAimBot.h
85 lines (59 loc) · 2.61 KB
/
AimBot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#pragma once
#include "Globals.h"
#include "Offsets.h"
#include "Driver.h"
#include "Utils.h"
#include <windows.h> // 对于 GetAsyncKeyState
#include <cstdlib> // 对于 rand() 和 srand()
#include <ctime> // 对于 time()
#include"NoRecoli.h"
class Aimbot {
public:
Aimbot() {
srand(time(NULL)); // 初始化随机数生成器
}
void update() {
bool isAimKeyPressed = false;
if (!shouldExecuteAimbot()) return;
ULONG64 weaponID = GetEntity(Read<INT>(ProcessId, LocalPlayer + OFFSET_WEAPON - 20) & 0xFFFF);
FLOAT bulletSpeed = Read<FLOAT>(ProcessId, weaponID + OFFSET_BULLET_SPEED);
ULONG64 ptr = aimPtr;
if (ptr == 0) return;
Grenade();
if (var::AimBotCheck && isVisible(ptr)) {
Vector3 localPos = Read<Vector3>(ProcessId, LocalPlayer + OFFSET_CAMERAPOS);
Vector3 entityPos = GetHitBoxPosition(ptr, AimBot_Bones);
FLOAT predictDistance = localPos.DistTo(entityPos);
Vector3 ptrVelocity = Read<Vector3>(ProcessId, ptr + OFFSET_ABS_VELOCITY);
FLOAT bulletGravity = Read<FLOAT>(ProcessId, weaponID + OFFSET_BULLET_SCALE);
entityPos = PredictPos(entityPos, ptrVelocity, predictDistance, bulletSpeed, bulletGravity, weaponID);
Vector2 calcedAngle = CalcAngle(localPos, entityPos);
Vector2 viewAngle = Read<Vector2>(ProcessId, LocalPlayer + OFFSET_VIEWANGLES);
Vector2 newAngle = smoothAimMove(viewAngle, calcedAngle, AimBot_Smooth);
newAngle.Normalize();
Write<Vector2>(ProcessId, LocalPlayer + OFFSET_VIEWANGLES, newAngle);
}
else if (!var::AimBotCheck) {
Vector3 localPos = Read<Vector3>(ProcessId, LocalPlayer + OFFSET_CAMERAPOS);
Vector3 entityPos = GetHitBoxPosition(ptr, AimBot_Bones);
FLOAT predictDistance = localPos.DistTo(entityPos);
Vector3 ptrVelocity = Read<Vector3>(ProcessId, ptr + OFFSET_ABS_VELOCITY);
FLOAT bulletGravity = Read<FLOAT>(ProcessId, weaponID + OFFSET_BULLET_SCALE);
entityPos = PredictPos(entityPos, ptrVelocity, predictDistance, bulletSpeed, bulletGravity, weaponID);
Vector2 calcedAngle = CalcAngle(localPos, entityPos);
Vector2 viewAngle = Read<Vector2>(ProcessId, LocalPlayer + OFFSET_VIEWANGLES);
Vector2 newAngle = smoothAimMove(viewAngle, calcedAngle, AimBot_Smooth);
newAngle.Normalize();
Write<Vector2>(ProcessId, LocalPlayer + OFFSET_VIEWANGLES, newAngle);
}
}
private:
bool shouldExecuteAimbot() {
return var::EnableAimBot;
}
Vector2 smoothAimMove(Vector2 currentAngle, Vector2 targetAngle, float smoothFactor) {
Vector2 newAngle = targetAngle - currentAngle;
newAngle.Normalize();
return currentAngle + newAngle / smoothFactor;
}
};