forked from NoiseControllers/PUBG-No-Recoil
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhax.cpp
More file actions
72 lines (62 loc) · 1.41 KB
/
Copy pathhax.cpp
File metadata and controls
72 lines (62 loc) · 1.41 KB
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
#include "windows.h"
#include <iostream>
//with different weapons, there are different fire rate and recoil.
DWORD recoilStep=2u;
DWORD fireRate=30u;
/*
weapon fireRate recoilUp
-----------------------------
AKM 0.100s 8
SCAR-L 0.096s 7
M16A4 0.075s 7
M416 0.086s 7
UMP9 0.092s 5
SKS 0.090s 8
UZI 0.048s 5
*/
bool LeftMouseDown = true;
int leftMouseVKCode = 1;
int RecoilState = 4; //default state is turned off;
//to be changed into real game window name
LPCTSTR windowsName="notepad";
void __stdcall RemoveRecoil()
{
HWND foregroundWin;
leftMouseVKCode = 1;
while (1)
{
foregroundWin = GetForegroundWindow();
if (foregroundWin == FindWindowA(windowsName, 0) && RecoilState == 3)
{
if (LeftMouseDown)
{
Sleep(fireRate);
mouse_event(1u, 0, recoilStep, 0, 3u);
}
}
Sleep(1u);
}
}
void __stdcall KeyHandlerThread()
{
while (1)
{
if (GetAsyncKeyState(0x78) < 0) // F9 turns recoil reducer on.
{
RecoilState = 3;
Beep(0x320u, 0xC8u);
}
if (GetAsyncKeyState(0x79) < 0) // F10 turns recoil reducer off.
{
RecoilState = 4;
Beep(0x64u, 0xC8u);
}
LeftMouseDown = GetAsyncKeyState(leftMouseVKCode) < 0;
Sleep(1u);
}
}
int main() {
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)RemoveRecoil, 0, 0, 0);
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)KeyHandlerThread, 0, 0, 0);
std::cin.get();
}