Customization
Framework hooks and localization for ktx_dispatch.
Customization
ktx_dispatch ships with ESX support out of the box. Adapt it to any framework by editing the files in custom/.
Server Hooks
custom/server.lua contains three exports.
getPlayerName
Returns the character name for display in dispatch calls.
function getPlayerName(source)
local xPlayer = ESX.GetPlayerFromId(source)
if not xPlayer then return "Unknown" end
return xPlayer.getName()
endFor QBx/QB-Core, use Player.PlayerData.charinfo.firstname and lastname.
getPlayerJobType
Returns the service key from EmergencyServices that matches the player's framework job. The default implementation iterates EmergencyServices and returns the first enabled service whose job field matches the player's framework job, or nil otherwise.
function getPlayerJobType(source)
local xPlayer = ESX.GetPlayerFromId(source)
if not xPlayer then return nil end
return xPlayer.getJob().name
endThe returned value must match a key in EmergencyServices (e.g. "police", "ambulance"), not the raw framework job name. If the player is not an emergency worker, return nil.
hasDispatchAccess
Checks if the player has an emergency job and can view the dispatch panel.
function hasDispatchAccess(source)
local jobType = getPlayerJobType(source)
return jobType ~= nil
endReturn true to grant access, false to deny. Citizens can still create calls but cannot view the full dispatch panel.
Client Hooks
custom/client.lua exports notify, which is also bound to the ktx_dispatch:notify net event so the server can fire notifications without an extra export call.
function notify(message, type, title, duration)
ESX.ShowNotification(message, type, duration, title)
endmessage- notification texttype-"success","error","info", or any framework-supported stringtitle- optional title above the messageduration- display time in milliseconds
Localization
Translation files live in locales/. The resource ships with en.json and de.json.
To add a new language:
- Copy
locales/en.jsontolocales/{code}.json(e.g.fr.json) - Translate all string values
- Set
"language": "fr"in theFrameworksection ofstatic/config.json
Keys must stay the same. Only translate the values.