TeamBroCode / BC_Paycheck

This can be added to any job or paycheck system of QBCore or QBOX. Immerse your players in the roleplay experience by forcing them to retrieve their pay checks from the collection points.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This script, you can immerse the Roleplay Experience for your Players to Force them to collect their PayChecks from the Collection Points, this can be added to any job or Paycheck system of QBCore or QBOX. Comprehensive installation and feature instructions are provided in the README.

Features

  • Force Players to collect their Paychecks from the Collection Points.
  • Add this to any Job or Paycheck System.
  • Easy to use and simple code.
  • Easy to integrate with any job system.
  • Utilized the Character MetaData system.
  • No SQL Creation to import and Better Server Performance.
  • Utilizes ox_lib and ox_target.
  • Optimized and Clean Code.
  • Creates Logs for the Paychecks.
  • Supports BC_ProgressStage

Dependencies

Installation

  1. Download the script.
  2. Add the script to your resources folder.
  3. Open the script and configure the config.lua file.
  4. Follow the Steps provided in Integration Section.
  5. Add ensure BC_Paycheck to your server.cfg file.
  6. Restart your server.

Exports

Can be integrated with any Job or Paycheck System, just replace the Export with your Job or Paycheck System Export.

exports.BC_Paycheck:addPaycheck(source, amount, reason)

Integration

Add Metadata Storage

QBCORE

Search for PlayerData.metadata['hunger'] = PlayerData.metadata['hunger'] or 100 this line in for QBCore: qb-core/server/player.lua and just add this below it

PlayerData.metadata['paycheck'] = PlayerData.metadata['paycheck'] or 0

Search for playerData.metadata.hunger = playerData.metadata.hunger or 100 this line in for QBOX: qbx_core/server/player.lua and just add this below it

QBOX

playerData.metadata.paycheck = playerData.metadata.paycheck or 0

QBCore

Find the PaycheckInterval() function in qb-core/server/functions.lua and replace it with the following code:

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-banking']:GetAccountBalance(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
                                exports.BC_Paycheck:addPaycheck(Player.PlayerData.source, payment, Player.PlayerData.job.name..' Paycheck')     -- BC_Paycheck Replace Export
                                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
                            exports.BC_Paycheck:addPaycheck(Player.PlayerData.source, payment, Player.PlayerData.job.name .. ' Paycheck')       -- BC_Paycheck Replace Export
                            TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
                        end
                    else
                        exports.BC_Paycheck:addPaycheck(Player.PlayerData.source, payment, Player.PlayerData.job.name .. ' Paycheck')           -- BC_Paycheck Replace Export
                        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

QBCore Logs

Add it in your qb-smallresources/server/logs.lua file.

    ['paycheck'] = '',

Support

If you need any help, feel free to join my Discord Server and write your issues in the support channel.

License

This project is licensed under the GPL-3.0 License.

About

This can be added to any job or paycheck system of QBCore or QBOX. Immerse your players in the roleplay experience by forcing them to retrieve their pay checks from the collection points.

License:GNU General Public License v3.0


Languages

Language:Lua 100.0%