Setup

This gives you a step-by-step guide on how to install the resource.

In-depth Guied

You just downloaded the script and wonder how to set it up so it works on your server? Well, you're in the right place to do so.

1

Dependencies

Make sure you have all the right dependencies to run the script, you can find theese here.

2

Setup framework compability

Change this in your framework for the script to work with your paycheck system.

server/functions.lua
local OffDutyInfo = nil
if (GetResourceState("yecoyz_duty") == "started") then
    OffDutyInfo = exports["yecoyz_duty"]:GetOffDutyPayInfo()
end

function PaycheckInterval()
    if not next(QBCore.Players) then 
        SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
        return 
    end
    for _, Player in pairs(QBCore.Players) do
        if not Player then return end
        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

        local onDuty = Player.PlayerData.job.onduty
        if (GetResourceState("yecoyz_duty") == "started") then
            onDuty = exports["yecoyz_duty"]:GetDutyState(Player.PlayerData.source)
            local multiplier = exports["yecoyz_duty"]:GetSalaryMultiplier(Player.PlayerData.source)
            payment = math.floor(payment*multiplier)
        end

        local offDutyPay = true
        if (not onDuty) then
            if (OffDutyInfo) and (OffDutyInfo.offDutyPay) then
                payment = math.floor(payment*OffDutyInfo.multiplier)
            else
                offDutyPay = false
            end
        end
        if Player.PlayerData.job and payment > 0 and (offDutyPay or onDuty) then
            if QBCore.Config.Money.PayCheckSociety then
                local account = exports['qb-banking']:GetAccountBalance(Player.PlayerData.job.name)
                if account ~= 0 then
                    if account < payment then
                        TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
                    else
                        Player.Functions.AddMoney('bank', payment, 'paycheck')
                        exports['qb-banking']:RemoveMoney(Player.PlayerData.job.name, payment, 'Employee 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
            else
                Player.Functions.AddMoney('bank', payment, 'paycheck')
                TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
            end
        end
    end
    SetTimeout(QBCore.Config.Money.PayCheckTimeOut * (60 * 1000), PaycheckInterval)
end

Support

If you have any problems with the setup, we're happy to help in our discord witch you can find here.

Last updated