Rob ATMs [ESX] [FREE]

This script makes it possible to rob ATMs:

(!) PERMISSIONS (!)

  • You can edit it, but don’t re-publish it as yourown.

(!) Keep in mind (!)

  • This wouldn’t have been possible for me without @aiko0cb.vd’s help :slight_smile:
  • Currently, you can only rob the ATM at the beach (More in the preview)

(!) Requirements (!)

  • An item called ‘atmKey’
  • Latest ESX

(!) About (!)
This little script makes it possible to buy lost ATM-Keys, and then to rob the ATMs with the key.
You have a fair chance to make cash, but also a chance that the ATM is just empty.

Important-things like prices, rewards, etc. are configurable in the Config.lua

3 Likes

Your reward server event is completely insecure.

RegisterNetEvent('robatm:giveReward')
AddEventHandler('robatm:giveReward', function()
  local xPlayer = ESX.GetPlayerFromId(source)
  xPlayer.addMoney(Config.Reward)
end)

Anyone can just trigger this with the appropriate tools.

Of course there are ways. Example :

  • Player initiates ATM robbery, this triggers a server event

  • Server event first checks player position against known ATM position, surely the player cannot trigger it from across the map. Use Onesync for this, it’s great.

  • Server pays out the player and then stores player ID in an array, then triggers a client event telling the player that he cannot rob this same ATM again until X time, putting him into cooldown.

  • While this cooldown is effective, no marker should be drawn, no controls processed clientside. If not for a measly “you cannot rob ATMs at this moment”, or something.

  • Server then has a thread that ticks every second or so, checking if the timeout we set for each ATM robbery has passed (or for all of them, depending how you want to do it), in which case it removes player from our “cooldown” array

  • Server triggers a client event telling player we stored earlier : “Hey, you can rob ATMs again !”

  • If a player tries to trigger the server event to rob an ATM while he’s supposed to be in cooldown, that means he has tampered with the resource and is triggering the event directly.

  • Logging in Discord is always a good idea, with timestamps for good record keeping

Badamim badaboom secure lil event