Society Accounts
Last updated
Last updated
Since version 1.1, society accounts added to JustBank, to enable this feature, configure it based on your need
Config.Society = {
Enable = true,
Jobs = {"police"}, -- Jobs that have society account by default. (will create upon start if not exist)
Chiefs = {"boss", "Chief"} -- Which grades has access to society account ?
}
The jobs defined in Config.Society.Jobs will be created upon start if they don't exist already, for manual creation use .
The society payments sync automatically with qbcore, just remove your qb-banking.
For enabling automatic paychecks through bank accounts, replace the following code with es_extended/server/paycheck.lua :
function StartPayCheck()
CreateThread(function()
while true do
Wait(Config.PaycheckInterval)
for player, xPlayer in pairs(ESX.Players) do
local jobLabel = xPlayer.job.label
local job = xPlayer.job.grade_name
local salary = xPlayer.job.grade_salary
if salary > 0 then
if job == "unemployed" then -- unemployed
xPlayer.addAccountMoney("bank", salary, "Welfare Check")
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_help", salary), "CHAR_BANK_MAZE", 9)
if Config.LogPaycheck then
ESX.DiscordLogFields("Paycheck", "Paycheck - Unemployment Benefits", "green", {
{ name = "Player", value = xPlayer.name, inline = true },
{ name = "ID", value = xPlayer.source, inline = true },
{ name = "Amount", value = salary, inline = true },
})
end
elseif Config.EnableSocietyPayouts then -- possibly a society
local society = xPlayer.job.name
if exports["just-banks"]:IsSocietyExist(society) ~= nil then -- verified society
if exports["just-banks"]:GetSocietyMoney(society) >= salary then
xPlayer.addAccountMoney("bank", salary, "Paycheck")
exports["just-banks"]:RemoveSocietyMoney(society, salary)
if Config.LogPaycheck then
ESX.DiscordLogFields("Paycheck", "Paycheck - " .. jobLabel, "green", {
{ name = "Player", value = xPlayer.name, inline = true },
{ name = "ID", value = xPlayer.source, inline = true },
{ name = "Amount", value = salary, inline = true },
})
end
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
else
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), "", TranslateCap("company_nomoney"), "CHAR_BANK_MAZE", 1)
end
else
xPlayer.addAccountMoney("bank", salary, "Paycheck")
if Config.LogPaycheck then
ESX.DiscordLogFields("Paycheck", "Paycheck - " .. jobLabel, "green", {
{ name = "Player", value = xPlayer.name, inline = true },
{ name = "ID", value = xPlayer.source, inline = true },
{ name = "Amount", value = salary, inline = true },
})
end
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
end
else -- generic job
xPlayer.addAccountMoney("bank", salary, "Paycheck")
if Config.LogPaycheck then
ESX.DiscordLogFields("Paycheck", "Paycheck - Generic", "green", {
{ name = "Player", value = xPlayer.name, inline = true },
{ name = "ID", value = xPlayer.source, inline = true },
{ name = "Amount", value = salary, inline = true },
})
end
TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
end
end
end
end
end)
end