Dispatch Call in Client-side
The event qs-dispatch:server:CreateDispatchCall allows you to create dispatch calls in the system, targeting specific jobs and providing detailed call information. Below is a guide to using this event effectively.
Basic Dispatch Call
The event qs-dispatch:server:CreateDispatchCall is used to create a dispatch call in a dispatch management system. You must pass an object as an argument to the event with the following data.
job (array): A list of jobs related to the dispatch call. You can include values such as 'police', 'sheriff', 'traffic', 'patrol' and any others you wish to receive the dispatch call.callLocation (vector3): The coordinates of the location of the dispatch call. You must provide the coordinates in the form of a vector3 object.callCode (table): An object containing a call code and an associated code fragment. For example, you can have a call code 'Hight Speed' with a code fragment 'Vehicle'.message (string): A message describing the dispatch call. It may include relevant information such as vehicle model, license plate, color and speed.flashes (boolean): A Boolean value indicating whether the dispatch call icon should flash.image (string o nil): An image attached to the dispatch call. This can be an image URL or nil if there is no image attached.blip (table): An object describing the blip associated with the dispatch call. It may contain properties such as the blip's sprite, scale, color, whether it blinks, the associated text, and the blip's duration time in milliseconds.Be sure to provide the proper data in the correct format when calling this event to create a dispatch:
Dispatch Call With Player Data
The combination of CreateDispatchCall and GetPlayerInfo allows you to dynamically generate dispatch calls based on real-time player information. This is useful for creating personalized and precise alerts for jobs like police or emergency services.
To create a dispatch call using real-time player data, use the following code:
Dispatch Call With Player Data and Image
This example demonstrates how to create a dispatch call that includes real-time player data and a screenshot URL. This is useful for creating detailed and visual alerts for dispatch jobs like police or emergency services.
To dynamically generate a dispatch call with player data and a screenshot, use the following code:
Client Command for Dispatch
Add the following code to your client.lua file. Running the /testclient command in-game will send a dispatch alert to the configured jobs (police, sheriff, traffic, patrol) with the player's details who executed the command.
Command Execution
Use /testclient in the game chat.
Player Data Fetching
The script gathers player details like location, vehicle, and speed.
Dispatch Alert Creation
Sends the gathered information to the configured jobs as a dispatch call.
This example demonstrates how to integrate qs-dispatch to trigger dispatch events dynamically based on player data.
Dispatch Call in Server-side
The event qs-dispatch:server:CreateDispatchCall is used to generate dispatch calls for specific jobs in the dispatch management system. This event should be triggered server-side, passing an object with the required parameters.
Basic Dispatch Call
The event qs-dispatch:server:CreateDispatchCall is used to create a dispatch call in a dispatch management system. You must pass an object as an argument to the event with the following data:
job (array): A list of jobs related to the dispatch call. You can include values such as 'police', 'sheriff', 'traffic', 'patrol' and any others you wish to receive the dispatch call.callLocation (vector3): The coordinates of the location of the dispatch call. You must provide the coordinates in the form of a vector3 object.callCode (table): An object containing a call code and an associated code fragment. For example, you can have a call code 'Hight Speed' with a code fragment 'Vehicle'.message (string): A message describing the dispatch call. It may include relevant information such as vehicle model, license plate, color and speed.flashes (boolean): A Boolean value indicating whether the dispatch call icon should flash.image (string o nil): An image attached to the dispatch call. This can be an image URL or nil if there is no image attached.blip (table): An object describing the blip associated with the dispatch call. It may contain properties such as the blip's sprite, scale, color, whether it blinks, the associated text, and the blip's duration time in milliseconds.Be sure to provide the proper data in the correct format when calling this event to create a dispatch:
Dispatch Call With Player Data
This example demonstrates how to use the GetPlayerInfo export and CreateDispatchCall to generate a dispatch call using player information.
The GetPlayerInfo export retrieves detailed player data, which can then be used in the CreateDispatchCall event to send a dispatch alert to specified jobs.
For static data, you can create a dispatch call without player-specific information using the following:
Dispatch Call With Player Data and Image
This example demonstrates how to use the CreateDispatchCall, GetPlayerInfo, and GetSSURL exports to create a dispatch call enriched with player data and a screenshot.
This implementation fetches player-specific details (e.g., location, vehicle information) and optionally attaches a screenshot for enhanced dispatch call details.
Server Command for Dispatch
This example demonstrates how to create a server command that triggers a dispatch alert with player-specific data. By using this command, you can send a dispatch notification to configured jobs like police, sheriff, traffic, and patrol.
Add the following code to your server.lua file. When you run the test command in the TxAdmin console or game chat (with a valid player ID), it will fetch player data and send a dispatch alert.
Command Execution
Use /test [PlayerID] in the TxAdmin console or game chat to trigger the dispatch.
Dynamic Data Retrieval
The command fetches real-time player data, including location, vehicle details, and speed.
Screenshot Attachment
Automatically captures and attaches a player screenshot (if available) to the dispatch alert.
Dispatch Customization
Configure jobs, messages, blips, and other details within the CreateDispatchCall event.
This setup ensures a dynamic and interactive way to create dispatch alerts for specific players.
