-
Notifications
You must be signed in to change notification settings - Fork 11
/
ZoomFire.ahk
79 lines (63 loc) · 1.42 KB
/
ZoomFire.ahk
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
#SingleInstance
#NoEnv
SendMode, Input
;------------------------------------------------------------------
;Add your games window class name to this list to activate the script for that game
;------#GAMES#--------------------------------------------------
GroupAdd,gamewindow ,ahk_class CoD4 ;COD 4: MW
GroupAdd,gamewindow ,ahk_class CoD-WaW ;COD 5: WAW
GroupAdd,gamewindow ,ahk_class IW4 ;COD 6: MW2
GroupAdd,gamewindow ,ahk_class CoDBlackOps ;COD 7: BO
#IfWinActive ahk_group gamewindow
;--- Bindings ---
fire = MButton
aim = RButton
zoomfire = LButton
zoomfiretoggle = NumpadDot ; the decimal point on the number pad turns it on or off
;-- Locals ---
zoomfireon := true
;--- Setup hotkey ---
Hotkey,~*%zoomfire%,do_ZoomFire
Hotkey,~*%zoomfiretoggle%,do_ZoomFireToggle
return
do_ZoomFireToggle:
{
if (zoomfireon = true)
{
zoomfireon := false
SoundBeep, 350, 100
}
else
{
zoomfireon := true
SoundBeep, 1200, 100
}
return
}
do_ZoomFire:
{
if not zoomfireon
return
; If we've not already got RButton down, press and hold it
GetKeyState, aimstate, %aim%, P
if aimstate = U
{
Sleep 35
Send { %aim% down }
}
; Fire!
Sleep 35
Send { %fire% down }
; Wait until the primary button has been released
KeyWait, %zoomfire%, T5
; Cleanup the mess by clicking everything LOL
Sleep 35
Send { %fire% }
; If we clicked it down, click it back up
if aimstate = U
{
Sleep 35
Send { %aim% }
}
return
}