diff --git a/config/server.lua b/config/server.lua index 5376d29ae..be806c748 100644 --- a/config/server.lua +++ b/config/server.lua @@ -8,7 +8,7 @@ return { moneyTypes = { cash = 500, bank = 5000, crypto = 0 }, -- type = startamount - Add or remove money types for your server (for ex. blackmoney = 0), remember once added it will not be removed from the database! dontAllowMinus = { 'cash', 'crypto' }, -- Money that is not allowed going in minus paycheckTimeout = 10, -- The time in minutes that it will give the paycheck - paycheckSociety = false -- If true paycheck will come from the society account that the player is employed at, requires qb-management + paycheckSociety = false -- If true paycheck will come from the society account that the player is employed at }, player = { @@ -124,4 +124,12 @@ return { removeSocietyMoney = function(accountName, payment) return exports['Renewed-Banking']:removeAccountMoney(accountName, payment) end, + + ---Paycheck function + ---@param player Player Player object + ---@param payment number Payment amount + sendPaycheck = function (player, payment) + player.Functions.AddMoney('bank', payment) + Notify(player.PlayerData.source, locale('info.received_paycheck', payment)) + end, } diff --git a/server/loops.lua b/server/loops.lua index f1e978a9f..32aad9733 100644 --- a/server/loops.lua +++ b/server/loops.lua @@ -22,23 +22,18 @@ CreateThread(function() end end) -local function sendPaycheck(player, payment) - player.Functions.AddMoney('bank', payment) - Notify(player.PlayerData.source, locale('info.received_paycheck', payment)) -end - local function pay(player) local job = player.PlayerData.job local payment = GetJob(job.name).grades[job.grade.level].payment or job.payment if payment <= 0 then return end if not GetJob(job.name).offDutyPay and not job.onduty then return end if not config.money.paycheckSociety then - sendPaycheck(player, payment) + config.sendPaycheck(player, payment) return end local account = config.getSocietyAccount(job.name) if not account or account == 0 then -- Checks if player is employed by a society - sendPaycheck(player, payment) + config.sendPaycheck(player, payment) return end if account < payment then -- Checks if company has enough money to pay society @@ -46,7 +41,7 @@ local function pay(player) return end config.removeSocietyMoney(job.name, payment) - sendPaycheck(player, payment) + config.sendPaycheck(player, payment) end CreateThread(function()