# Paychecks Integration

In order for the player to receive minute paychecks from the company account vms\_bossmenu, you need to make modifications to your framework

***

## es\_extended

{% embed url="<https://github.com/vames-dev/es_extended/blob/main/es_extended/server/modules/paycheck.lua>" %}
ESX 1.11.4
{% endembed %}

***

## qb-core

<details>

<summary>Paychecks</summary>

1. Navigate to qb-core/server/functions.lua file
2. Find function `PaycheckInterval`
3. Replace the function with the following

```lua
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 = 0

                        if GetResourceState('vms_bossmenu') == 'started' then
                            account = exports['vms_bossmenu']:getMoney(Player.PlayerData.job.name)
                        else
                            account = exports['qb-banking']:GetAccountBalance(Player.PlayerData.job.name)
                        end
                        
                        if account ~= 0 then
                            if account < payment then
                                TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('error.company_too_poor'), 'error')
                            else
                                if GetResourceState('vms_cityhall') == "started" then
                                    exports['vms_cityhall']:updatePaychecks(Player.PlayerData.source, payment)
                                else
                                    Player.Functions.AddMoney('bank', payment, 'paycheck')
                                end

                                if GetResourceState('vms_bossmenu') == 'started' then
                                    exports['vms_bossmenu']:removeMoney(Player.PlayerData.job.name, payment)
                                else
                                    exports['qb-banking']:RemoveMoney(Player.PlayerData.job.name, payment, 'Employee Paycheck')
                                end
        
                                TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
                            end
                        else
                            if GetResourceState('vms_cityhall') == "started" then
                                exports['vms_cityhall']:updatePaychecks(Player.PlayerData.source, payment)
                            else
                                Player.Functions.AddMoney('bank', payment, 'paycheck')
                            end
                            TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.received_paycheck', { value = payment }))
                        end
                    else
                        if GetResourceState('vms_cityhall') == "started" then
                            exports['vms_cityhall']:updatePaychecks(Player.PlayerData.source, payment)
                        else
                            Player.Functions.AddMoney('bank', payment, 'paycheck')
                        end
                        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
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vames-store.com/assets/vms_bossmenu/guides/paychecks-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
