zephyr_policeExportsServer

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)
end

Returns: table<number, OfficerData>

OfficerData fields:

FieldTypeDescription
namestringOfficer’s display name
jobstringJob name (e.g. "police")
gradenumberCurrent job grade
divisionstring|nilAssigned division ID, or nil
citizenidstringCharacter 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
ParameterTypeDescription
srcnumberServer 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)
ParameterTypeDescription
srcnumberServer 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)
ParameterTypeDescription
srcnumberServer 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)
ParameterTypeDescription
srcnumberServer 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)
ParameterTypeDescription
targetSrcnumberServer source ID of the cuffed player to release
officerSrcnumber(optional) Server source ID of the releasing officer (clears escort state)

Returns: booleantrue 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.'
    })
end

Divisions

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
ParameterTypeDescription
srcnumberServer 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)
ParameterTypeDescription
srcnumberServer source ID
divisionstringDivision ID (must match a key in Config.Divisions)
gradenumber(optional) Division-specific rank/grade (default: 0)

Returns: booleantrue 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
ParameterTypeDescription
srcnumberServer source ID of the requesting officer
datatableRequest 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',
})
ParameterTypeDescription
srcnumberServer source ID of the requesting officer
datatableRequest 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')
ParameterTypeDescription
srcnumberServer source ID
permissionKeystringPermission key (e.g. "hire_fire", "analytics_view", "division_manage")

Returns: boolean

Built-in permission keys (configurable in Config.OrgActionGrades):

KeyDefault Grade
hire_fire7
division_manage5
analytics_view3
equipment_manage9
vehicle_manage9

CanManageDivision

Returns true if the player has permission to manage a specific division.

local canManage = exports.zephyr_police:CanManageDivision(source, 'swat', 'division_manage')
ParameterTypeDescription
srcnumberServer source ID
divisionIdstringDivision ID to check against
permissionKeystring(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')
ParameterTypeDescription
srcnumberServer source ID
tierKeystringEquipment 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