Config
QBCore PAYCHECK
To Enable paychecks for qbcore follow this instructions
In qb-core/config.lua, keep your paycheck interval and set:
QBCore.Config.Money.PayCheckSociety = falseOpen qb-core/server/functions.lua. Find the entire function:
function PaycheckInterval()
-- existing payroll code
endReplace only that function with the complete contents of this code block
-- Replace only PaycheckInterval in qb-core/server/functions.lua with this block.
-- Do not replace the entire server/functions.lua file or add another payroll thread.
local function queueStormixPaycheck(player, payment)
local data = player.PlayerData
if GetResourceState('stormix-banking') ~= 'started' then
print(('[stormix-paychecks] Banking unavailable; unpaid salary for %s: %s'):format(
data.citizenid, payment
))
return false
end
local key
local ok, result = pcall(function()
key = MySQL.scalar.await('SELECT UUID()')
if QBCore.Players[data.source] ~= player then
return { ok = false, error = { code = 'PLAYER_UNAVAILABLE' } }
end
local job = data.job
return exports['stormix-banking']:queuePaycheck(
data.citizenid,
payment,
(job.label or job.name):sub(1, 80),
key
)
end)
if not ok or type(result) ~= 'table' or not result.ok then
local code = type(result) == 'table' and result.error and result.error.code or tostring(result)
print(('[stormix-paychecks] Queue failed citizenid=%s payment=%s key=%s result=%s'):format(
data.citizenid, payment, tostring(key), code
))
return false
end
if QBCore.Players[data.source] == player then
TriggerClientEvent('QBCore:Notify', data.source, 'Your paycheck is ready to claim at the bank', 'success')
end
return true
end
function PaycheckInterval()
SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
if QBCore.Config.Money.PayCheckSociety then
print('[stormix-paychecks] Claimable payroll requires PayCheckSociety = false; no salaries were queued')
return
end
if not next(QBCore.Players) then return end
CreateThread(function()
for _, player in pairs(QBCore.Players) do
local data = player.PlayerData
local job = data.job
local definition = job and QBCore.Shared.Jobs[job.name]
if definition then
local grade = type(job.grade) == 'table' and job.grade.level or job.grade
local grades = definition.grades
local gradeData = grades and (grades[tostring(grade)] or grades[grade])
local payment = gradeData and gradeData.payment or job.payment
if type(payment) == 'number' and payment > 0 then
if definition.offDutyPay or job.onduty then
queueStormixPaycheck(player, payment)
end
end
end
Wait(50)
end
end)
endPaycheck payment is managed by the core in shared/jobs.lua