Skip to Content
Cobalt

cobalt_police

Restraints, jail, dispatch and the police MDT.

ExportSideWhat it does
IsCuffedServerTrue when the player is cuffed or zip-tied.
CuffServerRestrains a player with no item, range or job check.
UncuffServerRemoves restraints with no checks and no item returned.
SendDispatchServerSends a call to on-duty police or EMS and returns its id.
GetCallsServerCalls the player can see: police calls for officers, EMS calls for EMS, newest first, open and closed.
GetCallServerOne call by id, open or closed.
RespondToCallServerAdds the player to an open call's responders.
AssignToCallServerAdds responders to an open call, skipping ones already on it.
LeaveCallServerTakes the player off a call's responders.
AddCallNoteServerAdds a note to a call, signed with the player's name.
CloseCallServerCloses a call.
UseMdtServerThe mdt_tablet item's server export.
UseTapeServerThe tape_kit item's server export.
UseRestraintClientThe handcuffs and zipties items' client export.
OpenMdtServerOpens the MDT for a player with access, optionally on a page or citizen profile.

IsCuffed

Server

True when the player is cuffed or zip-tied.

exports.cobalt_police:IsCuffed(source)
ParameterTypeOptionalDescription
sourceintegerNo
ReturnsDescription
boolean
Example
local ok = exports.cobalt_police:IsCuffed(source)

Cuff

Server

Restrains a player with no item, range or job check. False when they are already restrained.

exports.cobalt_police:Cuff(target, cuffType, by)
ParameterTypeOptionalDescription
targetintegerNo
cuffTypePoliceCuffTypeYesdefaults to 'cuffs'
bystringYesrecorded as whoever applied them
ReturnsDescription
boolean
Example
local ok = exports.cobalt_police:Cuff(source, 'cuffs', 'ABC12345')

Uncuff

Server

Removes restraints with no checks and no item returned. False when the player wasn't restrained.

exports.cobalt_police:Uncuff(target)
ParameterTypeOptionalDescription
targetintegerNo
ReturnsDescription
boolean
Example
local ok = exports.cobalt_police:Uncuff(source)

SendDispatch

Server

Sends a call to on-duty police or EMS and returns its id. Fires cobalt_police:dispatchSent.

exports.cobalt_police:SendDispatch(data)
ParameterTypeOptionalDescription
dataPoliceDispatchInputNo
ReturnsDescription
integer?
Example
local value = exports.cobalt_police:SendDispatch(
    { title = 'Shots fired', code = '10-71', description = 'Several shots near the gas station', coords = vector3(-47.3, -1757.5, 29.4), priority = 1 }
)

GetCalls

Server

Calls the player can see: police calls for officers, EMS calls for EMS, newest first, open and closed.

exports.cobalt_police:GetCalls(source)
ParameterTypeOptionalDescription
sourceintegerNo
ReturnsDescription
PoliceCall[]
Example
local calls = exports.cobalt_police:GetCalls(source)

GetCall

Server

One call by id, open or closed.

exports.cobalt_police:GetCall(id)
ParameterTypeOptionalDescription
idintegerNo
ReturnsDescription
PoliceCall?
Example
local call = exports.cobalt_police:GetCall(1)

RespondToCall

Server

Adds the player to an open call's responders. Fires cobalt_police:callResponded.

exports.cobalt_police:RespondToCall(source, id)
ParameterTypeOptionalDescription
sourceintegerNo
idintegerNo
ReturnsDescription
boolean
Example
local ok = exports.cobalt_police:RespondToCall(source, 1)

AssignToCall

Server

Adds responders to an open call, skipping ones already on it.

exports.cobalt_police:AssignToCall(id, members)
ParameterTypeOptionalDescription
idintegerNo
membersPoliceCallResponder[]No
ReturnsDescription
boolean
Example
local ok = exports.cobalt_police:AssignToCall(
    1,
    { { citizenid = 'ABC12345', name = 'John Doe', callsign = '1-ADAM-12' } }
)

LeaveCall

Server

Takes the player off a call's responders.

exports.cobalt_police:LeaveCall(source, id)
ParameterTypeOptionalDescription
sourceintegerNo
idintegerNo
ReturnsDescription
boolean
Example
local ok = exports.cobalt_police:LeaveCall(source, 1)

AddCallNote

Server

Adds a note to a call, signed with the player's name. Pass typed for a note the player wrote, so the note cooldown applies; system notes leave it out.

exports.cobalt_police:AddCallNote(source, id, text, typed)
ParameterTypeOptionalDescription
sourceintegerNo
idintegerNo
textstringNo
typedbooleanYes
ReturnsDescription
boolean
Example
local ok = exports.cobalt_police:AddCallNote(source, 1, 'Suspect fled north on foot', true)

CloseCall

Server

Closes a call. False when it is already closed.

exports.cobalt_police:CloseCall(id)
ParameterTypeOptionalDescription
idintegerNo
ReturnsDescription
boolean
Example
local ok = exports.cobalt_police:CloseCall(1)

UseMdt

Server

The mdt_tablet item's server export. On usedItem it opens the police MDT, or cobalt_ambulancejob's for EMS without police access.

exports.cobalt_police:UseMdt(event, item, inventory)
ParameterTypeOptionalDescription
event'usingItem' | 'usedItem'No
itemtableNo
inventorytableNo
Example
exports.cobalt_police:UseMdt(
    'usingItem',
    { name = 'mdt_tablet' },
    { id = 'ABC12345', source = source }
)

UseTape

Server

The tape_kit item's server export. On usedItem it starts placing police tape when the player may.

exports.cobalt_police:UseTape(event, item, inventory)
ParameterTypeOptionalDescription
event'usingItem' | 'usedItem'No
itemtableNo
inventorytableNo
Example
exports.cobalt_police:UseTape(
    'usingItem',
    { name = 'police_tape' },
    { id = 'ABC12345', source = source }
)

UseRestraint

Client

The handcuffs and zipties items' client export. On usedItem it restrains the nearest player on foot in front of the player, within itemRange meters, with the same rules as the Cuff and Tie hands target options. Handcuffs need a police job, and zipties need a target with their hands up.

exports.cobalt_police:UseRestraint(event, item)
ParameterTypeOptionalDescription
event'usingItem' | 'usedItem'No
itemtableNo
Example
exports.cobalt_police:UseRestraint('usingItem', { name = 'handcuffs' })

OpenMdt

Server

Opens the MDT for a player with access, optionally on a page or citizen profile.

exports.cobalt_police:OpenMdt(source, page, citizenid)
ParameterTypeOptionalDescription
sourceintegerNo
pagePoliceMdtPageYes
citizenidstringYes
Example
exports.cobalt_police:OpenMdt(source, 'dashboard', 'ABC12345')

On this page