This section lists all available commands, exports, and events included in the script. You’ll find client-side, server-side, and shared functions designed to help developers integrate, extend, or interact with the system easily within their own scripts or frameworks.
This section lists all available commands included in the script. Each command is designed to simplify administration, player interaction, or debugging tasks. You’ll find detailed descriptions, usage examples, and permission requirements to help you manage and customize your server efficiently.
Command
Description
/cad
Open the police CAD (dispatch, search, radio, management)
/policeadmin
Open the police admin interface (settings, markers, permissions)
This section provides all available client exports for the script. These functions allow you to interact directly with the system from the client side, enabling custom features, UI interactions, and integrations with other resources. Each export includes a short description and usage example for easy implementation.
CreateDispatchCall
CreateDispatchCall lets you send police/emergency alerts from client-side Lua using qs-police-creator. You can create simple or advanced calls with player data, location, vehicles, and screenshots.
Basic Example
Simple dispatch with manual coordinates and minimal data.
lua
local callData = {
title = 'Shots Fired',
description = 'Gunshots reported',
location = { coords = { x = 123.4, y = 567.8, z = 21.0 } },
jobNames = { 'police' },
priority = 1
}
exports['qs-police-creator']:CreateDispatchCall(callData)
Using Player Info (Recommended)
Automatically includes player location data like street name.
lua
local info = exports['qs-dispatch']:GetPlayerInfo() or {}
local callData = {
title = 'Shots Fired',
description = ('Gunshots at %s'):format(info.street_1 or 'Unknown'),
location = { coords = info.coords },
jobNames = { 'police' },
priority = 1
}
exports['qs-police-creator']:CreateDispatchCall(callData)
With Screenshot
Adds a live screenshot to the dispatch for better context.
This system works best when you use GetPlayerInfo() to automatically include useful data like streets, vehicles, or speed directly inside the description so officers can read everything instantly. You should always handle cases where this data might be nil to avoid errors. Adding screenshots through GetScreenshotUrl() greatly improves context and realism, and if player data is not available, you can safely fallback to GetEntityCoords() to ensure the call still has a valid location.
GetScreenshotUrl
GetScreenshotUrl allows you to capture the player’s screen and get a public URL to use in dispatch calls or any system that needs visual evidence. It’s a client-side function that takes a screenshot, uploads it (Discord, Imgur, etc.), and returns a URL. If something fails, it returns nil. The process usually takes a few seconds and blocks until finished.
Basic Usage
Takes a screenshot and prints the URL or shows an error.
lua
RegisterCommand('takeshot', function()
local url = exports['qs-police-creator']:GetScreenshotUrl()
if url then
print("Screenshot URL: " .. url)
else
print("Failed to take screenshot")
end
end)
Safe Usage (Recommended)
Wraps the function to avoid blocking issues and handle failures better.
lua
local function GetSafeScreenshot(cb)
Citizen.CreateThread(function()
local url = exports['qs-police-creator']:GetScreenshotUrl()
cb(url or nil)
end)
end
RegisterCommand('safeshot', function()
GetSafeScreenshot(function(url)
if url then
print("URL: " .. url)
else
print("Screenshot failed")
end
end)
end)
With Dispatch (Real Use Case)
Captures a screenshot and attaches it to a police alert.
lua
RegisterCommand('reportrobbery', function()
local url = exports['qs-police-creator']:GetScreenshotUrl()
local callData = {
title = 'Robbery in Progress',
description = 'Suspects inside - see image',
location = { coords = GetEntityCoords(PlayerPedId()) },
jobNames = { 'police' },
image = url,
priority = 1
}
exports['qs-police-creator']:CreateDispatchCall(callData)
end)
This function must be used on the client side and requires the screenshot system to be properly configured in the resource. Since it can take a few seconds and blocks execution, it’s better to wrap it in a thread when used in larger systems. You should always check if the URL is nil to avoid errors, and avoid spamming it by adding cooldowns. When it works, it’s extremely useful to provide visual context in dispatch calls, making the system much more immersive and informative.
GetPlayerInfo
GetPlayerInfo lets you retrieve detailed real-time data about the player, including location, streets, and vehicle info, all in a single table. It’s commonly used to build rich dispatch messages and avoid multiple native calls. This function runs client-side and may return nil, so you should always handle fallback values.
Basic Usage
Safely gets player coords or falls back if it fails.
lua
local info = exports['qs-police-creator']:GetPlayerInfo()
local coords = info and info.coords or GetEntityCoords(PlayerPedId())
Street Formatting
Builds a clean street name including intersections.
lua
local info = exports['qs-police-creator']:GetPlayerInfo() or {}
local street = info.street_1 or 'Unknown'
if info.street_2 and info.street_2 ~= '' then
street = street .. ' / ' .. info.street_2
end
Vehicle Check
Detects if the player is in a vehicle and shows details.
lua
local info = exports['qs-police-creator']:GetPlayerInfo() or {}
if info.vehicle then
print(info.vehicle_label, info.vehicle_plate, info.speed)
else
print('Player on foot')
end
Use in Dispatch Description
Adds location and vehicle info directly into the message.
lua
local info = exports['qs-police-creator']:GetPlayerInfo() or {}
local desc = 'Incident reported.'
if info.street_1 then
desc = desc .. (' Location: %s.'):format(info.street_1)
end
if info.vehicle_label then
desc = desc .. (' Suspect in %s [%s] at %d km/h.'):format(
info.vehicle_label,
info.vehicle_plate or '???',
info.speed or 0
)
end
Full Safe Pattern (Recommended)
Handles all possible failures and builds a complete message.
lua
local info = exports['qs-police-creator']:GetPlayerInfo()
local coords = info and info.coords or GetEntityCoords(PlayerPedId())
local street = info and info.street_1 or 'Unknown'
local vehicleText = ''
if info and info.vehicle_label then
vehicleText = (' Vehicle: %s [%s] (%d km/h)'):format(
info.vehicle_label,
info.vehicle_plate or '???',
info.speed or 0
)
end
local message = ('Call at %s.%s'):format(street, vehicleText)
This function is designed to simplify your scripts by giving you all relevant player context in one call, but you should always assume it can fail and validate the data before using it. Vehicle data should never be trusted without checking if the player is actually inside one, and combining street fields manually gives better results for intersections. It’s especially useful for dispatch systems, reports, and any feature that needs detailed and readable player information.
SetDutyStatus
SetDutyStatus lets you force a player on or off duty from the client side using qs-police-creator. It instantly updates the internal system and dispatch UI without checks or validation. You simply pass a boolean: true for on duty, false for off duty.
Basic Usage
Forces the player on or off duty instantly.
lua
exports['qs-police-creator']:SetDutyStatus(true) -- On Duty
exports['qs-police-creator']:SetDutyStatus(false) -- Off Duty
On Player Spawn
Automatically sets the player on duty when they spawn.
This function works only on the client side and affects only the local player. It does not validate job, permissions, or current state, so you must control when and how it is used. Since it forces the state directly without toggling, it’s ideal for controlled scenarios like spawn logic or admin tools, but should not be spammed or used inside loops.
This section provides all available server exports for the script. These functions allow developers to interact with the system from the server side, manage data, trigger actions, and integrate with other resources. Each export includes a clear description and a practical example to simplify its implementation.
CreateDispatchCall
CreateDispatchCall (Server-Side) lets you send police/emergency alerts from the server using qs-police-creator. You can include player data, location, vehicles, and even request screenshots from a specific player.
The main function is CreateDispatchCall(callData, source) and you can enhance it using GetPlayerInfo(source) and GetScreenshotUrl(source).
Basic Example
Creates a simple dispatch from the server with minimal data.
lua
local callData = {
title = 'Shots Fired',
description = 'Gunshots reported',
location = { coords = { x = 123.4, y = 567.8, z = 21.0 } },
jobNames = { 'police' },
priority = 1
}
exports['qs-police-creator']:CreateDispatchCall(callData, source)
With Screenshot
Requests a screenshot from a player and attaches it to the dispatch.
lua
RegisterCommand('serverdispatchscreenshot', function(source)
local url = exports['qs-police-creator']:GetScreenshotUrl(source)
local callData = {
title = 'Robbery in Progress',
description = 'Armed suspects inside',
location = { coords = { x = 123.4, y = 567.8, z = 21.0 } },
jobNames = { 'police' },
image = url,
priority = 1
}
exports['qs-police-creator']:CreateDispatchCall(callData, source)
end)
Using Player Info
Builds a dynamic description using real player data.
lua
RegisterCommand('serverdispatchinfo', function(source)
local info = GetPlayerInfo(source) or {}
local street = info.street_1 or 'Unknown'
if info.street_2 and info.street_2 ~= '' then
street = street .. ' / ' .. info.street_2
end
local desc = ('Shots fired at %s.'):format(street)
if info.vehicle_label then
desc = desc .. (' Vehicle: %s [%s] (%d km/h)'):format(
info.vehicle_label,
info.vehicle_plate or '???',
info.speed or 0
)
end
local callData = {
title = 'Shots Fired',
description = desc,
location = { coords = info.coords },
jobNames = { 'police' },
priority = 1
}
exports['qs-police-creator']:CreateDispatchCall(callData, source)
end)
Full Example (Recommended)
Combines screenshot + player info for a complete dispatch.
lua
RegisterCommand('serverdispatchfull', function(source)
local info = GetPlayerInfo(source) or {}
local url = exports['qs-police-creator']:GetScreenshotUrl(source)
local street = info.street_1 or 'Unknown'
if info.street_2 and info.street_2 ~= '' then
street = street .. ' / ' .. info.street_2
end
local desc = ('Accident at %s.'):format(street)
if info.vehicle_label then
desc = desc .. (' Vehicle: %s [%s] (%d km/h)'):format(
info.vehicle_label,
info.vehicle_plate or '???',
info.speed or 0
)
end
local callData = {
title = 'Traffic Accident',
description = desc,
location = { coords = info.coords },
jobNames = { 'police', 'ems' },
image = url,
priority = 1
}
exports['qs-police-creator']:CreateDispatchCall(callData, source)
end)
From Client Event
Uses coords sent from client and enriches with server data.
lua
RegisterNetEvent('my-resource:reportAccident')
AddEventHandler('my-resource:reportAccident', function(coords)
local src = source
local info = GetPlayerInfo(src) or {}
local street = info.street_1 or 'Unknown'
local desc = ('Accident at %s'):format(street)
local callData = {
title = 'Accident',
description = desc,
location = { coords = coords },
jobNames = { 'police', 'ambulance' },
priority = 1
}
exports['qs-police-creator']:CreateDispatchCall(callData, src)
end)
This system allows you to fully control dispatches from the server, making it ideal for automated events, commands, or integrations with other resources. Using GetPlayerInfo(source) gives you reliable and detailed context, while GetScreenshotUrl(source) adds visual evidence directly from the player. You should always handle cases where data or screenshots fail, and combine both systems to create the most complete and immersive dispatch alerts possible.
GetScreenshotUrl
GetScreenshotUrl (Server-Side) lets you capture a screenshot from a specific player directly from the server and get a public URL. It requests the player’s client to take the screenshot, uploads it, and returns the link or nil if it fails. It requires a valid player source, a configured screenshot service, and can take a few seconds since it waits for the client response.
Basic Usage
Captures a screenshot from a target player and prints the result.
lua
RegisterCommand('servershot', function(source, args)
local target = tonumber(args[1]) or source
if not GetPlayerName(target) then
print("Player not found")
return
end
local url = exports['qs-police-creator']:GetScreenshotUrl(target)
if url then
print("Screenshot URL: " .. url)
else
print("Failed to capture screenshot")
end
end, true)
Safe Wrapper (Recommended)
Adds validation, timing, and error handling.
lua
local function CaptureScreenshot(target, cb)
if not target or not GetPlayerName(target) then
cb(nil)
return
end
local url = exports['qs-police-creator']:GetScreenshotUrl(target)
cb(url or nil)
end
RegisterNetEvent('request:screenshot')
AddEventHandler('request:screenshot', function(target)
local src = source
CaptureScreenshot(target, function(url)
if url then
TriggerClientEvent('chat:addMessage', src, { args = {"[Screenshot]", url} })
else
TriggerClientEvent('chat:addMessage', src, { args = {"[Error]", "Failed"} })
end
end)
end)
With Dispatch (Real Use Case)
Captures a player screenshot and attaches it to a dispatch call.
lua
RegisterCommand('dispatchwithshot', function(source)
local target = source
if not GetPlayerName(target) then return end
local url = exports['qs-police-creator']:GetScreenshotUrl(target)
local callData = {
title = 'Incident Reported',
description = 'See attached screenshot',
location = { coords = { x = 123.4, y = 567.8, z = 21.0 } },
jobNames = { 'police' },
image = url,
priority = 1
}
exports['qs-police-creator']:CreateDispatchCall(callData, source)
end, true)
This function is server-side only and requires a valid player source, since it depends on the client to capture the image. It can take a few seconds and blocks execution while waiting, so it should not be used in loops or spammed. You should always validate that the player exists before calling it and handle cases where it returns nil. When used correctly, it’s extremely powerful for logs, admin tools, and dispatch systems, especially when combined with other player data.
GetPlayerInfo
GetPlayerInfo (Server-Side) lets you retrieve detailed player, vehicle, and location data directly from the server using a player’s source. It’s useful for building dispatches, logs, and any system that needs player context without relying on client logic.
Basic Usage
Gets player info safely and prints coordinates.
lua
local info = GetPlayerInfo(source)
if not info then
print('GetPlayerInfo failed:', source)
return
end
print('Coords:', info.coords)
Street Formatting
Builds a proper street name including intersections.
lua
local info = GetPlayerInfo(source) or {}
local street = info.street_1 or 'Unknown'
if info.street_2 and info.street_2 ~= '' then
street = street .. ' / ' .. info.street_2
end
Vehicle Detection
Checks if the player is in a vehicle and prints details.
lua
local info = GetPlayerInfo(source) or {}
if info.vehicle then
print(info.vehicle_label, info.vehicle_plate, info.speed)
else
print('Player on foot')
end
Build Summary
Creates a simple readable summary for logs or dispatch.
lua
local info = GetPlayerInfo(source) or {}
local summary = 'On foot'
if info.vehicle_label then
summary = ('In %s [%s] at %d km/h'):format(
info.vehicle_label,
info.vehicle_plate or '???',
info.speed or 0
)
end
Full Safe Pattern (Recommended)
Handles all edge cases and builds a complete description.
lua
local info = GetPlayerInfo(source)
local coords = info and info.coords or GetEntityCoords(GetPlayerPed(source))
local street = info and info.street_1 or 'Unknown'
local vehicleText = ''
if info and info.vehicle_label then
vehicleText = (' Vehicle: %s [%s] (%d km/h)'):format(
info.vehicle_label,
info.vehicle_plate or '???',
info.speed or 0
)
end
local desc = ('Incident at %s.%s'):format(street, vehicleText)
This function is server-side and depends on the player being connected, so you should always validate the source before using it. You should never assume it returns data, and always check fields like vehicle before accessing them to avoid errors. It’s designed to simplify your code by replacing multiple native calls, and works especially well for dispatch systems, logs, and automated detections where you need clean and reliable player context.