# Banking

QBCore & ESX Compatible

<figure><img src="/files/y6AmKRv5lEr5b2BXdqiq" alt=""><figcaption></figcaption></figure>

&#x20;    \|             [Tebex ](https://xenscripts.tebex.io/package/5453123)          |             CFX.re            |             Youtube Preview           |        Discord        |

## Installation

### Dependencies

* [x] oxmysql - Download: <https://github.com/overextended/oxmysql>
* [x] PolyZone - Download: <https://github.com/mkafrin/PolyZone/>

### Installing in server

* Make sure oxmysql & PolyZone and installed in resources folder
* Place xn-banking.zip in resources folder
* Extract xn-banking.zip
* \[For ESX] Make sure `shared_script '@es_extended/imports.lua'` this line is uncommented in fxmanifest.lua
* Add `ensure PolyZone`(if not already present)
* Add `ensure oxmysql` (if not already present)
* Add `ensure xn-banking`

### Setting up database

* Delete any table whose name starts with bank in your database
* Import banking.sql file in your database present in xn-banking folder

## Config

## Add Bank Manager Job

There are 10 banks in banks table. Job grade = bank id in bank table.\
Example: If you set job at grade 1, then he will be bank manager of only bank with id 1.\
You can find location of banks in banks table in database

{% tabs %}
{% tab title="QBCore" %}
Edit qb-core / shared / job.lua

Like this add 10 grades each grade for 1 bank

```
['bank_manager'] = {
 	label = 'Bank Manager',
	defaultDuty = true,
	offDutyPay = false,
	grades = {
        ['1'] = {
        	name = 'Bank Manager',
                payment = 50
            },
        },
},

```

{% endtab %}

{% tab title="ESX" %}

```
INSERT INTO jobs(name, label, whitelisted) VALUES ("bank_manager", "Bank Manager", 0)
```

Like this add 10 grades, each grade for 1 bank

```
INSERT INTO job_grades (job_name, grade, name, label, salary) VALUES("bank_manager", 1, "Bank Manager", "Bank Manager", 50) 
```

{% endtab %}
{% endtabs %}

### Inventory Items

{% tabs %}
{% tab title="QBCore" %}

```
['visa'] = {
	['name'] = 'visa', 			 	  	  	
	['label'] = 'Visa', 					
	['weight'] = 0, 		
	['type'] = 'item', 		
	['image'] = 'visacard.png', 				
	['unique'] = true, 		
	['useable'] = true, 	
	['shouldClose'] = false,   
	['combinable'] = nil,   
	['description'] = 'visa card'
},
['mastercard'] = {
	['name'] = 'mastercard', 			 	  	  	
	['label'] = 'Mastercard', 					
	['weight'] = 0, 		
	['type'] = 'item', 		
	['image'] = 'mastercard.png', 				
	['unique'] = true, 		
	['useable'] = true, 	
	['shouldClose'] = false,   
	['combinable'] = nil,   
	['description'] = 'master card'
},
```

{% endtab %}

{% tab title="ESX" %}

```
INSERT INTO items (name, label, weight, rare, can_remove) VALUES ('visa', 'Visa', 1, 0, 1);
INSERT INTO items (name, label, weight, rare, can_remove) VALUES ('mastercard', 'Mastercard', 1, 0, 1);
```

{% endtab %}
{% endtabs %}

### Images

Visa - [Download Link](https://media.discordapp.net/attachments/216839636532723712/1060510362404917318/visacard.png)

Mastercard - [Download Link](https://media.discordapp.net/attachments/216839636532723712/1060510362761437224/mastercard.png)

## Ad

### Config.lua

Read comments in config.lua for more info

## Events&#x20;

{% tabs %}
{% tab title="Banking" %}
Client Side: `banking:client:openBank`
{% endtab %}

{% tab title="ATM" %}
Server Side: `banking:server:checkatm`
{% endtab %}
{% endtabs %}

## Commands

<details>

<summary>/atm</summary>

To open atm near atm prop

</details>

### Fixed Societies

1. Import SQL file added in update

```
bank_fixed_societies.sql
```

2. Config option to enable Fixed Societies

```
Config.EnableFixedSocieties
```

3. Exports available only when Fixed Societies is enabled.\
   These exports are only for Job/Gang Accounts and not for player accounts

```
AddMoney = function(joborgangname, amount, reason)
AddGangMoney = function(joborgangname, amount, reason)
RemoveMoney = function(joborgangname, amount, reason)
RemoveGangMoney = function(joborgangname, amount, reason)
GetAccountBalance = function(joborgangname)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xenscripts.gitbook.io/xenscripts/scripts/banking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
