How to add Police Alerts?!

sd_lib provides a comprehensive solution for integrating with the most renowned dispatch resources available. Your dispatch will automatically be detected and selected. If your preferred system isn't listed, just add your own system yourself in modules/PoliceDispatch/client.lua. The policeAlert() function in every script is your gateway to tailor the dispatch details - from the dispatch code to blips. Tailor it to your needs, and you're set! Here's the example from my oilrig script:

-- Police Alert for Oilrig Heist (Used Dispatch System can be changed in sd_lib/sh_config.lua)
function policeAlert()
  SD.PoliceDispatch({
      displayCode = "10-31H",                    -- Dispatch Code
      title = 'Oilrig Heist',                   -- Title is only used in cd_dispatch
      description = "Oilrig Heist in progress",-- Description of the heist
      message = "Suspects reported on the oilrig", -- Additional message or information
      -- Blip information is used for ALL dispatches besides ps_dispatch, please reference dispatchcodename below.
      sprite = 310,                            -- The blip sprite for oilrig or related icon
      scale = 1.0,                             -- The size of the blip on the map
      colour = 1,                              -- The color of the blip on the map (red, for example)
      blipText = "Oilrig Heist",               -- Text that appears on the Blip
      -- ps-dispatch
      dispatchcodename = "oilrig_heist"        -- This is the name for ps-dispatch users for the sv_dispatchcodes.lua entry.
  })
end 

Users of ps-dispatch must continue to add the blip entry into ps-dispatch/server/sv_dispatchcodes.lua or shared/config.lua (Under Config.Blips), based on the resource version. It's crucial that this entry matches the dispatchcodename in the PoliceDispatch/policeAlert function.

Last updated