GTA AFK Money (Survival job runner, using AutoHotKey)

Note: I had taken this script down, for about a week. It's back up, with this description page, but I think it needs rewriting or at least some further tweaking. I have no confirmed successful users, so if you find you can get it working, or not, please email me at It may work for you if you're screen is 1920x1080 native resolution and aspect ratio set to Auto, or if you use 16:9 resolution (which is what I think "Auto" represents on my display).

Motivation: GTA5 online can be fun, or it can get to be a grind. It's a grind if you're primarily trying to make money in the game, for whatever reason, and trying to maximize your income. If you're just starting out and "broke", or you're tired of the grind, you can run AFK (away from keyboard) jobs for truly passive income, using a script. There are ways to do it without a script, such as running a multiplayer "Peter Griffin" survival job with a controller "rubber-banded" in a position that causes your character to walk in circles, but my ports aren't open (ISP modem+router is blocking me; ISP did not provide the password to configure it), and this makes joining (hosting) multiplayer jobs difficult, so I had to use a script that reruns the job automatically by searching for images. I found this on reddit gtaglitches but the original had a few issues, so I tweaked it for weeks until it was about 99% reliable AFK, or about 80% reliable in light use (it misses the Replay when user activity prevents window switching, because I wanted the script to run unobtrusively in the event I'm trying to work on the same PC.


  1. Go to and download the latest 1.1.x version of AHK and install on your Windows computer. (Mine says Version in the Help)
  2. Download and unzip this archive. (I put mine inside an AHK folder on the desktop)
  3. Run AFKmoney.ahk to start the script
  4. Open GTA5.exe as normal (I use the Steam launcher)
  5. Bookmark this job: AFK Money & RP V2, on Social Club.
  6. Make sure GTA is running in 800x600 Windowed (not borderless). There are instructions in the window title (which is why it's important not to be in borderless mode.)
  7. Press F8 when your character is in GTA Online in freemode (not in a mission) to start the script.
  8. For some additional instructions, and the original script from which mine is derived, see this reddit post. Note that I have removed the pause function, and added F9 to resume (for when the AFK job is still running but you've restarted the autohotkey script, for whatever reason.
    Some glitches in my script: When not truly AFK, this AHK script may seem to get "stuck" at a particular place in the code where it's waiting to start the mission; this code is intended to correct for the occasional player who slips in before the session is closed (since I don't bother to run the game in solo sessions), and is working quite well, though the behavior is sub-optimal when not truly AFK. There's also the fact that F8 doesn't respond when you've already pressed it and it's still running, in an infinite loop; that's normal behavior for a hotkey, though something I would change if I rewrote this to use a SetTimer approach where all hotkeys are asynchronous with the execution of long-running game automation functions.) F9 also works to put the script into a loop that prevents idle kick when in freemode, or to resume mission-looping after manually starting an AFK survival mission. For example, I sometimes would start a bookmarked "Sky Fall Fast AFK test" survival, because that one was close to my Meth, so I could deliver meth when I'm done with the survival job (exiting by pressing escape and enter or selecting Freemode before the script selects Replay.)
  9. There are various macros using obscure key combinations that I'm probably not going to bother to document. Some more useful ones would be ctrl+shift+8 to switch from max resolution to min resolution (presumably 800x600), then start the AFK job as usual. I also provided ctrl+shift+0 to switch back to max resolution. Then there's ctrl+alt+N to go to new session (eg. when making a bunker or MC delivery and you're given vehicles you don't want to bother with.) There can be timing issues, but I *think* I've resolved them all, on my end, but your CPU could be slower and might need an even greater MenuDelay than 1600 milliseconds (which seems ridiculously slow.) I may want to fiddle with SetKeyDelay again, but hate to mess with it now that the script is running so reliably.

    One of the reasons (or excuses) I was slow to document this script is because I believe anyone who runs a script like this should at least *try* to read it first. Be careful with any script in which you see DllCall, for example; dangerous things can be done with such commands (the references to DllCall in my script are in some untested code, for forcing the current session to be a solo public session, by pausing the process for 10 seconds). Also be careful with obscured or binary code, such as C code that has been converted to hexadecimal or base64 strings (common in AHK scripts.) There is no malicious code in the script that I uploaded, but it is up to you to verify that.

    Also, I do not provide a compiled script (.EXE), because I believe it would be foolish for anyone to run an unsigned binary from a stranger posting on a forum or advertising within a game (which I suppose my SPAM function fits the definition of).

    There definitely are issues with trying to perform other activities on the same computer. It's behaving about as well as it can, under the conditions, (WinActivate when the user is idle for at least 10 seconds to perform its activities.), but the most common consequence of trying to work on that same computer is that the end-of-job transition goes to a "real" Survival instead of the AFK one. Resolving this may be possible, but not easy, given that GTA only responds to keystrokes sent to its window when the window is active.

    Sorry if I had users who tried this script and were confused, because the only instructions were in the title bar (this page was nearly blank, other than the link.) Originally, I used a ToolTip for instructions, but placement of the ToolTip was problematic, as it sometimes interfered with mouse operations, like moving a window. And it would jump around as the GTA window was moved.

    Here's an email if you want to make any comments or suggestions, or ask questions. I am still a bit reluctant to post publicly about this script, because I'm on unemployment and not sure how public I want to be about playing this silly game!! Email: . Note that I don't check that email daily, to it might take me a few days to get back to you.

    Update: fixed VolumeUp and down (Ctrl+Alt+NumpadPlus and minus). But they are too slow; may tweak later. I have timing issues to work on... I will probably put this script on GitHub so that users (if any) can provide feedback, and so I can track changes, but again I really need a rewrite to fix the awkwardness of hotkeys and make hotkeys asynchronous with menu(s), either building a Gui menu or creating a "title bar menu".

    Update 2: WinActivate fails if you move GTA5 to another virtual desktop. I might want to fix... ( ref: AHK board topic 70136)

    PS: QOMPH.COM was intended to be a personal healthcare analytics site, but I haven't started building it yet (after two years...) Hopefully soon...

    PPS: I would move the code to my github, but again I'm hesitant to be "too" public about this AutoHotKey scripting activity... maybe it would be relevant to a game-automation SDET (testing) job?

    Some comments on the appeal of open-world gaming, and specifically GTA:O. What's the draw? What leads a player in, and what keeps him in? There are many aspects to the appeal of GTA:O. A visually-impressive, somewhat realistic, immersive world in which the player can run free, explore randomly, experiment with objects, NPCs and players, learn what works and what doesn't, infer rules of the game world and perhaps build a few of their own rules (with Creator), although that aspect is limited in GTA. An environment in which success at a mission or job is easy, but also fraught with mild challenges. Challenges that relate to everyone, regardless of language or ability. Virtually anyone can press keys on a keyboard or controller, and can follow simple visual clues such as colors on a map (except perhaps the color-blind!) Language skills are not needed in this game, nor math skills. There are many challenges that are time-limited, so walking/running/driving/shooting may have to be done with some degree of accuracy to complete the challenge in the limited time, but most jobs permit two or three retries before the mission is considered a failure. Missions and jobs have simple objectives; drive somewhere, kill someone, steal some loot, bring it back. But there are many variants on these themes that have added complexity to the challenges over the years, to where GTA V:Online is a very rich environment with much to learn, much to explore.

    There is also a social element. I find sometimes I'm more interested in chatting or collaborating with other players than in killing or fighting them (ha... I have my destructive moments, and even carelessly killed a friend yesterday...(sorry again Adam!)) Perhaps there's also a negative social element, because people do sometimes randomly "grief" others, some more intentionally and persistently than others. But I certainly see potential for the positive social element, based on my and others' players to want to form friendships, alliances (informally) and help on a job within the game. The environment is too limited, and lacking in truly useful (or intellectual) learning activities, but there are types of learning that occur anyway (though mostly confined to the somewhat arcane game rules and behaviors.)

    Criticisms: The environment is "cartoonish" (my word for it); physics are not real (though there seems to be a significant degree of accuracy to much of the physics). Surely a Phantom Wedge or Ramp Buggy couldn't *really* knock ambulances, trucks and cars 50 feet in the air or more, if these vehicles existed in "real life"! But these cartoonish elements are both amusing and interesting, and I can't claim that a RealPhysics environment would have better appeal, because much of the fun of explorarion in such a game is learning these strange and silly elements of behavior of the environment.

    Many items are mostly unlocks, and otherwise next-to-useless. MOC and TerrorByte are examples; MOC is only useful as an unlock for weapons (or for "Criminal Damage" freemode events; probably very effective if you can find 3 friends to man all 3 turret stations while you drive around!), and TerrorByte is only useful for Oppressor MK2 weapons unlock. Same with Arcade; the absolute worst investment I've ever seen, in the game, other than the unlock for the associated heist, especially if you buy the individual game machines (a few milllion to buy them all, and I make that back at what, $30k a day or less? Will have to play the game non-stop for almost a year to make back that investment!). (But I *do* like the Master Control Terminal; who wouldn't like 9 monitors on a giant desk? Too bad I can't stick it in my MOC or other vehicle I can call at any time!) I think the game should separate unlocks to reduce confusion, like saying "weapons unlock costs $2 million", but I can see that having a game object associated with the unlock might make it feel more real. (Just wait until a game comes out where each unlock requires buying an NFT!!!)

    I have much more to say, but limited time to say it now. Perhaps the only excuse I have for playing this game so much, these last three months, is my fantasizing about creating a better game. I want to model real physics, to some level. For example, I would love to give tools to players to create their own customized race cars and engines, based on 100% real physics! This would be incredible, if modelled down to the molecular and even subatomic and crystallographic levels! Someone will do it someday...

    I'm partly impressed that R* has made $6 billion on a game that is so glitchy and buggy, but also fairly impressed by the creativity and visual appeal of the game, and can see the mass appeal, having played it so much for the last 3 months (too much, though I'm mostly AFK lately.) Having made $190 million or so, it's about time I quit it... There is not much dramatically new to discover in the game, although Cayo would be a learning experience. It's just a bit too long and challenging (in mostly non-intellectual ways, although I suppose there are some mild puzzles to solve), for my taste.

    Some port forwarding instructions / documentation for OpenVPN Access Server users:

    (4/15) Okay I think this is working; I seem able to host Doomsday heist setups. But the VPN does not seem to improve loading times or connection reliability, just ability to host missions.

    This is mostly documentation for my own reference; I may convert it to more accessible documentation later.
    cat <<$$END$$ > /etc/
    for port in 6672 61455 61456 61457 61458
    iptables -t nat -A PREROUTING -d $VPSIP/32 -p udp --dport $port -j DNAT --to-destination $CLIENTIP
    iptables -t nat -A POSTROUTING -s $CLIENTIP/32 -p udp --dport $port -j SNAT --to-source $VPSIP
    User permissions:
    Use Static:
    DMZ: Yes
    Testing [from a different machine than either server or client]:
    $ nc -uzv 6672
    Connection to 6672 port [udp/*] succeeded!
    $ nc -uzv 61455
    Connection to 61455 port [udp/*] succeeded!
    $ nc -uzv 61458
    Connection to 61458 port [udp/*] succeeded!
    # cat /etc/rc.local
    /usr/sbin/ || exit 1
    exit 0
    The above rc.local didn't work. I had to add that line to /usr/local/openvpn_as/scripts/openvpnas
    # cat /usr/sbin/
    mkdir /dev/net
    mknod /dev/net/tun c 10 200
    chmod 0666 /dev/net/tun
    if you want a valid certificate, instead of self-signed, see:
    # /usr/local/openvpn_as/scripts/sacli --key "cs.priv_key" --value_file /etc/letsencrypt/live/ ConfigPut
    [True, {}]
    # /usr/local/openvpn_as/scripts/sacli --key "cs.cert" --value_file /etc/letsencrypt/live/ ConfigPut
    [True, {}]
    # pushd /etc/letsencrypt/live/
    /etc/letsencrypt/live/ ~
    # cat fullchain.pem privkey.pem > bundle.pem
    # popd
    # /usr/local/openvpn_as/scripts/sacli --key "cs.ca_bundle" --value_file /etc/letsencrypt/live/ ConfigPut
    [True, {}]
    # service openvpnas restart