Skip to content

Instantly share code, notes, and snippets.

@hldh214
Created May 6, 2018 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hldh214/5920d7766bd52090a9e55ddbf0232009 to your computer and use it in GitHub Desktop.
Save hldh214/5920d7766bd52090a9e55ddbf0232009 to your computer and use it in GitHub Desktop.
import time
import win32api
import win32con
from ctypes import windll, c_uint
recoil = [20, 21, 22, 21, 22, 22, 23, 22, 23, 23, 24, 24, 25, 25, 25, 25, 26, 27, 28, 29, 30, 32,
34, 34, 35, 34, 35, 34, 35, 34, 35, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35]
a = 0
count = 0
while True:
# Check button press
a = win32api.GetAsyncKeyState(win32con.VK_LBUTTON)
# While button is pressed
while a != 0:
time.sleep(0.2)
x_current, y_current = win32api.GetCursorPos() # Checks current cursor position
windll.user32.mouse_event(c_uint(0x0001), c_uint(0), c_uint(recoil[count]), c_uint(0), c_uint(0))
count += 1 # Increase count by 1
a = win32api.GetAsyncKeyState(win32con.VK_LBUTTON) # Check if button is pressed
# If button is not pressed anymore
if a == 0:
count = 0 # Resets counter
time.sleep(0.01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment