PEACESCRIPT Documentation
StoreDiscord
  • πŸ‘‹Introduction
  • πŸ“ΈPEACE-Speedcamera
    • πŸ“œConfig File
    • πŸ“‚Unlocked File
      • πŸ–₯️Server
        • QBCore
        • ESX
        • QBOX
        • Custom
      • πŸ’»Client
        • QBCore
        • ESX
        • QBOX
        • Custom
  • πŸ“„PEACE-JobMenu
    • πŸ“œConfig File
    • πŸ“‚Unlocked File
      • πŸ’»Client
        • QBCore
        • ESX
        • Custom
  • πŸ“ŠPEACE-DutyLog
    • πŸ“œConfig File
    • πŸ“‚Unlocked File
      • πŸ’»Client
        • QBCore
        • ESX
        • QBOX
        • Custom
        • Target
      • πŸ–₯️Server
        • QBCore
        • ESX
        • QBOX
        • Custom
  • πŸ–‹οΈPEACE-PropsManager
    • ⬇️Installation
    • πŸ“œConfiguration
    • ❓FAQ
    • πŸ“‚Unlocked File
      • πŸ–₯️Server
        • QBCore
        • ESX
        • Custom
      • πŸ’»Client
        • QBCore
        • ESX
        • Custom
Powered by GitBook
On this page
  1. PEACE-Speedcamera
  2. Unlocked File
  3. Server

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)
PreviousESXNextCustom

Last updated 4 months ago

πŸ“Έ
πŸ“‚
πŸ–₯️