-
Notifications
You must be signed in to change notification settings - Fork 0
/
aimbot.cpp
82 lines (64 loc) · 1.67 KB
/
aimbot.cpp
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
#include "aimbot.h"
void Aimbot::Push(AActor* Player, AActor* Actor)
{
Vector2 Screen;
Vector3 ActorPos = GetBoneLocation(Actor->Mesh, BoneFNames::Head);
WorldToScreen(ActorPos, Screen);
double Distance = sqrt(pow(Screen.X - (double)Width, 2) + pow(Screen.Y - (double)Height, 2));
if (TempPreviousDistance > Distance)
{
TempEnemy = Actor;
TempLocalPlayer = Player;
TempPreviousDistance = Distance;
}
return;
}
void Aimbot::Clear()
{
Enemy = TempEnemy;
LocalPlayer = TempLocalPlayer;
PreviousDistance = TempPreviousDistance;
TempEnemy = NULL;
TempLocalPlayer = NULL;
TempPreviousDistance = 100000.f;
}
double Aimbot::GetAimDistance()
{
return PreviousDistance;
}
Vector3 Aimbot::GetAimLocation()
{
return GetBoneLocation(Enemy->Mesh, BoneFNames::Head);
}
void Aimbot::MemoryAimbot()
{
if (CanAim())
{
FRotator AimRota = Aimbot::GetInstance().GetAimRotation();
LocalPlayer->ControllerYawRotation = (float)AimRota.Yaw;
LocalPlayer->ControllerPitchRotation = (float)AimRota.Pitch;
}
}
FRotator Aimbot::GetAimRotation()
{
Vector3 EnemyPos = GetBoneLocation(Enemy->Mesh, BoneFNames::Head);
Vector3 CameraPos = LocalPlayer->Controller->PlayerCameraManager->Pos;
Vector3 diff{ EnemyPos.X - CameraPos.X,
EnemyPos.Y - CameraPos.Y,
EnemyPos.Z - CameraPos.Z,
};
FRotator AimRotation{ 0 };
AimRotation.Yaw = atan2(diff.Y, diff.X) * 180 / 3.1415926;
AimRotation.Pitch = atan2(diff.Z, sqrt(diff.X * diff.X + diff.Y * diff.Y)) * 180 / 3.1415926;
return AimRotation;
}
bool Aimbot::CanAim()
{
if (!Enemy || !LocalPlayer)
return false;
return true;
}
bool Aimbot::IsVisible()
{
return CanAim() ? !Enemy->IsVisible(LocalPlayer, BoneFNames::Head) : false;
}