Server exports
Server-side exports for gks-tablet.
Dispatch
Active dispatches appear in Police/EMS MDT and the dispatch side panel.
Dispatch Table Schema
Full schema used by AddDispatch:
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Dispatch title |
description | string | Yes | Description / message body |
code | string | No | Radio code (e.g. 10-90) |
priority | string | No | 'high', 'medium', or 'low' (default: 'low') |
location | string or table | No | Street label, or { label, coords } |
coords | vector2/vector3/table | Yes* | { x, y, z } — required for map blip |
job | string | No | 'police' or 'ambulance' (default: 'police') |
time | number | No | Unix timestamp (default: os.time()) |
image | string | No | Optional image URL |
sound | string | false | No | Sound name or false to disable |
fields | table[] | No | Extra rows: { icon, label, value? } |
blip | table | No | { sprite?, color?, size?, shortRange?, label? } |
isRadius | boolean | No | Show radius circle on map |
radius | number | No | Radius in meters when isRadius is true |
AddDispatch
Create a dispatch using the full schema.
exports['gks-tablet']:AddDispatch(dispatch)Two thinner wrappers sit on top of this and end up in the same place:
createDispatch(data)— flatcoordsinstead of a nestedlocation, and acceptsmessageas an alias fordescription. Documented on Dispatch Integration; this is the one to use from a normal script.createDispatchLegacy(title, message, coords, code, sprite)— positional arguments, kept for older integrations.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dispatch | table | Yes | Full dispatch table (see schema above) |
Returns
| Type | Description |
|---|---|
| number | Dispatch ID (0 on invalid input) |
Example
local id = exports['gks-tablet']:AddDispatch({
title = "Shots Fired",
description = "Multiple reports near Legion Square",
code = "10-71",
priority = "high",
location = { label = "Legion Square", coords = vector3(195.0, -933.0, 30.0) },
job = "police",
blip = { sprite = 161, color = 1 },
})UpdateDispatch
Update an active dispatch (partial updates supported).
exports['gks-tablet']:UpdateDispatch(id, dispatch)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | number | Yes | Dispatch ID |
dispatch | table | Yes | Fields to update (title, description, priority, coords, responders, etc.) |
Returns
| Type | Description |
|---|---|
| boolean | true if found and updated |
RemoveDispatch
Remove a dispatch by ID and notify MDT clients.
exports['gks-tablet']:RemoveDispatch(dispatchId)Returns
| Type | Description |
|---|---|
| boolean | true if removed |
GetDispatch
Get a single active dispatch.
exports['gks-tablet']:GetDispatch(dispatchId)Returns
| Type | Description |
|---|---|
| table | nil | Dispatch table or nil |
GetDispatches
List all active dispatches, optionally filtered by job.
exports['gks-tablet']:GetDispatches(job)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
job | string | No | 'police' or 'ambulance' — omit for all |
Returns
| Type | Description |
|---|---|
| table[] | Array of dispatch tables |
UpdateResponderCallsign
Rename a responder callsign across all active dispatches (used when officers rename units or personal callsigns).
exports['gks-tablet']:UpdateResponderCallsign(oldCallsign, newCallsign)Returns
Nothing.
MDT Records
Create and manage Police MDT records from external resources. All write operations log to the MDT audit trail when source is a valid player.
RegisterWeapon
Register a weapon in the MDT weapons database.
exports['gks-tablet']:RegisterWeapon(serialNumber, data)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
serialNumber | string | Yes | Weapon serial number |
data | table | No | { weaponName/model, owner, owner_id/ownerId, stolen? } |
Returns
| Type | Description |
|---|---|
| number | false | Weapon record ID or false |
GetPoliceCallsign
Get an officer's personal callsign from MDT personnel records.
exports['gks-tablet']:GetPoliceCallsign(identifier)Returns
| Type | Description |
|---|---|
| string | nil | Callsign |
SetPoliceCallsign
Set or update an officer's callsign. Refreshes live map tracking and roster.
exports['gks-tablet']:SetPoliceCallsign(identifier, callsign, ignoreCallsignCheck)Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
identifier | string | Yes | Framework identifier / citizenid |
callsign | string | Yes | New callsign |
ignoreCallsignCheck | boolean | No | Skip validation (optional) |
Returns
| Type | Description |
|---|---|
| boolean | true on success |
GetPoliceAvatar
Profile picture stored for an officer in gks_mdt_personnel.
--- @param identifier string Framework identifier / citizenid
--- @return string|nil Avatar URL, or nil when the officer has none
local avatar = exports['gks-tablet']:GetPoliceAvatar(identifier)CreatePoliceReport
--- @param source number Author. Their identifier and character name are stored on the report
--- @param report table
--- title string required
--- description string required. Alias: details
--- suspects table optional, involved citizens
--- officers table optional, involved officers
--- civilians table optional
--- gallery table optional, evidence image URLs
--- @return number|false reportId, string|nil reason
local id, err = exports['gks-tablet']:CreatePoliceReport(source, {
title = "Armed Robbery — 24/7",
description = "Suspect fled north on Grove St.",
suspects = { "char1:abc123" },
gallery = { "https://example.com/evidence1.png" },
})Fails with "Missing title or description" if either is absent. Writes an audit log entry and refreshes every open dashboard.
UpdatePoliceReport
Partial update — only the fields you pass are written.
--- @param source number
--- @param data table id required; title, description/details, suspects, officers, civilians, gallery optional
--- @return number|false reportId, string|nil reason
exports['gks-tablet']:UpdatePoliceReport(source, {
id = 42,
gallery = { "https://example.com/evidence2.png" },
})Passing only id is a no-op and returns that id unchanged.
GetPoliceReport
--- @param reportId number
--- @return table|nil
local report = exports['gks-tablet']:GetPoliceReport(42)
-- {
-- id, title, description, officer_name, created_at,
-- suspects = {}, officers = {}, civilians = {}, gallery = {}
-- }The JSON columns come back decoded as tables.
DeletePoliceReport
--- @param id number
--- @return boolean false when no row matched
local ok = exports['gks-tablet']:DeletePoliceReport(42)Units and Callsigns
In-memory unit management for Police and EMS MDT. Units affect dispatch responder names on the live map.
GetPlayerUnit
Get the unit name assigned to an online officer.
exports['gks-tablet']:GetPlayerUnit(source)Returns
| Type | Description |
|---|---|
| string | nil | Unit name |
GetUnits
List all units for a job.
exports['gks-tablet']:GetUnits(job)Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
job | string | 'police' | 'police' or 'ambulance' |
Returns
| Type | Description |
|---|---|
| table[] | { name, status } |
SetPlayerUnit
Assign an officer to a unit.
exports['gks-tablet']:SetPlayerUnit(source, job, unitName)Returns
| Type | Description |
|---|---|
| boolean | true on success |
ResetPlayerUnit
Remove an officer from their current unit.
exports['gks-tablet']:ResetPlayerUnit(source)CreateUnit / RemoveUnit / SetUnitStatus / RenameUnit
exports['gks-tablet']:CreateUnit(job, name, status)
exports['gks-tablet']:RemoveUnit(job, name)
exports['gks-tablet']:SetUnitStatus(job, name, status)
exports['gks-tablet']:RenameUnit(job, oldName, newName)CreateUnit default status is 'station'. RenameUnit updates dispatch responders for all officers in the unit.
GetPlayerUnitStatus
Get unit status by identifier (works offline).
exports['gks-tablet']:GetPlayerUnitStatus(identifier)Returns
| Type | Description |
|---|---|
| string | Status or 'available' |
GetOfficerCallsign
Get personal callsign for an online player from MDT personnel DB.
exports['gks-tablet']:GetOfficerCallsign(source)Returns
| Type | Description |
|---|---|
| string | nil | Callsign |
Notifications
Send notifications to the tablet lockscreen (not Dynamic Island — that is GKSPHONE).
Notification Data Schema
| Field | Type | Default | Description |
|---|---|---|---|
title | string | "Notification" | Title (required with message) |
message | string | "" | Body text |
app | string | "System" | Source app name |
SendNotification
Send to one player.
exports['gks-tablet']:SendNotification(targetSource, data)Returns
| Type | Description |
|---|---|
| boolean | true if delivered |
BroadcastNotification
Send to all online players.
exports['gks-tablet']:BroadcastNotification(data)Returns
| Type | Description |
|---|---|
| number | Count of players notified |
SendJobNotification
Send to all players with a specific job name.
exports['gks-tablet']:SendJobNotification(jobName, data)Example
exports['gks-tablet']:SendJobNotification("police", {
title = "MDT",
message = "New priority dispatch available.",
})SendNotificationToPlayers
Send to a list of server IDs.
exports['gks-tablet']:SendNotificationToPlayers({ 1, 2, 3 }, data)Tablet Management
Database operations for tablet records (gks_tablet table).
GetTabletByUniqID
exports['gks-tablet']:GetTabletByUniqID(uniqId)Returns full tablet row with parsed settings JSON, or nil.
GetTabletByPlayerIdentifier
exports['gks-tablet']:GetTabletByPlayerIdentifier(identifier)Lookup by framework identifier (citizenid / license).

