Dispatch
Codesign Dispatch is a script for FiveM that offers a small and large UI that can be used by police to respond to calls and organize themselves more efficiently.
Buy Here

START HERE

1. Unzip the cd_dispatch.zip folder and place this folder in your servers resource folder.
2. Paste your Authorisation Token into the file named authorization.lua. This Token can be found on MyCodesign.
3. Add the resource to your server start config: ensure cd_dispatch (it must be placed anywhere below your framework resource eg., es_extended, not above). The name of the folder must not be changed or the resource will not function correctly.
4. WARNING do not edit the obfuscated files in any way.

SQL

You MUST import the SQL file to your database. This SQL file is located inside theREAD_ME_AFTER_PURCHASING folder, the file is named SQL_main.sql. Watch this video if you are unsure how to do this.
DO NOT SKIP THIS STEP OR THES SCRIPT WILL NOT FUNCTION CORRECTLY.

CONFIGURATION

You MUST read all of the configurable options inside the config.lua and configure them to suit your server's needs. Please read the ”commented out help text” at the end of each line so you can understand what each option does so you know if you need to change it or not.
The most important sections are the options under the Framework and Important sections at the top of the config.lua. Everything else is optional.
DO NOT SKIP THIS STEP OR THE SCRIPT WILL NOT FUNCTION CORRECTLY.

INSTALATION GUIDE

Dispatch is more of a developer resource, meaning you need add the code snippets below into other scripts to tell the dispatch when to send a notification.

Part 1 - We need to get the data from the client and send it to the server.

From client to server (Main Example)
1
TriggerServerEvent('CHANGE_ME', exports['cd_dispatch']:GetPlayerInfo())
Copied!
From client to server (Optional Example)
1
--OPTIONAL - By default the export will include the players current location, but if you wish to send a set location you can send the coordinates in a vector3 format.
2
TriggerServerEvent('CHANGE_ME', exports['cd_dispatch']:GetPlayerInfo(), vector3(0,0,0))
Copied!
[GUIDE] The export used above will return this table. This can be customised in the client/functions.lua.
1
local data = exports['cd_dispatch']:GetPlayerInfo()
2
3
--The export will return these values for you to use.
4
data.ped
5
data.coords
6
data.street_1
7
data.street_2
8
data.sex
9
--If the player is not in a vehicle, it will not return any vehicle data.
10
data.vehicle
11
data.vehicle_label
12
data.vehicle_colour
13
data.vehicle_plate
Copied!

Part 2 - Now we need to add the server event below to the server-side of the said script and configure the data that we are sending from the client-side to the server-side.

1
RegisterServerEvent('CHANGE_ME')
2
AddEventHandler('CHANGE_ME', function(data, customcoords)
3
if customcoords ~= nil then data.coords = customcoords end
4
TriggerClientEvent('cd_dispatch:AddNotification', -1, {
5
job = 'police',
6
coords = data.coords,
7
title = '10-15 - Store Robbery',
8
message = 'A '..data.sex..' robbing a store at '..data.street_1..', '..data.street_2,
9
flash = 0,
10
blip = {
11
sprite = 431,
12
scale = 1.2,
13
colour = 3,
14
flashes = false,
15
text = '911 - Store Robbery',
16
time = (5*60*1000),
17
sound = 1,
18
}
19
})
20
end)
Copied!

Notification Guide ^

    job = Everyone who has this job will receive this notification.
    message = You can remove the sex/streets etc if you don't want to display them.
    flash = Set to 1 to make the UI flash, used for panic button calls etc.
    sprite = The icon for the blips. More can be found here.
    scale = Size of the blip.
    colour = Colour of the blip. More can be found here at the bottom.
    flashes - If set to true the blip will flash, used for more important calls.
    time - The amount of time until the blip fades (default is 5 mins.)
    sound - The sound when receiving a notification (1 = 1 sound, 2 = 2 sounds, 3 = 3 sounds, 4 = panic button alert sound). But these can be configured in the configs/client_customise_me/ BlipSound(sound).

OPTIONAL INSTALATION STEPS

Radio Channels

