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

# Installation

Requirements, database and items for ALT0 Bank.

## Requirements

| Resource                                                                      | Notes                                                                                                       |
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| Qbox (`qbx_core`), QBCore (`qb-core`) or ESX (`es_extended`)                  | Found automatically, or set `Config.Framework`. See [Frameworks](/alt0-docs/getting-started/frameworks.md). |
| [ox\_lib](https://github.com/overextended/ox_lib)                             | Required                                                                                                    |
| [oxmysql](https://github.com/overextended/oxmysql)                            | Required                                                                                                    |
| [ox\_inventory](https://github.com/overextended/ox_inventory) or qb-inventory | On ESX, ox\_inventory. Found automatically, or set `Config.Inventory`.                                      |
| [ox\_target](https://github.com/overextended/ox_target) or qb-target          | ATMs on world props                                                                                         |

Optional: `alt0-mdt` (police fines as invoices and the financial audit), `alt0-notify` (used for notifications when it runs).

## 1. Remove your old banking script

Remove any other banking resource first: qb-banking, esx\_banking, Renewed-Banking, okokBanking and so on. The common banking exports (`AddMoney`, `RemoveMoney`, `addAccountMoney`, `getAccountMoney`...) are provided, so scripts that pay into job accounts keep working. On QBCore the bank also answers `exports['qb-banking']`, so stock jobs keep paying into their society.

{% hint style="info" %}
**ESX:** cash and the checking balance are the ESX `money` and `bank` accounts. ESX never lets an account go below zero, so overdrafts are off there. Society money from esx\_society / esx\_addonaccount stays separate from the bank's business accounts.
{% endhint %}

## 2. Add the resource

```cfg
ensure ox_lib
ensure oxmysql
ensure ox_inventory     # or qb-inventory
ensure qbx_core         # or qb-core / es_extended
ensure ox_target        # or qb-target
ensure alt0-bank
```

## 3. Database

Import `banking.sql` once. It creates every `alt0_banking_*` table.

## 4. Items

Add to `ox_inventory/data/items.lua`:

```lua
['bank_card'] = {
    label = 'Bank Card', weight = 10, stack = false, close = true,
    description = 'A debit card linked to your bank account',
},
['banktablet'] = {
    label = 'Bank Tablet', weight = 500, stack = false, close = true,
    description = 'Online banking anywhere',
},
['skimmer_device'] = {
    label = 'ATM Skimmer', weight = 300, stack = true, close = true,
    description = 'Captures cards and PINs at an ATM',
},
```

### qb-inventory

`bank_card` is already in QBCore (it must stay `unique = true`). Add the other two to `qb-core/shared/items.lua`:

```lua
banktablet     = { name = 'banktablet', label = 'Bank Tablet', weight = 500, type = 'item', image = 'tablet.png', unique = true, useable = true, shouldClose = true, description = 'Online banking anywhere' },
skimmer_device = { name = 'skimmer_device', label = 'ATM Skimmer', weight = 300, type = 'item', image = 'usb_device.png', unique = false, useable = false, shouldClose = true, description = 'Captures cards and PINs at an ATM' },
```

`bank_card` and `banktablet` are made usable by the script. Players get their first card when they open an account at a branch.

## Using it

| Where                                        | What                                                                                   |
| -------------------------------------------- | -------------------------------------------------------------------------------------- |
| Bank branch (E at the counter)               | Open accounts, cards, transfers, invoices, loans, the society account, cash in and out |
| Cash desk                                    | Withdraw cash                                                                          |
| ATM (target the machine, or `/atm`)          | Insert a card, enter the PIN, withdraw                                                 |
| Bank Tablet item, or `/bank` with the tablet | Online banking (no cash)                                                               |

Staff commands: `/bankfreeze <citizenid>`, `/bankunfreeze <citizenid>`, `/bankaudit [citizenid]`. Who counts as staff is `Config.AdminAce`.
