T1GER Resources supports compatibility with society accounts handled by esx_addonaccount, qb-banking or qb-management.
You can also use a custom society-/shared account resource, however you need to implement the functionality yourself.
Config.SocietyAccount
Config.SocietyAccount = 'esx_addonaccount' -- Set the society account system
Specifies the society account system in use. Update this based on your selected society system.
Type: string
Options:
'esx_addonaccount' -
'qb-banking' -
'qb-management' -
'renewed-banking' -
'custom' - You need to make your own integrations!
Setup
This guide will help you setup society account functionality with T1GER Resources.
ESX
esx_addonaccount
Only do the following if you CANNOT download and install latest version and you are required/force to do the changes manually!!
If you prefer to keep your current esx_addonaccount resource for some weird reason, you can also manually implement the functionality.
Navigate to esx_addonaccount/server/main.lua
Find this function:
function GetSharedAccount(name)
Add this export code below the function
exports("GetSharedAccount", GetSharedAccount)
Now in the same file, find this function:
function AddSharedAccount(society, amount)
If the function exists, replace the whole function, if it doesn't exist, the insert - in both cases it's the same code:
function AddSharedAccount(society, amount)
-- society.name = job_name/society_name
-- society.label = label for the job/account
-- amount = if the shared account should start with x amount
if type(society) ~= 'table' or not society?.name or not society?.label then return end
-- check if account already exist?
if SharedAccounts[society.name] ~= nil then return SharedAccounts[society.name] end
-- addon account:
local account = MySQL.insert.await('INSERT INTO `addon_account` (name, label, shared) VALUES (?, ?, ?)', {
society.name, society.label, 1
})
if not account then return end
-- if addon account inserted, insert addon account data:
local account_data = MySQL.insert.await('INSERT INTO `addon_account_data` (account_name, money) VALUES (?, ?)', {
society.name, (amount or 0)
})
if not account_data then return end
-- if all data inserted successfully to sql:
SharedAccounts[society.name] = CreateAddonAccount(society.name, nil, (amount or 0))
return SharedAccounts[society.name]
end
exports("AddSharedAccount", AddSharedAccount)
You have succesfully set up esx_addonaccount to allow for automatic society account creation in runtime. All you need to do is restart the server!
QB Core
qb-banking
qb-management
Only do the following if you are using qb-management:
Navigate to qb-management/server/sv_boss.lua
Scroll down all the way to the bottom and insert the following code:
-- ## T1GER Integrations:
function CreateManagementAccount(job_name, amount)
local findRow = MySQL.query.await('SELECT * FROM management_funds WHERE type = @type AND job_name = @job_name', {
['@job_name'] = job_name,
['@type'] = 'boss'
})
if not findRow[1] then
MySQL.insert('INSERT INTO management_funds (job_name, amount, type) VALUES (@job_name, @amount, @type)', {
['@job_name'] = job_name,
['@amount'] = amount or 0,
['@type'] = 'boss'
})
Accounts[job_name] = amount or 0
end
end
exports("CreateManagementAccount", CreateManagementAccount)
Restart your server and you will now be able to create society accounts in runtime!
Qbox
Renewed Banking
Navigate to Renewed-Banking/server/main.lua
Go all the way to bottom of the file.
Paste the follow coding there:
local function CreateJobAccount(job, initialBalance)
-- job(table): name(string), label(string) - job name and job label
-- initialBalance(int): (optional) amount for account to start with
if not job.name or not job.label then return end
-- check if account already exist?
if cachedAccounts[job.name] then return cachedAccounts[job.name] end
cachedAccounts[job.name] = {
id = job.name,
type = locale('org'),
name = job.label,
frozen = 0,
amount = initialBalance or 0,
transactions = {},
auth = {},
creator = nil
}
MySQL.insert("INSERT INTO bank_accounts_new (id, amount, transactions, auth, isFrozen, creator) VALUES (?, ?, ?, ?, ?, NULL) ",{
job.name, cachedAccounts[job.name].amount, json.encode(cachedAccounts[job.name].transactions), json.encode({}), cachedAccounts[job.name].frozen
})
return cachedAccounts[job.name]
end
exports('CreateJobAccount', CreateJobAccount)
You have succesfully set up qbox default banking resource to allow for automatic society account creation in runtime. All you need to do is restart the server!
Functions
These are the functions used in our T1GER resources.
These are also the functions you want to modify in case you want to integrate your custom society/shared account resource. Simply use 'custom' in Config.SocietyAccount and integrate your export/functions in the if/else statements for 'custom'.
GetSharedAccount
GetSharedAccount(society)
-- parameters: society(string)
-- returns account(table or integer (based on resource return value))
AddSharedAccountMoney(society, m)
-- parameters: society(string), m(integer)
-- void: adds m amount to shared account with society/job name
RemoveSharedAccountMoney
RemoveSharedAccountMoney(society, m)
-- parameters: society(string), m(integer)
-- void: removes m amount from shared account with society/job name
SetSharedAccountMoney
SetSharedAccountMoney(society, m)
-- parameters: society(string), m(integer)
-- void: sets m amount to shared account with society/job name
Setting up functionality to create shared account in runtime is very simple; all you need to is download and install latest esx_addonaccount from here: .
If done correct, it will look like this:
Setting up functionality to create shared account in runtime is very simple; all you need to is download and install latest qb-banking from here: .
Setting up functionality to create shared account in runtime is very simple; all you need to is download and install latest Renwed-Banking from here: .