cobalt_police
Restraints, jail, dispatch and the police MDT.
| Export | Side | What it does |
|---|---|---|
IsCuffed | Server | True when the player is cuffed or zip-tied. |
Cuff | Server | Restrains a player with no item, range or job check. |
Uncuff | Server | Removes restraints with no checks and no item returned. |
SendDispatch | Server | Sends a call to on-duty police or EMS and returns its id. |
GetCalls | Server | Calls the player can see: police calls for officers, EMS calls for EMS, newest first, open and closed. |
GetCall | Server | One call by id, open or closed. |
RespondToCall | Server | Adds the player to an open call's responders. |
AssignToCall | Server | Adds responders to an open call, skipping ones already on it. |
LeaveCall | Server | Takes the player off a call's responders. |
AddCallNote | Server | Adds a note to a call, signed with the player's name. |
CloseCall | Server | Closes a call. |
UseMdt | Server | The mdt_tablet item's server export. |
UseTape | Server | The tape_kit item's server export. |
UseRestraint | Client | The handcuffs and zipties items' client export. |
OpenMdt | Server | Opens the MDT for a player with access, optionally on a page or citizen profile. |
IsCuffed
ServerTrue when the player is cuffed or zip-tied.
exports.cobalt_police:IsCuffed(source)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_police:IsCuffed(source)Cuff
ServerRestrains a player with no item, range or job check. False when they are already restrained.
exports.cobalt_police:Cuff(target, cuffType, by)| Parameter | Type | Optional | Description |
|---|---|---|---|
target | integer | No | |
cuffType | PoliceCuffType | Yes | defaults to 'cuffs' |
by | string | Yes | recorded as whoever applied them |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_police:Cuff(source, 'cuffs', 'ABC12345')Uncuff
ServerRemoves restraints with no checks and no item returned. False when the player wasn't restrained.
exports.cobalt_police:Uncuff(target)| Parameter | Type | Optional | Description |
|---|---|---|---|
target | integer | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_police:Uncuff(source)SendDispatch
ServerSends a call to on-duty police or EMS and returns its id. Fires cobalt_police:dispatchSent.
exports.cobalt_police:SendDispatch(data)| Parameter | Type | Optional | Description |
|---|---|---|---|
data | PoliceDispatchInput | No |
| Returns | Description |
|---|---|
integer? |
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
ServerCalls the player can see: police calls for officers, EMS calls for EMS, newest first, open and closed.
exports.cobalt_police:GetCalls(source)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No |
| Returns | Description |
|---|---|
PoliceCall[] |
local calls = exports.cobalt_police:GetCalls(source)GetCall
ServerOne call by id, open or closed.
exports.cobalt_police:GetCall(id)| Parameter | Type | Optional | Description |
|---|---|---|---|
id | integer | No |
| Returns | Description |
|---|---|
PoliceCall? |
local call = exports.cobalt_police:GetCall(1)RespondToCall
ServerAdds the player to an open call's responders. Fires cobalt_police:callResponded.
exports.cobalt_police:RespondToCall(source, id)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No | |
id | integer | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_police:RespondToCall(source, 1)AssignToCall
ServerAdds responders to an open call, skipping ones already on it.
exports.cobalt_police:AssignToCall(id, members)| Parameter | Type | Optional | Description |
|---|---|---|---|
id | integer | No | |
members | PoliceCallResponder[] | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_police:AssignToCall(
1,
{ { citizenid = 'ABC12345', name = 'John Doe', callsign = '1-ADAM-12' } }
)LeaveCall
ServerTakes the player off a call's responders.
exports.cobalt_police:LeaveCall(source, id)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No | |
id | integer | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_police:LeaveCall(source, 1)AddCallNote
ServerAdds 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)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No | |
id | integer | No | |
text | string | No | |
typed | boolean | Yes |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_police:AddCallNote(source, 1, 'Suspect fled north on foot', true)CloseCall
ServerCloses a call. False when it is already closed.
exports.cobalt_police:CloseCall(id)| Parameter | Type | Optional | Description |
|---|---|---|---|
id | integer | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_police:CloseCall(1)UseMdt
ServerThe 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)| Parameter | Type | Optional | Description |
|---|---|---|---|
event | 'usingItem' | 'usedItem' | No | |
item | table | No | |
inventory | table | No |
exports.cobalt_police:UseMdt(
'usingItem',
{ name = 'mdt_tablet' },
{ id = 'ABC12345', source = source }
)UseTape
ServerThe tape_kit item's server export. On usedItem it starts placing police tape when the player may.
exports.cobalt_police:UseTape(event, item, inventory)| Parameter | Type | Optional | Description |
|---|---|---|---|
event | 'usingItem' | 'usedItem' | No | |
item | table | No | |
inventory | table | No |
exports.cobalt_police:UseTape(
'usingItem',
{ name = 'police_tape' },
{ id = 'ABC12345', source = source }
)UseRestraint
ClientThe 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)| Parameter | Type | Optional | Description |
|---|---|---|---|
event | 'usingItem' | 'usedItem' | No | |
item | table | No |
exports.cobalt_police:UseRestraint('usingItem', { name = 'handcuffs' })OpenMdt
ServerOpens the MDT for a player with access, optionally on a page or citizen profile.
exports.cobalt_police:OpenMdt(source, page, citizenid)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No | |
page | PoliceMdtPage | Yes | |
citizenid | string | Yes |
exports.cobalt_police:OpenMdt(source, 'dashboard', 'ABC12345')