This option will allow police for example to see a list of all police radio channels and which officers are in each channel. This is simply visual and will have no effect other than to help keep things organized. You will of course need to be using some sort of voice radio script. This event needs to be triggered from your radio script, specifically when a player (who has access to use the dispatch) joins/leaves/changes a radio channel - for example.
You must send the radio channel as a string or a number.
From client to server
1
TriggerServerEvent('cd_dispatch:GetRadioChannel', RADIO_CHANNEL_HERE)
Copied!

Optional on/off Duty Method

(Most people will not need to use this, it's just optional). This is only needed if your police don't switch jobs to go off duty, but instead, have an on/off duty local variable system.
You must send the value as a Boolean (true or false).
From server to client
From client to client
1
TriggerClientEvent('cd_dispatch:OnDutyChecks', source, BOOLEAN)
Copied!
1
TriggerEvent('cd_dispatch:OnDutyChecks', BOOLEAN)
Copied!

OTHER

Key Binding Setup

Please Read Here for more information.

Default Keybinds

Key
Description
Event (all client-side events)
U
Opens the small dispatch UI
TriggerEvent('cd_dispatch:KEY_smallui')
L
Opens the large dispatch UI
TriggerEvent('cd_dispatch:KEY_largeui')
G
Respond to a notification
TriggerEvent('cd_dispatch:KEY_responding')
K
Toggle move mode
N/A
Left/Right Arrows
Scroll through the notifications on the small dispatch UI
N/A

SCRIPT NOT WORKING?

Common Issues

🔔 Folder Name Make sure the name of the folder is cd_dispatch.
SQL Default Value Error If you see an error similar to this example when inserting an SQL query into your database - “BLOB/TEXT column 'callsign' can't have a default value”.
✔️ You can use “VARCHAR(256)” instead of “LONGTEXT” in the SQL query.
SQL Unknown Column Error If you see an SQL error in the server console similar to this example - ER_BAD_FIELD_ERROR: Unknown colum 'callsign' in 'where clause'.
✔️ You are missing one of the required database columns. The SQL file can be found in the "READ_ME_AFTER_PURCHASING" folder.
Script Loading If you see this notification at least 10-20 seconds after loading in or restarting the script - “The script is still loading. Please try again in 10 seconds”.
✔️ This normally happens either when you have not configured the “Config.UsingMultichar” correctly.

Common Error Codes

Server
Client
N/A
77894684156 - The GetJob() function in the configs/client_customise_me.lua is returning a nil value, it should be returning the players job name as a string.

Troubleshooting

1. Check if the script has authorized correctly. Check the server console for a blue print saying Authorised Successfully and check for a client-sided print saying Successful 3.
2. Check for obvious error prints in the server console and the client F8 console. If you don't see any obvious errors make sure to restart the script while the server is live and check again.
3. Enable the test command in the config, restart the script and see if it works. If it works it means you have not installed/configured it correctly.
4. Change the key in the config.lua to one that you know works, as one of your other resources, may be disabling that specific key.
5. If none of the above worked, have a second read through the installation guide above, you may have missed something - you are only human.
If all else fails, contact the Codesign Team in the Codesign Discord.

CONFIGS & LOCALES

This resource also contains various editable/unobscured files such as client/server functions etc...
Config
Config UI
Locales
Locales UI
1
Config = {}
2
------------------------------------------------------------------------------------------------------
3
----------------------------------------------- MAIN -------------------------------------------------
4
------------------------------------------------------------------------------------------------------
5
Config.Database = 'mysql' --[ 'mysql' / 'ghmattimysql' ] Choose your sql database script.
6
Config.Language = 'EN' --[ 'EN' / 'FR' / 'ES' / 'CZ' / 'PT' ] You can add your own locales to the Locales.lua. But make sure to add it here.
7
8
Config.UseESX = true --Do you use es_extended?
9
Config.ESXTriggers = { --You can change the esx events (IF NEEDED).
10
main = 'esx:getSharedObject',
11
load = 'esx:playerLoaded',
12
job = 'esx:setJob',
13
}
14
15
Config.UsingOnesync = true --Do you use onesync/infinity?
16
Config.UsingMultichar = true --Do you use a multi character script?
17
Config.EnableTestCommand = false --The test command is 'dispatchtest'.
18
Config.NotificationType = { --[ 'chat' / 'mythic_old' / 'mythic_new' / 'esx' / 'custom' ]
19
server = 'esx',
20
client = 'esx',
21
}
22
------------------------------------------------------------------------------------------------------
23
--------------------------------------------- CALLSIGN -----------------------------------------------
24
------------------------------------------------------------------------------------------------------
25
Config.CommandName = 'callsign' --Customise the command where you will set your call sign.
26
Config.UseRadio = true --Do you want to display which officers are in which radio channels?
27
Config.DayHours = {[1] = 6, [2] = 22} --If the game time is between 6am to 10pm then dark mode will be enabled, else lightmode will be enabled (using 24 hour clock).
28
29
Config.AllowedJobs = { --A list of jobs who are allowed to use this dispatch.
30
['police'] = true,
31
['ambulance'] = true,
32
['mechanic'] = true,
33
}
34
35
Config.DefaultCallsignColour = 'blue' --The default blip colour, even if the blip is nil.
36
Config.CallsignData = {
37
--blipcolour : The only colours available by default are blue/orange/yellow/red.More can be added in the html.
38
--blipname : If the first letter of a players callsign matches with the 'blipname' (this is caps sensetive), the players blip colour in the large UI will be set to the matching 'blipcolour' from the table below.
39
--EXAMPLE : If a players callsign starts with the letter 'B', the blip colour on the large UI for this player will be orange.
40
[1] = {blipname = 'L', blipcolour = 'blue'},
41
[2] = {blipname = 'B', blipcolour = 'orange'},
42
[3] = {blipname = 'S', blipcolour = 'yellow'},
43
[4] = {blipname = 'M', blipcolour = 'red'},
44
}
45
------------------------------------------------------------------------------------------------------
46
------------------------------------------ KEYS AND COMMANDS -----------------------------------------
47
------------------------------------------------------------------------------------------------------
48
Config.MoveMode = 311 --Key to enable/disable move mode for the small UI. (K default).
49
Config.MoveRight = 175 --Key to scroll right through the notifications on the small UI. (RIGHT ARROW default)
50
Config.MoveLeft = 174 --Key to scroll left through the notifications on the small UI. (LEFT ARROW default)
51
52
--The keypress and chat command are combined together by using the register keymapping native. If you disable one, it will disable both.
53
Config.small_ui = {
54
ENABLE = true, --The main toggle for the small UI. If disabled, all of the options below in this sub-table will not used.
55
command = 'dispatchsmall', --Customise the chat command.
56
key = 'u', --Customise the key.
57
description = Locales[Config.Language]['dispatchsmall_description'], --Customise the description for the chat message.
58
}
59
Config.large_ui = {
60
ENABLE = true, --The main toggle for the large UI. If disabled, all of the options below in this sub-table will not used.
61
command = 'dispatchlarge', --Customise the chat command.
62
key = 'l', --Customise the key.
63
description = Locales[Config.Language]['dispatchlarge_description'], --Customise the description for the chat message.
64
}
65
Config.respond = {
66
ENABLE = true, --The main toggle for responding. If disabled, all of the options below in this sub-table will not used.
67
command = 'respond', --Customise the chat command.
68
key = 'g', --Customise the key.
69
description = Locales[Config.Language]['respond_description'], --Customise the description for the chat message.
70
}
71
------------------------------------------------------------------------------------------------------
72
---------------------------------------- PAINC BUTTON ------------------------------------------------
73
------------------------------------------------------------------------------------------------------
74
Config.PanicWaitTime = 30 --(in seconds) This timer is to prevent police spamming the panic button.
75
Config.JobsTable = {
76
['police'] = {CommandName = '911', Job = 'police'},
77
['ambulance'] = {CommandName = '911ems', Job = 'ambulance'},
78
['cardealer'] = {CommandName = 'cardealer', Job = 'cardealer'},
79
['realestate'] = {CommandName = 'realestate', Job = 'realestate'},
80
['taxi'] = {CommandName = 'taxi', Job = 'taxi'},
81
}
Copied!
1
let config = {
2
showRadio:true
3
}
Copied!
1
Locales = {
2
['EN'] = {
3
['dispatchsmall_description'] = 'Open the small UI',
4
['dispatchlarge_description'] = 'Open the large UI',
5
['respond_description'] = 'Respond to dispatch calls',
6
['callsign_show'] = 'Your callsaign is : %s',
7
['callsign_empty_1'] = 'You do not have a callsign set',
8
['callsign_set'] = 'Your callsign has been set to : %s',
9
['callsign_empty_2'] = 'The callsign can not be empty',
10
['callsign_deleted'] = 'Your callsign has been deleted',
11
['callsign_invalidformat'] = 'Invalid format (show / set / delete)',
12
['callsign_invalidperms'] = 'You do not have permission to set a callsign',
13
['cooldown'] = 'There is a 1 second cooldown when pressing G to avoid issues',
14
['still_loading'] = 'The script is still loading. Please try again in 10 seconds',
15
['enter_message_1'] = 'Please enter your message to be sent to the %s',
16
['enter_message_2'] = 'Enter the message to send',
17
['enter_playerid'] = 'Enter a player ID',
18
['no_perms'] = 'You do not have permission to use this command',
19
['dont_spam'] = 'You dont need to spam this',
20
['dispatch_callcommand'] = 'Call to the %s sent : %s',
21
['dispatch_callcommand_nonduty'] = 'No %s on duty to respond',
22
['dispatch_callcommand_reply_1'] = '%s reply from %s sent to (%s) : %s',
23
['dispatch_callcommand_reply_2'] = 'Reply from %s (%s) : %s',
24
['player_not_found'] = 'Invalid ID - This player is not online',
25
},
26
27
['FR'] = {
28
['dispatchsmall_description'] = 'Open the small UI',
29
['dispatchlarge_description'] = 'Open the large UI',
30
['respond_description'] = 'Respond to dispatch calls',
31
['callsign_show'] = 'SIGNE D\'APPEL : %s',
32
['callsign_empty_1'] = 'Vous n\'avez pas défini d\'indicatif',
33
['callsign_set'] = 'CALLSIGN: vous avez défini votre indicatif sur %s',
34
['callsign_empty_2'] = 'L\'indicatif ne peut pas être vide',
35
['callsign_deleted'] = 'Votre indicatif a été supprimé',
36
['callsign_invalidformat'] = 'Format non valide (afficher / définir / supprimer)',
37
['callsign_invalidperms'] = 'Vous n\'êtes pas autorisé à définir un indicatif d\'appel',
38
['cooldown'] = 'Le nom ne peut pas dépasser 10 caractères',
39
['still_loading'] = 'Le script est toujours en cours de chargement. Veuillez réessayer dans 10 secondes',
40
['enter_message_1'] = 'Please enter your message to be sent to the %s',
41
['enter_message_2'] = 'Enter the message to send',
42
['enter_playerid'] = 'Enter a player ID',
43
['no_perms'] = 'You do not have permission to use this command',
44
['dont_spam'] = 'You dont need to spam this',
45
['dispatch_callcommand'] = 'Call to the %s sent : %s',
46
['dispatch_callcommand_nonduty'] = 'No %s on duty to respond',
47
['dispatch_callcommand_reply_1'] = '%s reply from %s sent to (%s) : %s',
48
['dispatch_callcommand_reply_2'] = 'Reply from %s (%s) : %s',
49
['player_not_found'] = 'Invalid ID - This player is not online',
50
},
51
52
['ES'] = {
53
['dispatchsmall_description'] = 'Open the small UI',
54
['dispatchlarge_description'] = 'Open the large UI',
55
['respond_description'] = 'Respond to dispatch calls',
56
['callsign_show'] = 'SEÑAL DE LLAMADA : %s',
57
['callsign_empty_1'] = 'No tienes un indicativo establecido',
58
['callsign_set'] = 'SEÑAL DE LLAMADA: Ha configurado su indicativo de llamada en %s',
59
['callsign_empty_2'] = 'El indicativo no puede estar vacío',
60
['callsign_deleted'] = 'Su indicativo ha sido eliminado',
61
['callsign_invalidformat'] = 'Formato no válido (mostrar / configurar / eliminar)',
62
['callsign_invalidperms'] = 'No tienes permiso para establecer un indicativo',
63
['cooldown'] = 'El nombre no puede tener más de 10 caracteres',
64
['still_loading'] = 'El guión todavía se está cargando. Vuelve a intentarlo en 10 segundos',
65
['enter_message_1'] = 'Please enter your message to be sent to the %s',
66
['enter_message_2'] = 'Enter the message to send',
67
['enter_playerid'] = 'Enter a player ID',
68
['no_perms'] = 'You do not have permission to use this command',
69
['dont_spam'] = 'You dont need to spam this',
70
['dispatch_callcommand'] = 'Call to the %s sent : %s',
71
['dispatch_callcommand_nonduty'] = 'No %s on duty to respond',
72
['dispatch_callcommand_reply_1'] = '%s reply from %s sent to (%s) : %s',
73
['dispatch_callcommand_reply_2'] = 'Reply from %s (%s) : %s',
74
['player_not_found'] = 'Invalid ID - This player is not online',
75
},
76
77
['CZ'] = {
78
['dispatchsmall_description'] = 'Open the small UI',
79
['dispatchlarge_description'] = 'Open the large UI',
80
['respond_description'] = 'Respond to dispatch calls',
81
['callsign_show'] = 'CALLSIGN : %s',
82
['callsign_empty_1'] = 'You do not have a callsign set',
83
['callsign_set'] = 'CALLSIGN : You have set your callsign to %s',
84
['callsign_empty_2'] = 'The callsign can not be empty',
85
['callsign_deleted'] = 'Your callsign has been deleted',
86
['callsign_invalidformat'] = 'Invalid format (show / set / delete)',
87
['callsign_invalidperms'] = 'You do not have permission to set a callsign',
88
['cooldown'] = 'Při stisknutí G dojde k 1 sekundovému cooldownu, aby nedocházelo k problémům',
89
['still_loading'] = 'Skript se stále načítá. Zkuste to prosím znovu za 10 sekund',
90
['enter_message_1'] = 'Please enter your message to be sent to the %s',
91
['enter_message_2'] = 'Enter the message to send',
92
['enter_playerid'] = 'Enter a player ID',
93
['no_perms'] = 'You do not have permission to use this command',
94
['dont_spam'] = 'You dont need to spam this',
95
['dispatch_callcommand'] = 'Call to the %s sent : %s',
96
['dispatch_callcommand_nonduty'] = 'No %s on duty to respond',
97
['dispatch_callcommand_reply_1'] = '%s reply from %s sent to (%s) : %s',
98
['dispatch_callcommand_reply_2'] = 'Reply from %s (%s) : %s',
99
['player_not_found'] = 'Invalid ID - This player is not online',
100
},
101
102
['PT'] = {
103
['dispatchsmall_description'] = 'Open the small UI',
104
['dispatchlarge_description'] = 'Open the large UI',
105
['respond_description'] = 'Respond to dispatch calls',
106
['callsign_show'] = 'CALLSIGN : %s',
107
['callsign_empty_1'] = 'You do not have a callsign set',
108
['callsign_set'] = 'CALLSIGN : You have set your callsign to %s',
109
['callsign_empty_2'] = 'The callsign can not be empty',
110
['callsign_deleted'] = 'Your callsign has been deleted',
111
['callsign_invalidformat'] = 'Invalid format (show / set / delete)',
112
['callsign_invalidperms'] = 'You do not have permission to set a callsign',
113
['cooldown'] = 'Há um resfriamento de 1 segundo ao pressionar G para evitar problemas',
114
['still_loading'] = 'O script ainda está carregando. Por favor tente novamente em 10 segundos',
115
['enter_message_1'] = 'Please enter your message to be sent to the %s',
116
['enter_message_2'] = 'Enter the message to send',
117
['enter_playerid'] = 'Enter a player ID',
118
['no_perms'] = 'You do not have permission to use this command',
119
['dont_spam'] = 'You dont need to spam this',
120
['dispatch_callcommand'] = 'Call to the %s sent : %s',
121
['dispatch_callcommand_nonduty'] = 'No %s on duty to respond',
122
['dispatch_callcommand_reply_1'] = '%s reply from %s sent to (%s) : %s',
123
['dispatch_callcommand_reply_2'] = 'Reply from %s (%s) : %s',
124
['player_not_found'] = 'Invalid ID - This player is not online',
125
},
126
}
Copied!
1
const locale = {
2
cd_dispatch_small_title:"No dispatch calls",
3
cd_dispatch_small_prev:"Previous",
4
cd_dispatch_small_next:"Next",
5
cd_dispatch_small_respond:"Respond",
6
cd_dispatch_small_mode:"Press <b>K</b> to return to normal mode.",
7
8
cd_dispatch_main_show_refresh_bar:"Show",
9
cd_dispatch_main_hide_refresh_bar:"Hide",
10
cd_dispatch_main_refresh:"Refresh police blips",
11
cd_dispatch_main_close_refresh_bar:"Close",
12
cd_dispatch_main_refresh_last:"Last refreshed",
13
14
cd_dispatch_main_radio:"Radio channels",
15
16
cd_dispatch_main_dropdown_respond:"Respond to notification",
17
cd_dispatch_main_dropdown_remove_response:"Remove notification response",
18
cd_dispatch_main_dropdown_remove_notification:"Remove this notification",
19
cd_dispatch_main_dropdown_remove_all:"Remove all notifications",
20
cd_dispatch_main_dropdown_close_large:"Close large dispatch",
21
cd_dispatch_main_dropdown_close_this:"Close this menu",
22
23
cd_dispatch_main_modal_title:"Dispatch Settings",
24
cd_dispatch_main_modal_autodel:"Auto delete after",
25
cd_dispatch_main_modal_autodel_desc:"The amount of time needed to auto delete the notification. (In minutes, 1-60)",
26
cd_dispatch_main_modal_close:"Close",
27
cd_dispatch_main_modal_save:"Save changes",
28
}
Copied!

CHANGELOG

In every changelog, we have a Files Changed section. Here we inform you if you need to replace the whole folder, or you can replace the specific files which have been updated. We do this because we understand it's a pain to redo the configs for every update.
All Files - This means you should delete your old cd_dispatch folder, download and add in the latest version, re-add your authorization token, reconfigure the configs folder and restart your server.
Specific Files - This means you can simply copy and paste the SPECIFIC new files over the old ones and restart the server.
v3.0.0
v3.0.1
v3.0.2
v3.0.3
v3.0.4
v4.0 - WIP

26/12/2020

Files Changed:
    All files
    Specific Files
Update Type:
    Mandatory
    Optional
Changelog:
Authentication
    Authentication update

11/01/2021

Files Changed:
    All files
    Specific Files
1
fxmanifest.lua - (IMPORTANT)
2
server/server.lua - (IMPORTANT)
3
client/client.lua - (IMPORTANT)
4
configs/server_customise_me.lua
5
configs/locales.lua
Copied!
Update Type:
    Mandatory
    Optional
Changelog:
Fix
    Fixed random server error on server start
    Minor bug fixes
    Fixed errors with the /callsign command
    Fixed error when using the UI before the script has loaded fully

17/01/2021

Files Changed:
    All files
    Specific Files
1
fxmanifest.lua - (IMPORTANT)
2
server/server.lua - (IMPORTANT)
3
client/client.lua - (IMPORTANT)
4
configs/client_customise_me.lua
Copied!
Update Type:
    Mandatory
    Optional
Changelog:
Fix
    Fixed random server error on server start
    Minor bug fixes

19/02/2021

Files Changed:
    All files
    Specific Files
Update Type:
    Mandatory
    Optional
Changelog:
Add
    Added locales for the /911 etc chat commands
    Added the ability to rename all esx events such as the setjob and playerloaded events
Edit
    Minor script cleanups
    Updated the codesign error handlers
    Removed the need to cache individual players data when going on/off duty

21/06/2021

Files Changed:
    All files
    Specific Files
1
fxmanifest.lua - (IMPORTANT)
2
client/client.lua - (IMPORTANT)
Copied!
Update Type:
    Mandatory
    Optional
Fix
    Temporary fix for the canary issue until the new Tebex FiveM license system is ready to launch, when this is released we will be fully switching over to the new system

04/05/2021 - THIS UPDATE IS A WIP AND IS NOT RELEASED YET

Files Changed:
    All files
    Specific Files
Update Type:
    Mandatory
    Optional
Add
    Added drag and drop QBUS compatibility
    Added the ability to notify multiple jobs in the same notification rather than sending multiple notifications to notify separate jobs
    Added the ability to enable the player blips on the large UI to auto refresh while the UI is open
Fix
    Fixed the on/off duty locals method showing blips on the map and playing the alert sound when a notification comes through when the player is off duty
    Fixed the random client error when responding to calls
Edit
    Edited the GetPlayerInfo() export to get the closest vehicle if a player is not in a vehicle (within a certain distance, otherwise the vehicle data will not return any data)
Last modified 1mo ago