Exports and events
Public exports and events of Eleven Police MDT for FiveM: licenses, dispatch calls from other resources, responding units, suspensions and stolen cars.
Before you start
Every export on this page is server-side unless stated otherwise. An export is not a network event: a client cannot call it.
Licences
-- Grant (true) or revoke (false) a licence. `name` is a key of Config.Licenses.
exports['eleven-police']:SetLicense(citizenid, 'license_car', true)
-- Do they have it?
local has = exports['eleven-police']:HasLicense(citizenid, 'license_car')
They read and write in the same place as the file (Config.LicensesType). Useful for a driving school or any resource that issues its own licence.
Sending a call to dispatch
With the event
From a server script:
TriggerEvent('eleven_police:dispatch:add', {
type = 'call',
message = 'Robbery in progress at the jewellery store',
coords = vector3(-630.0, -236.0, 38.0),
location = 'Portola Dr', -- optional
categoryId = 'robo_establecimiento', -- optional
})
| Field | |
|---|---|
coords | Required. vector3 or { x, y, z } |
message | Call text (300 characters max) |
type | 'call' to classify it by keywords |
categoryId | Sets the category by its id in Config.Dispatch.categories |
location, plate, vehicleColor | Optional |
From a client the same table works with TriggerServerEvent, with limits: a minimum wait per player (20 s for a civilian, 3 s for police), trimmed texts and only the call, jewellry and panic types.
If you only have text and coordinates:
exports['eleven-police']:CreateEntorno(message, coords, src) -- also adds the street name
With the export, to follow the call
The event returns nothing. If you need to know which officers respond, create the call with the export:
local callId = exports['eleven-police']:AddDispatchAviso({
type = 'call', message = 'Hostage robbery', coords = coords, categoryId = 'robo_banco',
})
local r = exports['eleven-police']:GetAvisoOfficers(callId)
-- r.exists still in the list (not expired)
-- r.open not completed or skipped
-- r.officers = { { source, citizenid, name, rank, unit }, … }
AddDispatchAviso does not accept panic calls and waits until the call is saved before returning the id: call it from a thread (a handler or a CreateThread). A completed or skipped call releases its units, so its list comes back empty.
Officers
-- Do they have an active suspension?
local suspended = exports['eleven-police']:IsOfficerSuspended(citizenid)
-- Department of a job and grade
local name = exports['eleven-police']:GetDepartmentLabel('police', 3)
-- Does that job and grade have that tablet permission?
local can = exports['eleven-police']:hasTabletPermission('police', 3, 'citizens', 'view')
Stolen vehicle reports
With the stolenReports flag on, so the owner can report their vehicle from another resource (the phone, for example):
exports['eleven-police']:ReportStolenVehicle(citizenid, plate) -- { ok = true } or { ok = false, reason = … }
exports['eleven-police']:WithdrawStolenReport(citizenid, plate)
local reports = exports['eleven-police']:GetStolenReports(citizenid) -- { [plate] = time in ms }
Only the owner's own vehicles can be reported.
Radio (Patrolink)
The Patrolink (eleven_radio) hooks use them, but any resource can:
-- server
local callsign = exports['eleven-police']:GetOfficerCallsign(src) -- e.g. '10-ADAM-10', or nil (max 20 characters)
local isCommand = exports['eleven-police']:IsDispatcher(src) -- unit with dispatch permission
local sent = exports['eleven-police']:RadioCodeMessage(src, text) -- message to their division's radio chat
local isGrid = exports['eleven-police']:IsServiceChannel(channel) -- is it a tablet radio channel?
-- client
local ok = exports['eleven-police']:TriggerOfficerPanic({ location = 'Street', coords = coords }) -- officer PANIC
RadioCodeMessage and TriggerOfficerPanic only work for an on-duty officer, and PANIC has its own cooldown.
Tests run by other resources
The tablet does not run breathalyser tests or take fingerprints. If your server has those systems, it can store their results in the citizen file:
exports['eleven-police']:AddBreathTest({
citizenid = 'ABC12345', mgL = 0.31, -- required
legalLimit = 0.25, officer = 'Name', officerCitizenid = 'XYZ98765',
})
exports['eleven-police']:AddFingerprint({
citizenid = 'ABC12345', fingerprint = 'a1b2c3d4', -- required
result = 'new', -- 'new' or 'match'
officer = 'Name', officerCitizenid = 'XYZ98765',
})
They return the row id, or nil, reason. If you never call them, those tabs stay empty.
Events you can listen to
| Event | Side | When |
|---|---|---|
eleven_police:screenshots:toggleHUD | Client | When a capture is taken, to hide or show your HUD (receives true or false) |