Skip to content

Latest commit

 

History

History
252 lines (186 loc) · 5.8 KB

File metadata and controls

252 lines (186 loc) · 5.8 KB

PS-Dispatch Integration Guide

This guide explains how the parking meter robbery script integrates with ps-dispatch.

How It Works

The script uses ps-dispatch's native event structure to send alerts directly to the dispatch system. When a parking meter is robbed and the alert is triggered, it sends a properly formatted dispatch call.

Configuration

In config.lua, make sure you have:

Config.DispatchSystem = 'ps-dispatch'

PS-Dispatch Blip Settings

Config.PSDispatchBlip = {
    sprite = 161,           -- Blip sprite ID
    color = 1,              -- Blip color (1 = red)
    scale = 0.8,            -- Blip size
    length = 2,             -- Minutes the blip stays on map
    sound = "Lose_1st",     -- Sound effect name
    sound2 = "GTAO_FM_Events_Soundset", -- Sound set
    offset = false,         -- Set to true to randomize exact location
    flash = false           -- Set to true to make blip flash
}

Alert Data Structure

When a parking meter robbery occurs, the following data is sent to ps-dispatch:

{
    message = "Suspicious activity reported at a parking meter",
    codeName = 'parkingmeter',
    code = '10-31',
    icon = 'fa-solid fa-parking',
    priority = 2,
    coords = vector3(x, y, z),
    street = "Street Name, Zone",
    heading = "North/South/East/West",
    gender = "Male/Female/Unknown",
    jobs = { 'leo' },
    alert = Config.PSDispatchBlip
}

Job Filtering

PS-Dispatch uses the jobs table to determine which players receive the alert. By default, we use:

jobs = { 'leo' }

This means all players with job.type == 'leo' will receive the alert. This is how ps-dispatch handles all police jobs (police, sheriff, state police, etc.).

Customizing Alerts

Change Alert Priority

Priority levels in ps-dispatch:

  • 1 = High priority
  • 2 = Medium priority (default for parking meter)
  • 3 = Low priority

To change: Edit the priority value in client/alerts.lua

Change Alert Icon

You can use any Font Awesome icon:

  • 'fa-solid fa-parking' - Parking meter
  • 'fa-solid fa-money-bill' - Money
  • 'fa-solid fa-hand-holding-dollar' - Robbery
  • 'fa-solid fa-exclamation-triangle' - Warning

To change: Edit the icon value in client/alerts.lua

Change Blip Appearance

Edit Config.PSDispatchBlip in config.lua:

Blip Sprites (common ones):

  • 161 = Standard dispatch marker
  • 58 = Helicopter
  • 56 = Police station
  • 8 = Waypoint

Blip Colors:

  • 1 = Red
  • 2 = Green
  • 3 = Blue
  • 5 = Yellow
  • 59 = Orange

Add Random Location Offset

To hide the exact location (making police search for it):

Config.PSDispatchBlip = {
    offset = true,  -- Enable random offset
    -- ... other settings
}

This will randomize the blip location within a small radius.

Using the Export

You can trigger a parking meter alert from other scripts:

-- Trigger from player's current location
exports['parking-meter-robbery']:ParkingMeterRobbery()

-- Trigger from custom location
local coords = vector3(x, y, z)
local streetName = "Main Street, Los Santos"
exports['parking-meter-robbery']:ParkingMeterRobberyCustom(coords, streetName)

Testing

  1. Set minimum police to 0:
Config.MinimumPolice = 0
  1. Give yourself a crowbar:
/giveitem [your ID] weapon_crowbar 1
  1. Rob a parking meter

  2. Check that:

    • Alert appears in ps-dispatch UI
    • Blip appears on map
    • Sound plays (if not muted)
    • Alert shows correct street name

Troubleshooting

Alert Not Appearing

  1. Check ps-dispatch is running:

    ensure ps-dispatch
    
  2. Verify job type:

    • Your police job must have type = 'leo' in qb-core/shared/jobs.lua
    • Example:
    ['police'] = {
        label = 'Law Enforcement',
        type = 'leo',  -- This is required!
        -- ...
    }
  3. Check on-duty status:

    • Players must be on-duty to receive alerts (if Config.OnDutyOnly is enabled in ps-dispatch)
  4. Enable debug mode:

    Config.Debug = true

    Check server console for "Sent ps-dispatch alert"

Alert Appears But No Blip

  1. Check blip length:

    • Make sure Config.PSDispatchBlip.length is greater than 0
  2. Check blip visibility:

    • Some blip sprites may not be visible at certain scales
    • Try changing sprite to 161 (standard marker)

No Sound Playing

  1. Check if alerts are muted:

    • Players can mute alerts in ps-dispatch UI
    • Click the speaker icon to unmute
  2. Verify sound files:

    • Make sure ps-dispatch's sound files are installed
    • Check ps-dispatch/config.lua for InteractSound integration

Wrong Street Name

The script uses native GTA functions to get street names. If the name is incorrect:

  • This is a GTA limitation
  • The game may not have proper street data for that location
  • Consider using zones instead of exact street names

Advanced Customization

Add Camera Integration

If you have security cameras, you can add camera data:

-- In client/alerts.lua, add to dispatchData:
camera = {
    camId = cameraId,
    coords = cameraCoords
}

Add Vehicle Description

If the robbery involves a vehicle:

-- In client/alerts.lua, add to dispatchData:
vehicle = {
    model = vehicleModel,
    plate = vehiclePlate,
    color = vehicleColor
}

Multiple Alert Types

You can create different alert types for different scenarios:

-- For aggressive robberies
exports('ParkingMeterRobberyViolent', function()
    -- Copy ParkingMeterRobbery function
    -- Change priority to 1
    -- Change message to include "violent"
end)

Support

For ps-dispatch specific issues:

  • Check ps-dispatch documentation
  • Verify ps-dispatch is up to date
  • Test with ps-dispatch's default alerts first

For script issues:

  • Enable Config.Debug
  • Check server console
  • Verify Config.DispatchSystem = 'ps-dispatch'