GKSHOP

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:

FieldTypeRequiredDescription
titlestringYesDispatch title
descriptionstringYesDescription / message body
codestringNoRadio code (e.g. 10-90)
prioritystringNo'high', 'medium', or 'low' (default: 'low')
locationstring or tableNoStreet label, or { label, coords }
coordsvector2/vector3/tableYes*{ x, y, z } — required for map blip
jobstringNo'police' or 'ambulance' (default: 'police')
timenumberNoUnix timestamp (default: os.time())
imagestringNoOptional image URL
soundstring | falseNoSound name or false to disable
fieldstable[]NoExtra rows: { icon, label, value? }
bliptableNo{ sprite?, color?, size?, shortRange?, label? }
isRadiusbooleanNoShow radius circle on map
radiusnumberNoRadius 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) — flat coords instead of a nested location, and accepts message as an alias for description. 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

ParameterTypeRequiredDescription
dispatchtableYesFull dispatch table (see schema above)

Returns

TypeDescription
numberDispatch 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

ParameterTypeRequiredDescription
idnumberYesDispatch ID
dispatchtableYesFields to update (title, description, priority, coords, responders, etc.)

Returns

TypeDescription
booleantrue if found and updated

RemoveDispatch

Remove a dispatch by ID and notify MDT clients.

exports['gks-tablet']:RemoveDispatch(dispatchId)

Returns

TypeDescription
booleantrue if removed

GetDispatch

Get a single active dispatch.

exports['gks-tablet']:GetDispatch(dispatchId)

Returns

TypeDescription
table | nilDispatch table or nil

GetDispatches

List all active dispatches, optionally filtered by job.

exports['gks-tablet']:GetDispatches(job)

Parameters

ParameterTypeRequiredDescription
jobstringNo'police' or 'ambulance' — omit for all

Returns

TypeDescription
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

ParameterTypeRequiredDescription
serialNumberstringYesWeapon serial number
datatableNo{ weaponName/model, owner, owner_id/ownerId, stolen? }

Returns

TypeDescription
number | falseWeapon record ID or false

GetPoliceCallsign

Get an officer's personal callsign from MDT personnel records.

exports['gks-tablet']:GetPoliceCallsign(identifier)

Returns

TypeDescription
string | nilCallsign

SetPoliceCallsign

Set or update an officer's callsign. Refreshes live map tracking and roster.

exports['gks-tablet']:SetPoliceCallsign(identifier, callsign, ignoreCallsignCheck)

Parameters

ParameterTypeRequiredDescription
identifierstringYesFramework identifier / citizenid
callsignstringYesNew callsign
ignoreCallsignCheckbooleanNoSkip validation (optional)

Returns

TypeDescription
booleantrue 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

TypeDescription
string | nilUnit name

GetUnits

List all units for a job.

exports['gks-tablet']:GetUnits(job)

Parameters

ParameterTypeDefaultDescription
jobstring'police''police' or 'ambulance'

Returns

TypeDescription
table[]{ name, status }

SetPlayerUnit

Assign an officer to a unit.

exports['gks-tablet']:SetPlayerUnit(source, job, unitName)

Returns

TypeDescription
booleantrue 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

TypeDescription
stringStatus or 'available'

GetOfficerCallsign

Get personal callsign for an online player from MDT personnel DB.

exports['gks-tablet']:GetOfficerCallsign(source)

Returns

TypeDescription
string | nilCallsign

Notifications

Send notifications to the tablet lockscreen (not Dynamic Island — that is GKSPHONE).

Notification Data Schema

FieldTypeDefaultDescription
titlestring"Notification"Title (required with message)
messagestring""Body text
appstring"System"Source app name

SendNotification

Send to one player.

exports['gks-tablet']:SendNotification(targetSource, data)

Returns

TypeDescription
booleantrue if delivered

BroadcastNotification

Send to all online players.

exports['gks-tablet']:BroadcastNotification(data)

Returns

TypeDescription
numberCount 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).

On this page