If you don't have a function like the following then please redownload esx_addonaccount from ESX Github and replace all files!!!
Jobs
If you want to use Societyaccounts, then please add all jobs to Config.Society so that the script works as expected :)
Bankcard Prop
If you want to use a Bankcard Prop, we already integrated a script for that! Just download the prop and set the following config option to true. If you don't want to use it, set it to false.
function AddSharedAccount(society, amount)
if type(society) ~= 'table' or not society?.name or not society?.label then return end
-- society.name = job_name/society_name
-- society.label = label for the job/account
-- amount = if the shared account should start with x amount
-- 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))
end