Skip to content

Latest commit

 

History

History
417 lines (324 loc) · 9.39 KB

File metadata and controls

417 lines (324 loc) · 9.39 KB

CD_Dispatch Integration Guide

This guide explains how the parking meter robbery script integrates with cd_dispatch (Codesign Dispatch).

How It Works

The script sends alerts directly to cd_dispatch using the cd_dispatch:AddNotification event. When a parking meter is robbed and the alert is triggered, it creates a dispatch call with all necessary information.

Configuration

In config.lua, make sure you have:

Config.DispatchSystem = 'cd_dispatch'

Police Jobs Configuration

Config.PoliceJobs = {
    'police',
    'sheriff',
    -- Add any other police job names your server uses
}

IMPORTANT: Make sure these job names match exactly with your server's job names in your framework (QBCore/ESX).

Blip Settings

Config.Blips = {
    ['parkingmeter'] = {
        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 (not used by cd_dispatch)
        sound2 = "GTAO_FM_Events_Soundset",
        offset = false,     -- Not used by cd_dispatch
        flash = false,      -- Make blip flash
        radius = 0          -- Blip radius (0 = no radius)
    }
}

Alert Data Structure

When a parking meter robbery occurs, the following data is sent to cd_dispatch:

{
    job_table = {'police', 'sheriff'},
    coords = vector3(x, y, z),
    title = '10-31 - Parking Meter Vandalism',
    message = 'Suspicious activity reported at a parking meter at [Street Name]',
    flash = 0,
    unique_id = 'random_8_digit_number',
    sound = 1,
    blip = {
        sprite = 161,
        scale = 0.8,
        colour = 1,
        flashes = false,
        text = 'Parking Meter Vandalism',
        time = 2,
        radius = 0
    }
}

Understanding CD_Dispatch Parameters

Flash Parameter

  • 0 = No flash
  • 1 = Flash (typically used for panic buttons)

Sound Parameter

CD_Dispatch has different sound types:

  • 1 = Normal dispatch sound (single beep)
  • 2 = Double beep
  • 3 = Panic sound
  • 4 = Panic sound with distance play

For parking meter robberies, we use 1 (normal sound).

Blip Parameters

Sprite IDs (common ones):

  • 161 = Generic dispatch marker
  • 58 = Helicopter
  • 431 = Store/shop
  • 313 = Gunshot
  • 515 = Speed camera
  • 56 = Police station

Color IDs:

  • 1 = Red
  • 2 = Green
  • 3 = Blue
  • 4 = White
  • 5 = Yellow

Time:

  • Value in minutes (e.g., 5 = 5 minutes on map)

Radius:

  • Value in game units (e.g., 100 = 100 unit radius circle)
  • 0 = No radius circle

Job Filtering

CD_Dispatch uses the job_table array to determine which players receive the alert:

job_table = {'police', 'sheriff', 'highway'}

Only players with these exact job names will receive the alert. Make sure to:

  1. Match job names exactly (case-sensitive)
  2. Include all police job variants on your server
  3. Players must be on-duty (if your server uses duty system)

Customizing Alerts

Change Alert Title and Code

Config.DispatchCode = "10-31" -- Police code
Config.DispatchTitle = "Parking Meter Vandalism" -- Alert title

Change Alert Message

Config.DispatchMessage = "Suspicious activity reported at a parking meter"

This will be combined with the street name automatically.

Change Blip Appearance

Edit Config.Blips['parkingmeter'] in config.lua:

Config.Blips = {
    ['parkingmeter'] = {
        sprite = 431,  -- Change to store icon
        color = 5,     -- Change to yellow
        scale = 1.0,   -- Make it bigger
        length = 5,    -- Keep on map for 5 minutes
        flash = true,  -- Make it flash
        radius = 50    -- Add a 50-unit radius circle
    }
}

Add Multiple Job Support

Config.PoliceJobs = {
    'police',
    'sheriff',
    'state',
    'highway',
    'marshals'
}

Using the Export

You can trigger a parking meter alert from other scripts:

-- Trigger alert at specific coordinates
local coords = vector3(x, y, z)
local streetName = "Main Street, Los Santos"

TriggerServerEvent('cd_dispatch:AddNotification', {
    job_table = {'police', 'sheriff'},
    coords = coords,
    title = '10-31 - Parking Meter Vandalism',
    message = 'Suspicious activity reported at a parking meter at ' .. streetName,
    flash = 0,
    unique_id = tostring(math.random(10000000, 99999999)),
    sound = 1,
    blip = {
        sprite = 161,
        scale = 0.8,
        colour = 1,
        flashes = false,
        text = 'Parking Meter Vandalism',
        time = 2,
        radius = 0
    }
})

