Framework Integration
Here you can copy and paste the integration for the framework to send all the paychecks to the NPC instead of the bank.
Snippet
Redirect to es_extended/server/paycheck.lua and replace the whole function with the following:
In case your framework function its different, the trigger you have to replace instead of the addMoney function its:
TriggerEvent("dsPaycheckSystem:AddMoneyFramework", xPlayer, salary)
ESX.StartPayCheck = function()
function payCheck()
local xPlayers = ESX.GetPlayers()
for i=1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
local job = xPlayer.job.grade_name
local salary = xPlayer.job.grade_salary
if salary > 0 then
if job == 'unemployed' then -- unemployed
TriggerEvent("dsPaycheckSystem:AddMoneyFramework", xPlayer, payment)
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?
TriggerEvent("dsPaycheckSystem:AddMoneyFramework", xPlayer, payment)
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
TriggerEvent("dsPaycheckSystem:AddMoneyFramework", xPlayer, payment)
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
end
end)
else -- generic job
TriggerEvent("dsPaycheckSystem:AddMoneyFramework", xPlayer, payment)
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
end
end
end
SetTimeout(Config.PaycheckInterval, payCheck)
end
SetTimeout(Config.PaycheckInterval, payCheck)
end
end
StartPayCheck = function()
Citizen.CreateThread(function()
while true do
Citizen.Wait(Config.PaycheckInterval)
local xPlayers = ESX.GetExtendedPlayers()
for _, xPlayer in pairs(xPlayers) do
local job = xPlayer.job.grade_name
local salary = xPlayer.job.grade_salary
if salary > 0 then
if job == 'unemployed' then -- unemployed
TriggerEvent("dsPaycheckSystem:AddMoneyFramework",xPlayer, 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?
TriggerEvent("dsPaycheckSystem:AddMoneyFramework",xPlayer, 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
TriggerEvent("dsPaycheckSystem:AddMoneyFramework",xPlayer, salary)
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
end
end)
else -- generic job
TriggerEvent("dsPaycheckSystem:AddMoneyFramework",xPlayer, salary)
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary), 'CHAR_BANK_MAZE', 9)
end
end
end
end
end)
end
Last updated