J0-Banking Installation Guide
Database Setup
- Execute
insertme.sqlin your database to create required tables:
Inventory Setup
qb-inventory
- Add the following items to
qb-inventory/shared/items.lua:
lua
['checkbook'] = {
['name'] = 'checkbook',
['label'] = 'Bank Check Book',
['weight'] = 10,
['type'] = 'item',
['image'] = 'checkbook.png',
['unique'] = true,
['useable'] = true,
['shouldClose'] = true,
['combinable'] = nil,
['description'] = 'Bank Check Book.'
},
['bank_check'] = {
['name'] = 'bank_check',
['label'] = 'Bank Check',
['weight'] = 10,
['type'] = 'item',
['image'] = 'bank_check.png',
['unique'] = true,
['useable'] = true,
['shouldClose'] = true,
['combinable'] = nil,
['description'] = 'Torn Bank Check.'
},
['flecca_card'] = {
['name'] = 'flecca_card',
['label'] = 'Fleeca Bank Card',
['weight'] = 10,
['type'] = 'item',
['image'] = 'flecca_card.png',
['unique'] = true,
['useable'] = true,
['shouldClose'] = true,
['combinable'] = nil,
['description'] = 'Fleeca Bank Card.'
},
- Copy all images from
install/images/toqb-inventory/html/images/:checkbook.pngbank_check.pngflecca_card.png
ox_inventory
- Add the following items to
ox_inventory/data/items.lua:
lua
['checkbook'] = {
label = 'Bank Check Book',
weight = 10,
stack = false,
close = true,
description = 'Bank Check Book.',
},
['bank_check'] = {
label = 'Bank Check',
weight = 10,
stack = false,
close = true,
description = 'Torn Bank Check.',
},
['flecca_card'] = {
label = 'Fleeca Bank Card',
weight = 10,
stack = false,
close = true,
description = 'Fleeca Bank Card.',
},
- Copy all images from
install/images/toox_inventory/web/images/:checkbook.pngbank_check.pngflecca_card.png
Framework Integration
ESX
Edit es_extended/server/paycheck.lua and replace the StartPayCheck function:
lua
function StartPayCheck()
CreateThread(function()
while true do
Wait(Config.PaycheckInterval)
for player, xPlayer in pairs(ESX.Players) do
if not xPlayer.paycheckEnabled then
goto continue
end
local jobData = xPlayer.job
local jobName = jobData.name
local jobLabel = jobData.label
local onDuty = jobData.onDuty
local isUnemployed = jobName == "unemployed"
local baseSalary = jobData.grade_salary
if baseSalary <= 0 then
goto continue
end
local salary = (isUnemployed or onDuty)
and baseSalary
or ESX.Math.Round(baseSalary * Config.OffDutyPaycheckMultiplier)
if salary <= 0 then
goto continue
end
if isUnemployed then
exports['J0-Banking']:GeneratePaycheck({
source = player,
amount = salary,
job = jobName,
jobLabel = jobLabel,
society = nil,
onDuty = true,
reason = "Welfare Check"
})
goto continue
end
if Config.EnableSocietyPayouts then
TriggerEvent("esx_society:getSociety", jobName, function(society)
if society then
TriggerEvent("esx_addonaccount:getSharedAccount", society.account, function(account)
if account.money >= salary then
account.removeMoney(salary)
exports['J0-Banking']:GeneratePaycheck({
source = player,
amount = salary,
job = jobName,
jobLabel = jobLabel,
society = society.name,
onDuty = onDuty,
reason = "Salary Payment"
})
else
TriggerClientEvent(
"esx:showAdvancedNotification",
player,
TranslateCap("bank"),
"",
TranslateCap("company_nomoney"),
"CHAR_BANK_MAZE",
1
)
end
end)
else
exports['J0-Banking']:GeneratePaycheck({
source = player,
amount = salary,
job = jobName,
jobLabel = jobLabel,
society = nil,
onDuty = onDuty,
reason = "Salary Payment"
})
end
end)
else
exports['J0-Banking']:GeneratePaycheck({
source = player,
amount = salary,
job = jobName,
jobLabel = jobLabel,
society = nil,
onDuty = onDuty,
reason = "Salary Payment"
})
end
::continue::
end
end
end)
end
QBCore
Edit qb-core/server/functions.lua and replace lines 403-435 with:
lua
function PaycheckInterval()
if not next(QBCore.Players) then
SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
return
end
for _, Player in pairs(QBCore.Players) do
if not Player then goto continue end
local src = Player.PlayerData.source
local jobData = Player.PlayerData.job
local jobName = jobData.name
local jobGrade = tostring(jobData.grade.level)
local jobConfig = QBShared.Jobs[jobName]
if not jobConfig then goto continue end
local payment = jobConfig.grades[jobGrade]
and jobConfig.grades[jobGrade].payment
or jobData.payment
if not payment or payment <= 0 then goto continue end
if not jobConfig.offDutyPay and not jobData.onduty then
goto continue
end
if QBCore.Config.Money.PayCheckSociety then
local societyBalance = exports['J0-Banking']:GetAccountBalance(jobName)
if societyBalance and societyBalance > 0 then
if societyBalance < payment then
TriggerClientEvent(
'QBCore:Notify',
src,
Lang:t('error.company_too_poor'),
'error'
)
goto continue
end
exports['J0-Banking']:RemoveMoney(
jobName,
payment,
'Employee Paycheck'
)
end
end
exports['J0-Banking']:GeneratePaycheck({
source = src,
amount = payment,
job = jobName,
jobLabel = jobConfig.label or jobName,
society = QBCore.Config.Money.PayCheckSociety and jobName or nil,
onDuty = jobData.onduty,
reason = 'Salary Payment'
})
::continue::
end
SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
end
QBox
Edit qbx_core/server/loops.lua and replace lines 25-55 with:
lua
local function pay(player)
local job = player.PlayerData.job
if not job then return end
local jobCfg = GetJob(job.name)
if not jobCfg then return end
local payment = jobCfg.grades[job.grade.level]
and jobCfg.grades[job.grade.level].payment
or job.payment
if not payment or payment <= 0 then return end
if not jobCfg.offDutyPay and not job.onduty then
return
end
if not config.money.paycheckSociety then
exports['J0-Banking']:GeneratePaycheck({
source = player.PlayerData.source,
amount = payment,
job = job.name,
jobLabel = jobCfg.label or job.name,
society = nil,
onDuty = job.onduty,
reason = 'Salary Payment'
})
return
end
local accountBalance = config.getSocietyAccount(job.name)
if not accountBalance then
exports['J0-Banking']:GeneratePaycheck({
source = player.PlayerData.source,
amount = payment,
job = job.name,
jobLabel = jobCfg.label or job.name,
society = nil,
onDuty = job.onduty,
reason = 'Salary Payment'
})
return
end
if accountBalance < payment then
Notify(
player.PlayerData.source,
locale('error.company_too_poor'),
'error'
)
return
end
config.removeSocietyMoney(job.name, payment)
exports['J0-Banking']:GeneratePaycheck({
source = player.PlayerData.source,
amount = payment,
job = job.name,
jobLabel = jobCfg.label or job.name,
society = job.name,
onDuty = job.onduty,
reason = 'Salary Payment'
})
end
CreateThread(function()
local interval = 60000 * config.money.paycheckTimeout
while true do
Wait(interval)
for _, player in pairs(QBX.Players) do
pay(player)
end
end
end)
Installation Steps Summary
- Run
insertme.sqlin your database - Add items to your inventory system (qb-inventory or ox_inventory)
- Copy images to the correct inventory images folder
- Restart your server