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. Client

QBOX

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

-- ReUpdatePlayerData
    function UpdatePlayerData()
        PlayerData = QBX.PlayerData
    end
	
-- GetPlayerJobName
    function GetPlayerJobName()
        UpdatePlayerData()
        if PlayerData and PlayerData.job and PlayerData.job.name then
            return PlayerData.job.name
        end
        return nil
    end

-- GetPlayerJobGrade
    function GetPlayerJobGrade()
        UpdatePlayerData()
        if PlayerData and PlayerData.job and PlayerData.job.grade.level then
            return PlayerData.job.grade.level
        end
        return nil
    end
	
-- GetPlayerData
    function GetPlayerData(callback)
	    UpdatePlayerData()
        if callback ~= nil then
            callback(PlayerData)
        end
    end

-- GetPlayer character.lastname, character.firstname
    function GetPlayerCharInfo()
        UpdatePlayerData()
        if PlayerData and PlayerData.charinfo then
            return PlayerData.charinfo
        end
        return nil
    end

-- Notification
function sendNotification(message, title, theme)
    if Config.notificationType == "bulletin" then
        exports.bulletin:SendAdvanced({
            message = message,
            title = Config.notification.title,
            theme = theme,
            subject = Config.notification.subject,
            icon = Config.notification.icon,
            timeout = Config.notification.timeout,
            position = Config.notification.Position,
            progress = Config.notification.Progress,
            queue = Config.notification.Queue,
            stacking = Config.notification.Stacking,
            showStackedCount = Config.notification.ShowStackedCount,
            animationOut = Config.notification.AnimationOut,
            animationTime = Config.notification.AnimationTime,
            flashCount = Config.notification.FlashCount,
            soundFile = Config.notification.SoundFile,
            soundVolume = Config.notification.SoundVolume,
        })
    elseif Config.notificationType == "QBCore" then
        QBCore.Functions.Notify(message, theme, 5000)
    elseif Config.notificationType == "QBOX" then
        exports.qbx_core:Notify(
            message,               -- Le message de la notification
            theme,                 -- Type de notification (success, error, info, etc.)
            5000,                  -- Durée en millisecondes
            title,                 -- Sous-titre ou titre supplémentaire
            Config.notification.Position, -- Position de la notification
            Config.notification.Style or {}, -- Style supplémentaire (table)
            Config.notification.Icon or "fa-info-circle", -- Icône de la notification
            Config.notification.IconColor or "white" -- Couleur de l'icône
        )
    elseif Config.notificationType == "BasicNotification" then
        TriggerEvent('RadarNotification', message)
    else
        print(Lang[Config.lang].NotifyNotFound)
    end
end

RegisterNetEvent('peace-speedcamera:GetSpeedCameraData')
AddEventHandler('peace-speedcamera:GetSpeedCameraData', function(SpeedKM, finalBillingPrice, cameraID, cameraName, speedlimit, group, distance, playerCoords)
    local character = GetPlayerCharInfo()
    local firstname = character.firstname
    local lastname = character.lastname
    local speedover = SpeedKM - speedlimit
    local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
    local plate = GetVehicleNumberPlateText(vehicle)
    local coords = GetEntityCoords(vehicle)
    local streetName, crossing = GetStreetNameAtCoord(coords.x, coords.y, coords.z)
    local address = GetStreetNameFromHashKey(streetName)
    local vehicleModel = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
    local vehicleType = GetVehicleClassFromName(vehicleModel)

    TriggerServerEvent('peace-speedcamera:SaveSpeedCameraData', vehicleModel, vehicleType, address, plate, firstname, lastname, SpeedKM, speedover, finalBillingPrice, cameraID, cameraName, speedlimit, group)

    -- ADD CUSTOM EVENT DISPATCH HERE 
end)

end)
PreviousESXNextCustom

Last updated 4 months ago

📸
📂
💻