# Exports

## Lua code Trigger for Client Side

```lua
TriggerEvent("nuifix") -- if the NUI breaks.
```

## Lua code examples for Server Side for MONEY

Get your bank account number:

```lua
local bank_number = exports["sfbanking"]:getNumberBankFromSource(source)
print(bank_number) -- return false if player is offline or number if player is online
```

```lua
local identifier = 'char1:4cf32ff23f23f23f32f23f32f32' -- example id
local bank_number = exports["sfbanking"]:getNumberBankFromId(identifier)
print(bank_number) -- return false if account not found or number
```

Get the amount as available in your bank account:

<pre class="language-lua"><code class="lang-lua"><strong>local bank_number = exports["sfbanking"]:getNumberBankFromSource(source)
</strong>local bank_amount = exports["sfbanking"]:getAmountBankFromNumber(bank_number)
print(bank_amount) -- return false if account not found or amount 
</code></pre>

Top up your bank account with the specified amount(type: transfer from account SYSTEM):

<pre class="language-lua"><code class="lang-lua">local bank_number = 12345 -- example
<strong>local amount = 100 -- only number > 0, must be INT! NOT FLOAT!
</strong><strong>local reason = "salary" -- can be nil
</strong>local type_log = 1 -- 1 - transfer, 2 - deposit/withdrawal, 3 - invoice payment, can be nil
local src = source -- not required, needed for logs
<strong>local result = exports["sfbanking"]:addMoneyForPlayer(bank_number, amount, reason, type_log, src)
</strong>print(result) -- return false if account not found/amount is bad or true if the transfer was successful
</code></pre>

Take cash from your bank account with the specified amount(type: transfer to account SYSTEM):

```lua
local bank_number = 12345 -- example
local amount = 100 -- only number > 0, must be INT! NOT FLOAT!
local reason = "fine" -- can be nil
local type_log = 1 -- 1 - transfer, 2 - deposit/withdrawal, 3 - invoice payment, can be nil
local src = source -- not required, needed for logs
local result = exports["sfbanking"]:removeMoneyForPlayer(bank_number, amount, reason, type_log, src)
print(result) -- return false if account not found/amount is bad or true if the transfer was successful
```

Make a transfer from bank account to account:

<pre class="language-lua"><code class="lang-lua">local from_bank_number = 12345 -- example
<strong>local to_bank_number = 12345 -- example
</strong>local amount = 100 -- only number > 0, must be INT! NOT FLOAT!
local reason = "credit" -- can be nil
local src = source -- not required, needed for logs
local result = exports["sfbanking"]:transferMoneyFromAccountToAccount(from_bank_number, to_bank_number, amount, reason, src)
print(result) -- return false if account not found/amount is bad or true if the transfer was successful
</code></pre>

Creating a bank account for a player or anything:

```lua
local src = source
local type_data = "player" -- options: "player" - for creating a player account , "SomeString" - for creating accounts for jobs or organizations, whatever you come up with. This is a prefix. 
local data = 1 -- example: id job or id organization :) cannot be nil when typedata is different than "player"
local result = exports["sfbanking"]:registerAccount(src, type_data, data)
print(result) -- return false if account not created or true if the account was created
```

Bank logs:

```lua
local bank_number = 23241 -- example
local result = exports["sfbanking"]:getBankLogs(bank_number)
print(result) -- return table with data
```

## Lua code examples for Server Side for CRYPTO

Get your crypto account number:

```lua
local crypto_number = exports["sfbanking"]:getNumberCryptoFromSource(source)
print(crypto_number) -- return false if player is offline or number if player is online
```

```lua
local identifier = 'char1:4cf32ff23f23f23f32f23f32f32' -- example id
local crypto_number = exports["sfbanking"]:getNumberCryptoFromId(identifier)
print(crypto_number) -- return false if account not found or number
```

Get the amount as available in your crypto account:

<pre class="language-lua"><code class="lang-lua"><strong>local crypto_number = exports["sfbanking"]:getNumberCryptoFromSource(source)
</strong>local currency = "OCASH" -- can be nil(return table with all currency) 
local currency_amount = exports["sfbanking"]:getAmountCryptoFromNumber(crypto_number, currency)
print(currency_amount) -- return false if account not found or amount/table
</code></pre>

Top up your crypto account with the specified amount and currency(type: transfer from account SYSTEM):

<pre class="language-lua"><code class="lang-lua">local crypto_number = 12345 -- example
local currency = "OCASH" -- example
<strong>local amount = 5.5 -- only number > 0, must be INT or FLOAT
</strong>local src = source -- not required, needed for logs
<strong>local result = exports["sfbanking"]:addCryptoForPlayer(crypto_number, currency, amount, src)
</strong>print(result) -- return false if account not found/amount is bad or true if the transfer was successful
</code></pre>

Take crypto from your crypto account with the specified amount and currency(type: transfer to account SYSTEM):

```lua
local crypto_number = 12345 -- example
local currency = "OCASH" -- example
local amount = 5.5 -- only number > 0, must be INT or FLOAT
local src = source -- not required, needed for logs
local result = exports["sfbanking"]:removeCryptoForPlayer(crypto_number, currency, amount, src)
print(result) -- return false if account not found/amount is bad/lack of account funds or true if the transfer was successful
```

Make a transfer from crypto account to account:

<pre class="language-lua"><code class="lang-lua">local from_crypto_number = 12345 -- example
<strong>local to_crypto_number = 23456 -- example
</strong>local currency = "OCASH" -- example
local amount = 100 -- only number > 0, must be INT or FLOAT
local src = source -- not required, needed for logs
local result = exports["sfbanking"]:transferCryptoFromAccountToAccount(from_crypto_number, to_crypto_number, currency, amount, src)
print(result) -- return false if account not found/amount is bad or true if the transfer was successful
</code></pre>

Crypto logs:

<pre class="language-lua"><code class="lang-lua"><strong>local crypto_number = 23241 -- example
</strong>local result = exports["sfbanking"]:getCryptoLogs(crypto_number)
print(result) -- return table with data
</code></pre>

## Lua code examples for Server Side - PERMISSIONS

Granting permissions to use other bank accounts/crypto wallet:

```lua
local bank_number = 12345 -- Bank account number, just enter your account number or crypto wallet number
local crypto_number = 0 -- wallet number, just enter crypto wallet number or your account number
local playerId = "char1:3213213" -- player id
local permission_bank = 1 -- if 1 will receive permission, if 0 then he will not have it
local permission_crypto = 0 -- if 1 will receive permission, if 0 then he will not have it
local result = exports["sfbanking"]:addPermission(bank_number, crypto_number, playerId, permission_bank, permission_crypto)
print(result) -- return true or false
```

Removing privileges to use other bank accounts/crypto wallet:

```lua
local bank_number = 12345 -- Bank account number
local crypto_number = 0 -- wallet number
local playerId = "char1:3213213" -- player id
local result = exports["sfbanking"]:removePermission(bank_number, crypto_number, playerId)
print(result) -- return true or false
```

Downloading a table with data about which accounts the player has access to:

```lua
local playerId = "char1:3213213" -- player id
local type = "bank" -- "bank" or "crypto"
local result = exports["sfbanking"]:getPermissionData(playerId, type)
print(result) -- return table
```


---

# 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://docs.scriptsfivem.com/resources/sfbanking/exports.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.
