-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_keys.py
executable file
·91 lines (64 loc) · 1.83 KB
/
get_keys.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
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
83
84
85
86
87
88
89
90
91
import keyboard
import time
# Countdown
def countdown():
for i in range(5, 0, -1):
print(i)
time.sleep(1)
# Key Detection
def key_check():
detected_keys = [0, 0, 0, 0] # [W, A, S, D]
try:
if keyboard.is_pressed('w'):
detected_keys[0] = 1
else:
detected_keys[0] = 0
if keyboard.is_pressed('a'):
detected_keys[1] = 1
else:
detected_keys[1] = 0
if keyboard.is_pressed('s'):
detected_keys[2] = 1
else:
detected_keys[2] = 0
if keyboard.is_pressed('d'):
detected_keys[3] = 1
else:
detected_keys[3] = 0
except:
print("We shouldn't be here, my friend...")
return detected_keys
def key_check_with_nitro():
detected_keys = [0, 0, 0, 0, 0] # [W, A, S, D, shift]
try:
if keyboard.is_pressed('w'):
detected_keys[0] = 1
else:
detected_keys[0] = 0
if keyboard.is_pressed('a'):
detected_keys[1] = 1
else:
detected_keys[1] = 0
if keyboard.is_pressed('s'):
detected_keys[2] = 1
else:
detected_keys[2] = 0
if keyboard.is_pressed('d'):
detected_keys[3] = 1
else:
detected_keys[3] = 0
if keyboard.is_pressed('shift'):
detected_keys[4] = 1
else:
detected_keys[4] = 0
except:
print("We shouldn't be here, my friend...")
return detected_keys
def key_check_loop():
countdown()
while True:
print(key_check())
if keyboard.is_pressed('q'):
break
print("Keycheck Stopped")
print("END OF SCRIPT")