Testing

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

  2. Check that:

    • Alert appears in cd_dispatch UI (small or large)
    • Blip appears on map
    • Sound plays (if not muted)
    • Alert shows correct street name
    • Only police jobs receive the alert

Troubleshooting

Alert Not Appearing

  1. Check cd_dispatch is running:

    ensure cd_dispatch
    refresh
    ensure parking-meter-robbery
    
  2. Verify job names match:

    • Check your qb-core/shared/jobs.lua or ESX job config
    • Job names are case-sensitive
    • Example QBCore job:
    ['police'] = {
        label = 'Law Enforcement',
        defaultDuty = true,
        -- ...
    }
  3. Check on-duty status:

    • If cd_dispatch has Config.UseFrameworkDutySystem = true, players must be on-duty
    • Toggle duty with your framework's duty command
  4. Enable debug mode:

    Config.Debug = true

    Check server console for "Sent cd_dispatch alert"

Alert Appears But No Blip

  1. Check blip time:

    • Make sure Config.Blips['parkingmeter'].length is greater than 0
  2. Check blip visibility:

    • Some blip sprites may not render properly
    • Try changing sprite to 161 (standard dispatch marker)
  3. Check map zoom:

    • Some blips don't show when zoomed out
    • Try zooming in on the map

No Sound Playing

  1. Check if sounds are muted:

    • In cd_dispatch settings, check sound control
    • Unmute sounds if needed
  2. Check sound parameter:

    • Value should be 1, 2, 3, or 4
    • Invalid values may cause no sound

Wrong Street Name

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

  • This is a GTA limitation in some areas
  • The game may not have street data for that location
  • Consider adding custom zone detection if needed

Players Not Receiving Alerts

  1. Check job name:

    • Use /debug_dispatch (if enabled) to see your current job
    • Make sure it matches Config.PoliceJobs exactly
  2. Check duty status:

    • Make sure you're on-duty
    • Some frameworks require toggling duty
  3. Check cd_dispatch permissions:

    • Make sure the job is configured in cd_dispatch config
    • Check cd_dispatch/config.lua for job settings

Advanced Customization

Add Vehicle Information

If you want to include vehicle information when robbing from a vehicle:

-- In the script where alert is triggered
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)
if vehicle ~= 0 then
    local plate = GetVehicleNumberPlateText(vehicle)
    local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
    -- Include in message
end

Priority Levels

CD_Dispatch doesn't use priority in the same way as ps-dispatch, but you can use the flash parameter:

  • flash = 0 = Normal priority
  • flash = 1 = High priority (usually reserved for panic buttons)

Custom Sounds

CD_Dispatch uses numbered sound parameters:

sound = 1 -- Change to 2 for double beep

Integration with CD_Dispatch Features

Player Blips

If you have player blips enabled in cd_dispatch, responding units will automatically show on the map.

Panic Button

The parking meter script is separate from panic buttons, but both work together in cd_dispatch.

Dispatcher Mode

If someone is in dispatcher mode, they'll see the parking meter alerts and can assign units.

Auto-Delete

CD_Dispatch will auto-delete old notifications based on its own config timer.

Support

For cd_dispatch specific issues:

  • Check cd_dispatch documentation
  • Verify cd_dispatch is up to date
  • Test with cd_dispatch's built-in test command: /dispatchtest

For script issues:

  • Enable Config.Debug = true
  • Check server console
  • Verify Config.DispatchSystem = 'cd_dispatch'
  • Make sure job names match exactly

Example Configurations

Configuration 1: Police + Sheriff

Config.PoliceJobs = {
    'police',
    'sheriff'
}

Config.Blips = {
    ['parkingmeter'] = {
        sprite = 161,
        color = 1,
        scale = 0.8,
        length = 2,
        flash = false,
        radius = 0
    }
}

Configuration 2: Multiple Agencies with Radius

Config.PoliceJobs = {
    'police',
    'sheriff',
    'state',
    'highway'
}

Config.Blips = {
    ['parkingmeter'] = {
        sprite = 431,
        color = 5,
        scale = 1.0,
        length = 5,
        flash = false,
        radius = 100
    }
}

Configuration 3: High Priority Alert

Config.Blips = {
    ['parkingmeter'] = {
        sprite = 161,
        color = 1,
        scale = 1.2,
        length = 3,
        flash = true,  -- Makes it high priority
        radius = 0
    }
}