-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMuzzleBrake.py
46 lines (32 loc) · 940 Bytes
/
MuzzleBrake.py
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
from pynput.mouse import Listener
import threading
import ctypes
import time
MOUSEEVENTF_MOVE = 0x0001
WM_LBUTTONDOWN = 0x0201
WM_LBUTTONUP = 0x0202
user32 = ctypes.windll.user32
left_pressed = False
right_pressed = False
run = False
print("Ready...")
def px(y_distance):
user32.mouse_event(MOUSEEVENTF_MOVE, 0, y_distance, 0, 0)
def on_click(x, y, button, pressed):
global left_pressed, right_pressed, run
if button == button.left:
left_pressed = pressed
elif button == button.right:
right_pressed = pressed
if left_pressed and right_pressed and not run:
run = True
threading.Thread(target=main).start()
elif not (left_pressed and right_pressed) and run:
run = False
def main():
global run
while run:
px(4)
time.sleep(0.011)
with Listener(on_click=on_click) as listener:
listener.join()