Setup
Instructions on how to setup your job/society integrations with your framework to create shared accounts for jobs in runtime!
ESX
Download and ensure the latest esx_addonaccount
from here: https://github.com/esx-framework/esx_addonaccount.
QBCore
Instructions on how to setup job/society accounts with QBCore framework compatibility.
qb-banking
qb-banking
If you are using qb-banking
, all you need to do is download and ensure the latest version of qb-banking
from here: https://github.com/qbcore-framework/qb-banking.
qb-management
qb-management
If you are using qb-management (old method), then follow these instructions.
Latest qb-management
does not manage job/society accounts. This is now handled by qb-banking
. If you are using old qb-management, it's highly recommended to update to latest and utilize qb-banking
instead.
Check for functions
Do Ctrl + F
(search) for GetAccount
or AddMoney
or RemoveMoney
. If they do not exist, then do not proceed further! Instead, ensure that you have latest qb-banking
installed, as this resource now handles job/society accounts.
Insert new function
Scroll down all the way to the bottom and insert the following code:
--- Creates a management account for a job in qb-management.
---@param job_name string The name of the job to create the management account for.
---@param amount number|nil The initial balance of the account (defaults to 0 if not provided).
---@return boolean success Returns `true` if the account was created successfully, `false` otherwise.
function CreateManagementAccount(job_name, amount)
-- Ensure a valid job name is provided
if type(job_name) ~= "string" or job_name == "" then
error("Invalid job_name provided")
end
amount = amount or 0 -- Default to 0 if no amount is provided
-- Check if account already exists in cache
if Accounts[job_name] then
return Accounts[job_name] -- Account already exists, no need to create it again
end
-- Insert the new account into the database
local insertSuccess = MySQL.insert.await('INSERT INTO management_funds (job_name, amount, type) VALUES (@job_name, @amount, @type)', {
['@job_name'] = job_name,
['@amount'] = amount,
['@type'] = 'boss'
})
if not insertSuccess then
error("Database error: Failed to insert management account")
end
-- Store in local cache
Accounts[job_name] = amount
return Accounts[job_name]
end
exports("CreateManagementAccount", CreateManagementAccount)
Qbox
Download and ensure the latest version of Renewed-Banking
from here: https://github.com/Renewed-Scripts/Renewed-Banking/releases.
If you are using another banking/management for job/shared accounts, then refer to API for custom integrations on your own.
If using qb-management
(old version) with backwards compatibility, then see qb-management.
Last updated