; GTA Online Anti-AFK Script ; Press F8 to start/stop the script ; The script will press 'W' and 'S' keys every 4 minutes to prevent inactivity kick #Requires AutoHotkey v2.0 #SingleInstance Force ; Variables isRunning := false timerInterval := 240000 ; 4 minutes in milliseconds ; F8 to toggle the script on/off F8:: { global isRunning isRunning := !isRunning if (isRunning) { ToolTip("GTA Anti-AFK: ACTIVE - Sending input every 4 minutes") SoundBeep(1000, 200) TrayTip("Script is now ACTIVE", "GTA Anti-AFK") SetTimer(AntiAFK, timerInterval) SetTimer(() => ToolTip(), -3000) ; Hide tooltip after 3 seconds } else { ToolTip("GTA Anti-AFK: INACTIVE") SoundBeep(500, 200) TrayTip("Script is now INACTIVE", "GTA Anti-AFK") SetTimer(AntiAFK, 0) SetTimer(() => ToolTip(), -3000) ; Hide tooltip after 3 seconds } } ; Anti-AFK function AntiAFK() { ; Send W key (move forward slightly) Send("{w down}") Sleep(100) Send("{w up}") Sleep(200) ; Send S key (move backward slightly) Send("{s down}") Sleep(100) Send("{s up}") ; Optional: Show notification currentTime := FormatTime(, "HH:mm:ss") TrayTip("Input sent at " . currentTime, "GTA Anti-AFK") } ; F9 to exit the script completely F9:: { TrayTip("Script terminated", "GTA Anti-AFK") Sleep(1000) ExitApp() } ; Show initial instructions TrayTip("Press F8 to toggle ON/OFF`nPress F9 to exit script", "GTA Anti-AFK")