Last active
August 29, 2015 14:24
-
-
Save grayatrox/8c8dcd81208a0463049e to your computer and use it in GitHub Desktop.
GTA V Anti-AFK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toggle := 0 ; boolean, false : var to toggle the afk loop | |
sleepTime := 10 ; (In Seconds) We don't need to be constantly moving. Even once every 10 seconds is very quick. (A fast loop will also make the script unreliable) | |
SetTimer, afkLoop, % sleepTime * 1000 | |
Settimer, afkLoop, Off | |
; We could probably detect when the user has gone afk, and starts the timer before the game kicks them. I don't know how long the game waits before kicking someone however. | |
Return | |
$NumpadMult:: | |
toggle := !toggle ; quick way of inversing a boolean in AHK | |
SetTimer, afkLoop, % (toggle?"On":"Off") | |
; ToolTip % (toggle?"On":"Off") ; My debugging check to see if the state was being toggled correctly, and on time. | |
if (toggle) ; beep once to indicate the timer is on | |
SoundBeep | |
else { ; beep twice to indicate the timer is off | |
SoundBeep | |
SoundBeep | |
} | |
Return | |
^M::ExitApp ; Ctrl+M - Avoid accidently exiting the script while typing. | |
afkLoop: | |
if (!toggle) ; If we somehow get to this point, but don't want to be, we exit here. | |
return | |
else { | |
Send, {A} ; I don't see the point in spamming all move keys. Any two opposing directions should be enough | |
Sleep 500 ; The game requires a bit of a pause between presses | |
Send, {D} | |
} | |
KeyWait, NumpadMult, T1 ; Give the user a chance to press NumpadMult again to disable the the afkLoop timer. | |
return | |
/* Original loop | |
$NumpadMult:: | |
KeyWait, NumpadMult | |
While !GetKeyState("W","A") | |
Send, {W}{A}{S}{D} | |
KeyWait, NumpadMult | |
Return | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment