Free Releases
SD-Paycheck

SD-Paycheck

Simple Resource to add Paycheck System to your Server without all the hassle.

Features

  • Use Ped Or BoxZone
  • Pay Paycheck In Cash Or Bank
  • Set Paycheck Collection to a specific day of the week

Install

To intercept the framework paycheck system we have to make the following changes:

  1. Open qb-core/server/functions.lua
  2. Search for PaycheckInterval()
  3. Replace the highlighted Player.Functions.AddMoney('bank', payment, 'paycheck')
  4. Replace with TriggerEvent('sd-paycheck:server:AddPaycheck', payment, Player.PlayerData.source)
function PaycheckInterval()
    if next(QBCore.Players) then
        for _, Player in pairs(QBCore.Players) do
            if Player then
                local payment = QBShared.Jobs[Player.PlayerData.job.name]['grades'][tostring(Player.PlayerData.job.grade.level)].payment
                if not payment then payment = Player.PlayerData.job.payment end
                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, 'paycheck')
                                exports['qb-management']:RemoveMoney(Player.PlayerData.job.name, payment)
                                TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
                            end
                        else
                            Player.Functions.AddMoney('bank', payment, 'paycheck')
                            TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
                        end
                    else
                        Player.Functions.AddMoney('bank', payment, 'paycheck')
                        TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', {value = payment}))
                    end
                end
            end
        end
    end
    SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
end

Config

Config = {}
Config.Debug = false
Config.Target = 'qb-target' -- qb-target / qtarget
 
-- Pay Paycheck in Cash other wise deposited to bank
Config.CashOut = false
 
-- Collect Paycheck on a specific Day
-- -1 = Disabled
--  0 = Sunday  
--  1 = Monday  
--  2 = Tuesday  
--  3 = Wednesday  
--  4 = Thursday  
--  5 = Friday  
--  6 = Saturday
Config.PayCheckDay = -1
 
-- Using Ped
Config.UsePed = true
Config.Ped = 'ig_lifeinvad_02'
Config.PedCoords = vector4(-1078.77, -244.78, 36.76, 163.08)
 
-- Using BoxZone
Config.BoxZone = vector3(-1082.73, -246.56, 37.76)
Config.BoxZoneLength = 5
Config.BoxZoneWidth = 2
Config.BoxZoneHeading = 300
Config.BoxZoneMaxZ = 36.76
Config.BoxZoneMinZ = 38.76