🦥
Project Sloth
  • 🦥Project Sloth
  • ⭐Server Hosting | 1 of 1 Servers
  • Scripts
    • ❤️ps-hud
      • Installation Guide
      • Previews
    • 🪄ps-buffs
      • Available Buffs
      • Creduts
    • 👮ps-dispatch
      • Installation
      • Using Exports
        • Creating New Alerts
          • Using your or our Exports
    • 💻ps-mdt
      • Installation
      • Showcase
      • Credits
    • 👾ps-ui
      • Circle Minigame
      • Number Maze
      • VAR
      • Thermite
      • Scrambler
      • Display Text
      • Status UI
      • Menus
      • Input
      • Show Image
      • Show Notification
    • 🌱ps-drugprocessing
      • Previews
    • ⛽ps-fuel
      • Installation Guide
      • Features
      • Showcase
    • 🚞ps-objectspawner
      • Installation Guide
      • Features
      • Showcase
      • Credits
    • 🚓ps-liveries
      • Showcase
      • Credits
    • 🏠ps-housing
      • Installation
      • Features
      • Showcase
      • Adding Shells
      • Migration
      • Credits
    • ⚙️ps-discord
      • Installation
      • Convars
      • Exports
      • Credits
  • ❓FAQ
    • Frequently Asked Questions
      • Warnings
      • PS-HUD
      • PS-DISPATCH
      • PS-MDT
      • PS-UI
      • PS-DRUGPROCESSING
      • PS-OBJECTSPAWNER
      • PS-LIVERIES
Powered by GitBook
On this page
  1. Scripts
  2. ps-dispatch
  3. Using Exports
  4. Creating New Alerts

Using your or our Exports

We will be using a custom export for this tutorial

We will be going over how to use, create and work with exports. The pages are marked on the side of your screen in-case you already read the rest of the docs and figured it out!

Creating our callout (ps-dispatch/server/sv_dispatchcodes.lua)

	["methRunReport"] = {
		displayCode = '10-77', 
		description = "Drug Run In Progress", 
		radius = 0, 
		recipientList = { 'police' }, 
		blipSprite = 514, 
		blipColour = 32, 
		blipScale = 1.5, 
		blipLength = 2, 
		sound = "Lose_1st", 
		sound2 = "GTAO_FM_Events_Soundset", 
		offset = "false", 
		blipflash = "false"
	},

Creating the Export (ps-dispatch/client/cl_events.lua)

This callout of dispatch makes use of vehicle information. Which means that the user needs to be in a vehicle for the callout to happen.

local function methRunReport(vehicle)
    local vehdata = vehicleData(vehicle)
    local currentPos = GetEntityCoords(PlayerPedId())
    local locationInfo = getStreetandZone(currentPos)
    local heading = getCardinalDirectionFromHeading()
    TriggerServerEvent("dispatch:server:notify", {
        dispatchcodename = "methRunReport", -- has to match the codes in sv_dispatchcodes.lua so that it generates the right blip
        dispatchCode = "10-77",
        firstStreet = locationInfo,
        model = vehdata.name,
        plate = vehdata.plate,
        priority = 2,
        firstColor = vehdata.colour, -- vehicle color
        heading = heading,
        automaticGunfire = false,
        origin = {
            x = currentPos.x,
            y = currentPos.y,
            z = currentPos.z
        },
        dispatchMessage = "Drug Run",
        job = { "police" }
    })
end exports('methRunReport', methRunReport)

If you don't want or require vehicle information then do the following.

local function methRunReport()
    local currentPos = GetEntityCoords(PlayerPedId())
    local locationInfo = getStreetandZone(currentPos)
    local gender = GetPedGender()
    TriggerServerEvent("dispatch:server:notify",{
        dispatchcodename = "methRunReport", -- has to match the codes in sv_dispatchcodes.lua so that it generates the right blip
        dispatchCode = "10-77",
        firstStreet = locationInfo,
        gender = gender,
        model = nil,
        plate = nil,
        priority = 2, -- priority
        firstColor = nil,
        automaticGunfire = false,
        origin = {
            x = currentPos.x,
            y = currentPos.y,
            z = currentPos.z
        },
        dispatchMessage = 'Drug Run', -- message
        job = {"police" } -- jobs that will get the alerts
    })
end exports('methRunReport', methRunReport)

Creating an event with our export

Use the export that HAS vehicle information

RegisterNetEvent("PS:EXAMPLE:EXPORT:GUIDE:VEHICLE", function()
    local ped = PlayerPedId()
    local vehicle = GetVehiclePedIsIn(ped, true)
    exports['ps-dispatch']:methRunReport(vehicle)
end)

Use the export that does NOT have vehicle information.

RegisterNetEvent("PS:EXAMPLE:EXPORT:GUIDE", function()
    local ped = PlayerPedId()
    exports['ps-dispatch']:methRunReport()
end)

Basically put you add the export exports['ps-dispatch']:methRunReport() where you would want the police to get a notification of what is happening. You can use ps-dispatch to replace qb-core events for notifying police.

A full script!

Video: Soon Download: Soon

PreviousCreating New AlertsNextps-mdt

Last updated 2 years ago

👮