Exports and hooks
For FiveM developers: the speed camera OnFine hook, AddCivilPanic, isCuffed, lockpick alert, alcohol reading, AddBreathTest, AddFingerprint and locker exports.
Before you start
The tablet's exports and events (licences, dispatch calls from another resource, responding officers, suspensions, stolen vehicle reports, radio, hasTabletPermission) are the same as in the MDT. See MDT exports and events.
This page covers the street module hooks. The resource is always called eleven-police.
Speed cameras: OnFine
Server. Decides who pays a speed camera fine. It goes in Config.Radars in your config.lua; the keys you leave out (ExemptJobs, MaxDistanceMargin) keep their default. See Vehicles and air.
Config.Radars = {
OnFine = function(fine)
-- fine.plate, fine.amount, fine.ownerCitizenId, fine.driver (player id),
-- fine.driverCitizenId, fine.speed, fine.limit, fine.radarId...
return nil
end,
}
| Returns | What happens |
|---|---|
true | You charge it yourself: it is not billed |
A citizenid ('CID123') | It is billed to that citizen |
nil | It is billed to the vehicle owner |
It can change fine.amount before returning. It runs inside a pcall: if it errors, the error shows in the console and the fine goes to the owner.
For your logs, the server event always fires, with fine.billedTo and fine.handled telling you how it ended:
AddEventHandler('eleven_police:radar:fine', function(fine)
print(fine.plate, fine.amount, fine.billedTo, fine.handled)
end)
Panic button
AddCivilPanic
Server. Raises the same PANIC call as the civilian panic button, with its blip that follows the player. For example, from the emergency button of a radio held by a civilian. It needs the tablet dispatch turned on.
local ok = exports['eleven-police']:AddCivilPanic(src, message, location, coords, opts)
| Parameter | What it is |
|---|---|
src | ID of the player who pressed it: the blip follows them |
message | Call text |
location | Place text (the street) |
coords | vector3 where it was pressed |
opts | Optional: { trackSeconds = 60, trackIntervalMs = 3000 } |
Returns true if the call was created.
Button registry
Server. With Config.PanicButton.Registro = 'my-resource', only the buttons your resource approves raise the alert. Your resource exports:
-- Return a table to raise the alert, or nil to stay silent.
exports('GetPanicButton', function(serial)
return { message = 'Central Bank panic', place = nil, holder = 'Central Bank',
delay_seconds = 0, track_seconds = 60, track_interval = 3000, cooldown_seconds = 60 }
end)
-- Optional: told about every press.
exports('RegisterPanicUse', function(serial, data) end)
Every field of the table is optional. To read the starting values from your resource: exports['eleven-police']:GetPanicButtonDefaults().
Cuffed (isCuffed)
Server and client. The server publishes on each player's statebag whether they are cuffed:
-- server
local cuffed = Player(src).state.isCuffed -- true / nil
local front = Player(src).state.cuffFront -- true if cuffed in front
-- client
if LocalPlayer.state.isCuffed then
-- e.g. do not open the phone
end
Only the server writes it. If a client changes it on its own statebag, it is restored to the real state.
Lockpick alert
Client → server. There is no automatic alert: it only arrives if your keys or lockpick resource fires this event from its client, on every door lockpick attempt:
local model = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)))
local plate = GetVehicleNumberPlateText(vehicle)
TriggerServerEvent('eleven_police:police:server:intentoForzarVehiculo',
{ model = model, plate = plate }, GetEntityCoords(vehicle))
| Parameter | What it is |
|---|---|
| 1st | The { model = ..., plate = ... } table (the server builds the text in its language) or a ready-made text (cleaned of ^n and <> and cut to 200 characters) |
| 2nd | The vehicle coordinates. If they are more than 100 m from the player, the player's are used |
The server builds the Code 37 call with the street and allows one alert every 15 seconds per player. It needs forzarPuertas and dispatch turned on. See Arrests.
Alcohol reading
Server. So your drinks system can push the reading the breathalyser sees without touching any list. They take the player ID or their citizenid; the reading is in mg/L of exhaled air.
exports['eleven-police']:addBreathAlcohol(src, 0.10) -- add
exports['eleven-police']:setBreathAlcohol(src, 0.35) -- set
exports['eleven-police']:clearBreathAlcohol(src) -- reset to zero
local mgL = exports['eleven-police']:getBreathAlcohol(src)
They act on the reading the resource keeps itself (the 'interno' branch of Config.AlcoholType). If your resource provides the reading, use Config.AlcoholType = 'my-resource' or Config.AlcoholAdapter instead. See Evidence.
Tests on the file: AddBreathTest and AddFingerprint
Server. So another resource (your own breathalyser or your identification system) can write a test to the Breathalyser and Fingerprints tabs of the citizen file, on top of the ones the Evidence modules run. They are exports, not events: a client cannot call them.
local id, reason = exports['eleven-police']:AddBreathTest({
citizenid = 'ABC12345', -- required
mgL = 0.31, -- required: mg/L of exhaled air (0 to 9.99)
legalLimit = 0.12, -- optional: AlcoholConfig.LEGAL_LIMIT by default
officer = 'Name', -- optional: "Officer" by default (per locale)
officerCitizenid = 'XYZ98765', -- optional
})
local id, reason = exports['eleven-police']:AddFingerprint({
citizenid = 'ABC12345', -- required
fingerprint = 'a1b2c3d4', -- required: the identifier the file shows (max. 50)
result = 'new', -- optional: 'new' (first record, the default) or 'match'
regDate = '21/11/2026', -- optional: date of the first record
officer = 'Name', -- optional
officerCitizenid = 'XYZ98765', -- optional
})
- Both take a table and return the id of the saved row, or
niland a reason:'bad_request','bad_citizenid','bad_mgL','bad_legalLimit','bad_fingerprint'or'db_error'. They never throw. AddBreathTestmarks the test as positive ifmgLis abovelegalLimit. If you leavelegalLimitout, it usesAlcoholConfig.LEGAL_LIMIT(0.12 by default).- They do not check that the citizen exists and do not depend on the
alcoholemiaorhuellasflags.
Pistol locker
Server. For your own admin panel. A client cannot call them: whoever calls them applies their own permission check.
| Export | What it does |
|---|---|
ArmeroAdminData() | Lists the lockers: id, name, position, slots, officers, pistols, whether in use |
ArmeroDetalle(id) | Contents and history of a locker |
ArmeroGuardar(data, who) | Creates (without data.id) or changes a locker: nombre, x, y, z, h, huecos |
ArmeroBorrar(id, force) | Deletes a locker. With contents only if force is true |
ArmeroWhitelistGuardar(list) | Changes the weapon whitelist. Empty, it goes back to Config.Armero.Pistolas |
They return true, result or false, error ('not_found', 'in_use', 'has_content'…).
Wardrobes
Client. To open the wardrobe menus from another resource (a radial menu, for example):
exports['eleven-police']:OpenMasterLocker('station') -- the wardrobe menu; the key is the Config.Wardrobes one
exports['eleven-police']:OpenPolicePresets() -- uniform templates only
Helicopter fuel
There is no export: the level is in the replicated fuel entity statebag (0-100) and in the GTA engine. If your system changes fuelRev on the statebag when refuelling or draining, its level wins. See Vehicles and air.