> For the complete documentation index, see [llms.txt](https://randolio.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://randolio.gitbook.io/docs/paid-scripts/atm-hacking.md).

# ATM Hacking

### Requirements

* oxmysql
* OneSync (with infinity enabled)
* ox\_lib
* ox\_inventory
* ox\_target/interact script: <https://github.com/darktrovx/interact>
* ESX/QBX/QB Framework
* glow\_minigames: <https://github.com/christikat/glow_minigames> (optional if you decide to do your own minigame logic)

### Client Exports

```lua
-- Returns (number) player's hacking level based off their xp.
local level = exports.randol_atmhacking:GetHackingLevel()

-- Returns (number) player's hacking xp.
local xp = exports.randol_atmhacking:GetExp()

-- Returns boolean (true or false) if the player is currently searching for targets.
local isHacking = exports.randol_atmhacking:isPlayerHacking()

-- Calling this will stop a player who is currently searching for targets.
exports.randol_atmhacking:StopPlayerHacking()
```

### Server Exports

```lua
-- Returns (number) player's hacking level based off their xp.
local level = exports.randol_atmhacking:GetHackingLevel(src)

-- Returns (number) player's hacking xp.
local xp = exports.randol_atmhacking:GetExp(src)

-- Returns (number) the bonus (defined in sv_config Levels table) based off the player's xp.
local bonus = exports.randol_atmhacking:GetHackingBonus(src)

-- Returns (boolean) if the player is connected to an ATM.
local hasAtm = exports.randol_atmhacking:HasAtmOwnership(src)

-- Adds the data receiver item with metadata set. Do not use regular /giveitem commands.
exports.randol_atmhacking:AddReceiverItem(src)
```

### Levels

```lua
{ -- Level 1 Example
    value = 1, threshold = 500, bonus = 150, gain = {min = 1, max = 3},
    settings = {gridSize = 6, timeLimit = 8000, charSet = 'alphabet', required = 5}
},
```

{% hint style="info" %}
{% code fullWidth="false" %}

```css
Value: level
Threshold: xp required to reach next level.
Bonus: the amount of bonus cash you get from your current level after hack.
Gain: the min/max xp you can gain from a single success hack at that level.
Settings: Only applies if using glow-minigames.
```

{% endcode %}
{% endhint %}
