Server Exports
All exports are available server-side from any resource using the standard FiveM export syntax:
exports.zephyr_police:ExportName(...)Duty & Player State
getPoliceOnline
Returns the count of currently on-duty officers.
local count = exports.zephyr_police:getPoliceOnline()
print(count .. ' officers on duty')Returns: number — total on-duty officer count.
getOnDutyOfficers
Returns the full onDutyOfficers table, keyed by server source ID.
local officers = exports.zephyr_police:getOnDutyOfficers()
for src, data in pairs(officers) do
print(src, data.name, data.job, data.grade, data.division, data.citizenid)
endReturns: table<number, OfficerData>
OfficerData fields:
| Field | Type | Description |
|---|---|---|
name | string | Officer’s display name |
job | string | Job name (e.g. "police") |
grade | number | Current job grade |
division | string|nil | Assigned division ID, or nil |
citizenid | string | Character citizen ID |
IsPlayerPolice
Returns true if the given player’s current job is in Config.PoliceJobs.
local isPolice = exports.zephyr_police:IsPlayerPolice(source)
if isPolice then
print('Player is police.')
end| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID |
Returns: boolean
IsPlayerOnDuty
Returns true if the given player is currently clocked in as a police officer.
local onDuty = exports.zephyr_police:IsPlayerOnDuty(source)| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID |
Returns: boolean
IsPlayerHandcuffed
Returns true if the given player has the cuffed statebag set to true.
local cuffed = exports.zephyr_police:IsPlayerHandcuffed(source)| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID |
Returns: boolean
IsPlayerInJail
Returns true if the given player has the inJail statebag set to true.
local inJail = exports.zephyr_police:IsPlayerInJail(source)| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID |
Returns: boolean
Handcuffs
ForceUncuffPlayer
Forcibly uncuffs a player, clears escort state, and fires the zephyr_police:forceUncuff client event on the suspect. Used internally by zephyr_mdt when releasing a person from a charge screen.
local success = exports.zephyr_police:ForceUncuffPlayer(targetSrc, officerSrc)| Parameter | Type | Description |
|---|---|---|
targetSrc | number | Server source ID of the cuffed player to release |
officerSrc | number | (optional) Server source ID of the releasing officer (clears escort state) |
Returns: boolean — true if the player was found and uncuffed.
Example — uncuff from MDT:
-- In your MDT or jail resource, release a suspect after processing
local released = exports.zephyr_police:ForceUncuffPlayer(suspectSrc, officerSrc)
if released then
TriggerClientEvent('ox_lib:notify', officerSrc, {
type = 'success',
description = 'Suspect released from cuffs.'
})
endDivisions
GetPlayerDivision
Returns the division ID currently assigned to the player’s character (async DB lookup).
local division = exports.zephyr_police:GetPlayerDivision(source)
-- e.g. "swat", "cid", "gd", or nil| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID |
Returns: string|nil — division ID, or nil if none assigned.
SetPlayerDivision
Sets a player’s division in the database, updates the live cache, and syncs statebags.
exports.zephyr_police:SetPlayerDivision(source, 'swat', 2)| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID |
division | string | Division ID (must match a key in Config.Divisions) |
grade | number | (optional) Division-specific rank/grade (default: 0) |
Returns: boolean — true on success.
Impound Integration
CreateTowRequest
Creates a police tow request via zephyr_impound or zephyr_connect.
local requestId, err = exports.zephyr_police:CreateTowRequest(source, {
plate = 'ABC123',
model = 'police',
reason = 'Abandoned vehicle',
location = 'Legion Square',
})
if not requestId then
print('Tow request failed: ' .. tostring(err))
end| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID of the requesting officer |
data | table | Request data (plate, model, reason, location, etc.) |
Returns: requestId (string|number) on success, or nil, errorMessage on failure.
CreateImpoundRequest
Creates a police impound request via zephyr_impound or zephyr_connect.
local requestId, err = exports.zephyr_police:CreateImpoundRequest(source, {
plate = 'XYZ789',
reason = 'Stolen vehicle',
})| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID of the requesting officer |
data | table | Request data (plate, reason, etc.) |
Returns: requestId (string|number) on success, or nil, errorMessage on failure.
Org Suite Permissions
HasOrgPermission
Returns true if the player has the specified org permission key based on their job grade.
local canAccess = exports.zephyr_police:HasOrgPermission(source, 'analytics_view')| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID |
permissionKey | string | Permission key (e.g. "hire_fire", "analytics_view", "division_manage") |
Returns: boolean
Built-in permission keys (configurable in Config.OrgActionGrades):
| Key | Default Grade |
|---|---|
hire_fire | 7 |
division_manage | 5 |
analytics_view | 3 |
equipment_manage | 9 |
vehicle_manage | 9 |
CanManageDivision
Returns true if the player has permission to manage a specific division.
local canManage = exports.zephyr_police:CanManageDivision(source, 'swat', 'division_manage')| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID |
divisionId | string | Division ID to check against |
permissionKey | string | (optional) Permission key (default: "division_manage") |
Returns: boolean
CanAccessEquipmentTier
Returns true if the player is allowed to access a specific equipment tier.
local canAccess = exports.zephyr_police:CanAccessEquipmentTier(source, 'tier_1')| Parameter | Type | Description |
|---|---|---|
src | number | Server source ID |
tierKey | string | Equipment tier key (defined in Config) |
Returns: boolean
Job Equipment
hasJobEquipmentAccess
Returns true if the player’s job is in the authorized jobs list for job equipment.
local hasAccess = exports.zephyr_police:hasJobEquipmentAccess(source)Returns: boolean
hasArmoryAccess
Returns true if the player’s job grants armoury access.
local canUseArmoury = exports.zephyr_police:hasArmoryAccess(source)Returns: boolean
hasMarshalAccess
Returns true if the player’s job is in the marshal jobs list.
local isMarshal = exports.zephyr_police:hasMarshalAccess(source)Returns: boolean