Client Exports
Here you will find all the useful exports for this asset, please read each step and example carefully to better understand how it works, we do not recommend using these if you are not an experienced developer.
GetPlayerInfo
To obtain the player's information you must use the following export.
Export exports['qs-dispatch']:GetPlayerInfo() returns an object with the following player information.
ped
Player character identifier (game ped id)
coords
Player's coordinates on the map.
street_1
Name of the street near the player (first street)
street_2
Name of the street near the player (second street)
sex
Gender of the player's character.
vehicle
Identifier of the vehicle the player is in (if in one)
vehicle_label
Vehicle label/description.
vehicle_colour
Color of the vehicle.
vehicle_plate
Vehicle registration number.
speed
Vehicle speed in kilometers per hour (if in one)
The return object has a format similar to:
getSSURL
To get the screanshot of the local player (client) you must use the following export.
This export returns a text string in case of getting the image as for example cdn.discordapp.net/image.png. This can also return nil in case you have not been able to take the screenshot.
Creating 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 call correctly.
Creating Dispatch Call With Player Data
In this example we will use the above example CreateDispatchCall and GetPlayerInfo.
Creating Dispatch Call With Player Data and Image
In this example we will use the above example CreateDispatchCall , GetPlayerInfo and getSSURL.
Example of the use of a command on the Client
If you paste this into a client.lua file and run the test command in your game chat it will send a dispatch alert to all the jobs configured in that call 'police', 'sheriff', 'traffic' and 'patrol' which will be sent with the information of whoever runs the command.
Creating a History Entrie for vehicle
This feature will only work if you use Config.MDT.newMdt = false
In this section you will learn how to create a vehicle report from your customer code. Taking into account what you have learned in the previous parts such as GetPlayerInfo and getSSURL, you can use this events.
Parameters
The server callback takes three parameters:
Callback Function: A function that is executed when a response is received from the server. The resp argument indicates whether the operation was successful or not.
Data Object: An object containing the vehicle data to be stored in the registry. You must provide the following data:
type
(string): Type of violation or event. Do not modify the value.plate
(string): Vehicle license plate.zone
(string): Text of the area or name of the official related to the event.data
(table): A list of vehicle data to be stored in the registry. Each item in the list is an object with the following properties:key
(string): Title or label of the data.value
(string): Data content or value.
An example of server callback usage is shown below:
Creating History Entrie for Player
This feature will only work if you use Config.MDT.newMdt = false
This History will be automatically added to the player's job database, for example if Callabck is run on a player who is a police officer, only the police officers will be able to see this.
Parameters
The server callback takes three parameters:
Callback Function: A function that is executed when a response is received from the server. The resp argument indicates whether the operation was successful or not.
Data Object: An object containing the history data to be inserted. You must provide the following data:
identifier
(string): Data Player identifier.datatype
(string): Type of violation or event. Do not modify the value.dataobj
(table): An object containing detailed information about the history data. You must provide the following properties:message
(string): Message associated with the history data.by
(string): Who entered the history data.title
(string): Title of the history data.data
(table): A list of data to be stored in the registry. Each item in the list is an object with the following properties:key
(string): Title or label of the data.value
(string): Data content or value.
An example of server callback usage is shown below:
Remember to provide the correct data in the right format when using this server callback. Be sure to adapt it to your programming logic and data structure.
Job duty system
Dispatch asset brings an export to do a duryoff and dutyon, to give permissions for the use of dispatch and mdt. In case the duty is false then you will not have access to dispatch and mdt.
Default Exports
Last updated