Client-Side Exports
🔌 Integration
This documentation outlines the client-side exports available for dots-dispatch. Use these to trigger alerts from other scripts, retrieve player context, or control the UI.
sendDispatch
sendDispatchThis is the primary export used to trigger a new alert. It sends the provided data to the server, which then broadcasts it to all players currently on the specified whitelisted jobs.
Arguments:
data: (table) A collection of details defining the alert.
Parameters (data Table):
jobs
table
List of job names authorized to receive this alert (e.g., {'police'}).
title
string
The main heading of the dispatch message.
code
string
(Optional) The dispatch or penal code (e.g., "10-90").
message
string
(Optional) Detailed description of the event.
coords
vector3
(Optional) Incident location; defaults to player position if nil.
blipData
table
(Optional) Settings for the map blip including sprite, color, and size (or radius for area blips).
sound
string
(Optional) Sound name to play on arrival; defaults to 'default'.
plate
string
(Optional) The license plate of a vehicle.
blipData: Parameters (data Table):
sprite
int
The sprite set for the blip.
color
int
The color of the blip.
size
int
The size of a normal blip.
radius
int
The option to turn the blip into a radius.
💡 Example: Triggering a Store Robbery Alert
Alternatively, you can use TriggerEvent('dots-dispatch:client:sendDispatch', data) on the client side to achieve the same output, but we recommend using the export.
getDispatchData
This export retrieves real-time contextual information about the player. It is highly useful for building custom dispatch payloads manually or adding conditional logic based on a player's current location and state.
Returns:
data: (table) A table containing:coords: (vector3) The player's current XYZ coordinates.location: (table) Containsstreetandroadnames retrieved from the map.weapon: (string) The label of the weapon the player is currently holding.gender: (string) The player's gender as defined by your framework.
💡 Example: Manual Data Retrieval
togglePanel
togglePanelThis export is used to manually control the visibility of the dispatch UI panel. It includes built-in logic to ensure the player is authorized to view the dispatch system before opening.
Arguments:
forcedState: (boolean) Optional.true: Forces the panel to open.false: Forces the panel to close.nil: Toggles the panel based on its current visibility state.
Internal Logic Checks:
Whitelisting: The panel will not open if the player does not have a job defined in
Settings.WhitelistedJobs.Item Requirement: If
Settings.requireItemis enabled, the export checks if the player possesses the required item viaFramework.hasItem.Auto-Close: The system automatically calls
togglePanel(false)if the player dies, opens their inventory, or pauses the game.
💡 Example: Basic Toggle
Last updated