# QBOX

```
CreateThread(function()
    if Config.framework ~= 'QBOX' then return end

    function GetPlayer()
        local players = exports.qbx_core:GetQBPlayers() -- Récupère tous les joueurs via QBOX
        local sources = {}

        if type(players) == "table" then
            for _, player in pairs(players) do
                if player and player.PlayerData and player.PlayerData.source then
                    table.insert(sources, player.PlayerData.source)
                end
            end
        else
            print("Error: GetQBPlayers did not return a valid table.")
        end

        return sources
    end

    function GetPlayerData(source)
        local player = exports.qbx_core:GetPlayer(source)
        return player
    end

    function IsPlayerOnDuty(player)
        local playerData = GetPlayerData(player)
        return playerData and playerData.PlayerData and playerData.PlayerData.job and playerData.PlayerData.job.onduty or false
    end

    function GetPlayerJob(player)
        local playerData = GetPlayerData(player)
        return playerData and playerData.PlayerData and playerData.PlayerData.job or nil
    end

    function GetPlayerJobName(player)
        local playerData = GetPlayerData(player)
        return playerData and playerData.PlayerData and playerData.PlayerData.job and playerData.PlayerData.job.name or nil
    end

    function GetPlayerId(player)
        local playerData = GetPlayerData(player)
        return playerData and playerData.PlayerData and playerData.PlayerData.source or nil
    end

    function ProcessFinalBillingPriceValue(finalBillingPrice, group)
        local playerData = GetPlayerData(source)
        if playerData then
            playerData.Functions.RemoveMoney('bank', finalBillingPrice)
            local agentJob = group
            local addMoneyTo = Config.FinesTransf[agentJob]
            if addMoneyTo then
                exports.qbx_core:AddMoney(addMoneyTo, finalBillingPrice)
            else
                print("No money mapping is defined for agent job: " .. agentJob)
            end
        else
            print("Error: Player not found.")
        end
    end
end)

```
