forked from clareow/external_pubg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAimbot.h
56 lines (48 loc) · 1.16 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
#pragma once
#include "include.h"
void AimBot_API(float X, float Y)
{
float ScreenCenterX = (Width / 2);
float ScreenCenterY = (Height / 2);
float TargetX = 0;
float TargetY = 0;
if (X != 0)
{
if (X > ScreenCenterX)
{
TargetX = -(ScreenCenterX - X);
TargetX /= AimSpeed;
if (TargetX + ScreenCenterX > ScreenCenterX * 2) TargetX = 0;
}
if (X < ScreenCenterX)
{
TargetX = X - ScreenCenterX;
TargetX /= AimSpeed;
if (TargetX + ScreenCenterX < 0) TargetX = 0;
}
}
if (Y != 0)
{
if (Y > ScreenCenterY)
{
TargetY = -(ScreenCenterY - Y);
TargetY /= AimSpeed;
if (TargetY + ScreenCenterY > ScreenCenterY * 2) TargetY = 0;
}
if (Y < ScreenCenterY)
{
TargetY = Y - ScreenCenterY;
TargetY /= AimSpeed;
if (TargetY + ScreenCenterY < 0) TargetY = 0;
}
}
INPUT InputMouse = { 0 };
InputMouse.type = INPUT_MOUSE;
InputMouse.mi.dwFlags = MOUSEEVENTF_MOVE;
if (abs((DWORD)TargetX * AimSpeed) > 1)
InputMouse.mi.dx = (DWORD)TargetX;
if (abs((DWORD)TargetY * AimSpeed) > 1)
InputMouse.mi.dy = (DWORD)TargetY;
SendInput(1, &InputMouse, sizeof(INPUT));
return;
}