Exports

Lua code Trigger for Client Side

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

Lua code examples for Server Side for MONEY

Get your bank account number:

local bank_number = exports["sfbanking"]:getNumberBankFromSource(source)
print(bank_number) -- return false if player is offline or number if player is online
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:

local bank_number = exports["sfbanking"]:getNumberBankFromSource(source)
local bank_amount = exports["sfbanking"]:getAmountBankFromNumber(bank_number)
print(bank_amount) -- return false if account not found or amount 

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

local bank_number = 12345 -- example
local amount = 100 -- only number > 0, must be INT! NOT FLOAT!
local reason = "salary" -- 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"]:addMoneyForPlayer(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

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

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:

local from_bank_number = 12345 -- example
local to_bank_number = 12345 -- example
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

Creating a bank account for a player or anything:

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:

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:

local crypto_number = exports["sfbanking"]:getNumberCryptoFromSource(source)
print(crypto_number) -- return false if player is offline or number if player is online
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:

local crypto_number = exports["sfbanking"]:getNumberCryptoFromSource(source)
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

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

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"]:addCryptoForPlayer(crypto_number, currency, amount, src)
print(result) -- return false if account not found/amount is bad or true if the transfer was successful

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

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:

local from_crypto_number = 12345 -- example
local to_crypto_number = 23456 -- example
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

Crypto logs:

local crypto_number = 23241 -- example
local result = exports["sfbanking"]:getCryptoLogs(crypto_number)
print(result) -- return table with data

Lua code examples for Server Side - PERMISSIONS

Granting permissions to use other bank accounts/crypto wallet:

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:

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:

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

Last updated