Server Events

These are server-side events that zephyr_police emits via TriggerEvent. Hook into them from your own resource to react to duty changes, arrests, division updates, and more.


zephyr_police:server:onDuty

Fired when an officer successfully clocks in. Receives the officer’s source ID and their full officer data object.

AddEventHandler('zephyr_police:server:onDuty', function(src, officerData)
    print(('Officer %s (%s) is now on duty.'):format(officerData.name, src))
    -- Register the unit with your own tracking system here
end)

officerData fields:

FieldTypeDescription
namestringOfficer’s display name
jobstringJob name (e.g. "police")
gradenumberCurrent job grade
divisionstring|nilAssigned division ID, or nil if none
citizenidstringCharacter’s citizen ID

zephyr_police:server:offDuty

Fired when an officer clocks out, disconnects, or is forced off duty.

AddEventHandler('zephyr_police:server:offDuty', function(src, reason)
    print(('Officer %s went off duty. Reason: %s'):format(src, reason))
end)
ParameterTypeDescription
srcnumberServer source ID of the officer
reasonstringWhy they went off duty — see table below

Possible reason values:

ValueTrigger
"off_duty"Player manually clocked out
"forced_off_duty"Another resource called zephyr_police:server:forceOffDuty
"disconnect"Player dropped from the server
"job_change"Player’s job was changed to a non-police job
"job_switch"Multi-job switch away from police
"external_duty_off"External framework duty toggle (e.g. QBX SetJobDuty)

zephyr_police:server:forceOffDuty

An inbound server event you can trigger from any resource to force a specific officer off duty.

-- Force officer with server ID 5 off duty
TriggerEvent('zephyr_police:server:forceOffDuty', 5, 'custom_reason')
ParameterTypeDescription
targetSrcnumberServer source ID of the officer to force off duty
reasonstring(optional) Reason string passed to offDuty event

zephyr_police:server:divisionChanged

Fired when an officer’s division assignment is updated via the Org Suite or SetPlayerDivision export.

AddEventHandler('zephyr_police:server:divisionChanged', function(src, division, grade)
    print(('Officer %s assigned to division: %s (grade %s)'):format(src, division, grade))
end)
ParameterTypeDescription
srcnumberServer source ID of the officer
divisionstringDivision ID (e.g. "swat", "cid")
gradenumberDivision-specific grade rank

zephyr_police:server:logChargesToMDT

Fired internally after a successful jail sentence. Bridges charge data to the active MDT system (zephyr_mdt, ps-mdt, qb-mdt, etc.).

AddEventHandler('zephyr_police:server:logChargesToMDT', function(targetSrc, charges, officerSrc)
    -- charges: table array of charge objects
    -- Each charge: { name, fine, jail }
    for _, charge in ipairs(charges) do
        print(charge.name, charge.fine, charge.jail)
    end
end)
ParameterTypeDescription
targetSrcnumberServer source ID of the jailed suspect
chargestableArray of normalised charge objects (name, fine, jail)
officerSrcnumberServer source ID of the arresting officer

zephyr_police:server:dispatchArrest

Fired internally after a suspect is jailed. Used by dispatch_integration.lua to create a 10-15 dispatch call. You can hook this to log arrests externally.

AddEventHandler('zephyr_police:server:dispatchArrest', function(officerSrc, targetSrc, months)
    print(('Officer %s arrested player %s for %s months'):format(officerSrc, targetSrc, months))
end)
ParameterTypeDescription
officerSrcnumberArresting officer’s server source ID
targetSrcnumberJailed suspect’s server source ID
monthsnumberJail sentence in months

zephyr_police:server:trafficStopStarted

A registered net event fired by the client when an officer initiates a traffic stop. Creates a 10-38 call in zephyr_dispatch automatically.

-- You can hook this to log traffic stop data externally:
AddEventHandler('zephyr_police:server:trafficStopStarted', function()
    local src = source
    print(('Officer %s started a traffic stop'):format(src))
end)

Note: The plate parameter is provided internally by the client but the event is fired as a RegisterNetEvent. Hook it with AddEventHandler on the server.