Paycheck transactions
ESX
Go to es_extended/server/paycheck.lua and replace:
if salary > 0 then
if job == 'unemployed' then -- unemployed
xPlayer.addAccountMoney('bank', salary)
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_help', salary), 'CHAR_BANK_MAZE', 9)
elseif Config.EnableSocietyPayouts then -- possibly a society
TriggerEvent('esx_society:getSociety', xPlayer.job.name, function (society)
if society ~= nil then -- verified society
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function (account)
if account.money >= salary then -- does the society money to pay its employees?
xPlayer.addAccountMoney('bank', salary)
account.removeMoney(salary)
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
else
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), '', _U('company_nomoney'), 'CHAR_BANK_MAZE', 1)
end
end)
else -- not a society
xPlayer.addAccountMoney('bank', salary)
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
end
end)
else -- generic job
xPlayer.addAccountMoney('bank', salary)
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
end
end
With the following code:
if salary > 0 then
if job == 'unemployed' then -- unemployed
xPlayer.addAccountMoney('bank', salary)
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', salary, "salary", "Salary", xPlayer.identifier, xPlayer.getName())
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_help', salary), 'CHAR_BANK_MAZE', 9)
elseif Config.EnableSocietyPayouts then -- possibly a society
TriggerEvent('esx_society:getSociety', xPlayer.job.name, function (society)
if society ~= nil then -- verified society
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function (account)
if account.money >= salary then -- does the society money to pay its employees?
xPlayer.addAccountMoney('bank', salary)
account.removeMoney(salary)
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', salary, "salary", "Salary", xPlayer.identifier, xPlayer.getName())
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
else
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), '', _U('company_nomoney'), 'CHAR_BANK_MAZE', 1)
end
end)
else -- not a society
xPlayer.addAccountMoney('bank', salary)
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', salary, "salary", "Salary", xPlayer.identifier, xPlayer.getName())
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
end
end)
else -- generic job
xPlayer.addAccountMoney('bank', salary)
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', salary, "salary", "Salary", xPlayer.identifier, xPlayer.getName())
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
end
end
QBCore
Go to qb-core/server/functions.lua and replace the whole following function:
function PaycheckInterval()
if next(QBCore.Players) then
for _, Player in pairs(QBCore.Players) do
if Player then
local payment = Player.PlayerData.job.payment
if Player.PlayerData.job and payment > 0 and (QBShared.Jobs[Player.PlayerData.job.name].offDutyPay or Player.PlayerData.job.onduty) then
if QBCore.Config.Money.PayCheckSociety then
local account = exports['qb-management']:GetAccount(Player.PlayerData.job.name)
if account ~= 0 then -- Checks if player is employed by a society
if account < payment then -- Checks if company has enough money to pay society
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
else
Player.Functions.AddMoney('bank', payment)
exports['qb-management']:RemoveMoney(Player.PlayerData.job.name, payment)
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', payment, "salary", "Salary", Player.PlayerData.citizenid, Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname)
end
else
Player.Functions.AddMoney('bank', payment)
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', payment, "salary", "Salary", Player.PlayerData.citizenid, Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname)
end
else
Player.Functions.AddMoney('bank', payment)
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', payment, "salary", "Salary", Player.PlayerData.citizenid, Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname)
end
end
end
end
end
SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
end
function PaycheckLoop()
local Players = QBCore.Functions.GetQBPlayers()
for _, Player in pairs(Players) do
local payment = Player.PlayerData.job.payment
if Player.PlayerData.job and payment > 0 and (QBShared.Jobs[Player.PlayerData.job.name].offDutyPay or Player.PlayerData.job.onduty) then
if QBCore.Config.Money.PayCheckSociety then
local account = exports['qb-bossmenu']:GetAccount(Player.PlayerData.job.name)
if account ~= 0 then -- Checks if player is employed by a society
if account < payment then -- Checks if company has enough money to pay society
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
else
Player.Functions.AddMoney('bank', payment)
TriggerEvent('qb-bossmenu:server:removeAccountMoney', Player.PlayerData.job.name, payment)
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', payment, "salary", "Salary", Player.PlayerData.citizenid, Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname)
end
else
Player.Functions.AddMoney('bank', payment)
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', payment, "salary", "Salary", Player.PlayerData.citizenid, Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname)
end
else
Player.Functions.AddMoney('bank', payment)
TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
TriggerEvent('okokBanking:AddTransferTransactionFromSocietyToP', payment, "salary", "Salary", Player.PlayerData.citizenid, Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname)
end
end
end
SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckLoop)
end
Last updated