Functions

-- Function of the notify's
function Notify(msg, type, time)
    if type == "primary" then 
        QBCore.Functions.Notify(msg, "primary", time)
    end
    if type == "success" then
        QBCore.Functions.Notify(msg, "success", time)
    end
    if type == "error" then
        QBCore.Functions.Notify(msg, "error", time)
    end
end

function PoliceCall()
    if Config.Dispatch == "ps" then
        local playerPos = GetEntityCoords(PlayerPedId(), true)
        exports["ps-dispatch"]:CustomAlert({
        coords = playerPos,
        message = "Stealing Fuel",
        dispatchCode = "911",
        description = "Stealing Fuel",
        radius = 0,
        sprite = 357,
        color = 3,
        scale = 0.8,
        length = 3,
        })
    elseif Config.Dispatch == "cd" then
        local data = exports['cd_dispatch']:GetPlayerInfo()
        TriggerServerEvent('cd_dispatch:AddNotification', {
            job_table = {'police'},
            coords = data.coords,
            title = '10-10 - Stealing Fuel',
            message = 'A '..data.sex..' possibly committing a crime '..data.street,
            flash = 0,
            unique_id = tostring(math.random(0000000,9999999)),
            blip = {
                sprite = 156,
                scale = 1.2,
                colour = 1,
                flashes = false,
                text = '911 - Stealing Fuel',
                time = (5*60*1000),
                sound = 1,
            }
        })
    elseif Config.Dispatch == "qs" then
        local pCoords = GetEntityCoords(PlayerPedId())
        TriggerServerEvent('qs-dispatch:server:CreateDiapatchCall', {
             job = 'police',
             callLocation = pCoords,
             callCode = {code = '911 - Stealing Fuel', snippet = '10-10 Stealing Fuel'},
             message = 'possibly committing a crime',
             flashes = 'Boolean',
             image = 'URL.png',
             blip = {
                sprite = 110,
                scale = 1.5,
                colour = 1,
                flashes = true,
                text = '10-10 Stealing Fuel',
                time = (6*60*1000),-- 6 minutes
            }
        })
    end
end

function IsVehicleOwned(plate)
    local result = MySQL.Sync.fetchScalar('SELECT 1 from player_vehicles WHERE plate = ?', {plate})
    if result then
        return true
    else
        return false
    end
end

Last updated