Config Client

ESX, QBCore, JobInfo = nil, nil, {}

Citizen.CreateThread(function()
    if Config.Framework == 'ESX' then
        while ESX == nil do
            TriggerEvent(Config.GetSharedObjects, function(obj) ESX = obj end)
            Citizen.Wait(100)
        end
        
        JobInfo = ESX.PlayerData.job or {}
    
        RegisterNetEvent(Config.SetJob)
        AddEventHandler(Config.SetJob, function(job)
            JobInfo = job or {}
        end)

    elseif Config.Framework == 'QBCORE' then
        while QBCore == nil do
            TriggerEvent(Config.GetSharedObjects, function(obj) QBCore = obj end)
            if QBCore == nil then
                QBCore = exports[Config.ResourceName]:GetCoreObject()
            end
            Citizen.Wait(100)
        end
        
        JobInfo = QBCore.Functions.GetPlayerData().job or {}

        RegisterNetEvent(Config.SetJob)
        AddEventHandler(Config.SetJob, function(job)
            JobInfo = job or {}
        end)
    
    elseif Config.Framework == 'OTHER' then
        -- // if you want to use other framework, place here the code! 
    end
end)

function CLNotify(type, text)
    if Config.Notify == "rvl_notify" then
        exports["rvl_notify"]:DoNotify(type, text)
    elseif Config.Notify == "other" then
        -- // If you want to use your own notification, post it here!
    end
end

function GetJob()
    if Config.Framework == 'ESX' then
        while JobInfo.name == nil do Citizen.Wait(0) end
        return JobInfo.name
    
    elseif Config.Framework == 'QBCORE' then
        while JobInfo.name == nil do Citizen.Wait(0) end
        return JobInfo.name

    elseif Config.Framework == 'OTHER' then
        return -- // if you want to use other framework, place here the code! 
    end
end


-- In this function you can choose what will happen to the driver who was warned by the radar!
function RadarGotYou(speed, vehicle, model, plate)
-- this is just a simple way to make amount's depending on your speeding.
local Amount = nil
if speed > 30 or 50 then 
     Amount = Config.FinePrice * 3
end
if speed > 80 or 100 then 
     Amount = Config.FinePrice * 6
end

if speed > 120 then 
     Amount = Config.FinePrice * 9
end
print(Amount)
TriggerServerEvent('revel_radar:payment', Amount)
CLNotify("inform", "you pay "..Amount.."$ for passing the speed of "..speed.."Km/h with you'r "..model.." ("..plate..")")

end

Last updated