Shift Logs
The Shift Log System automatically tracks and monitors officer duty status, documenting their active hours, shift counts, and optional summary notes when clocking off. Management can review these records to monitor department activity and performance.
Technical Features
- Duty Monitoring: Hooks directly into the framework duty status changes via the
kartik-policejob:bridge:dutyChangedevent. - Lingering Shift Auto-Closure:
- Auto-closes active shifts if an officer disconnects from the server (
playerDroppedhandler). - Auto-ends lingering active shifts on server restarts with the note: "Shift auto-ended on server restart".
- Auto-closes old shifts if a new clock-in occurs without a proper clock-out.
- Auto-closes active shifts if an officer disconnects from the server (
- Auto-Heal Recovery: If an officer is marked as on-duty in the framework but lacks an active shift database row, the system automatically inserts one to maintain log integrity.
- Custom Notes Support: Allows officers to provide a summary of their activities when clocking off (e.g., arrests made, citations issued, general notes).
- Aggregated Stats: Generates career total hours and shift counts for both individual officers and the management dashboard.
- Access Control: Reviewing officer logs requires the
shift_logspermission flag, which can be restricted to management roles inshared/perms.lua.
Database Schema
Logs are persisted in the police_shift_logs table with the following structure:
| Column | Type | Description |
|---|---|---|
id | INT (AUTO_INCREMENT) | Unique ID of the shift log entry |
citizenid | VARCHAR | Unique identifier of the officer |
name | VARCHAR | Character name of the officer |
job | VARCHAR | Job/Department name |
clock_in | DATETIME | Timestamp when duty started |
clock_out | DATETIME | Timestamp when duty ended |
duration | INT | Shift length in seconds |
notes | TEXT | Summary notes submitted by the officer |
Server Callbacks & API
The system exposes the following endpoints for the client and UI integrations:
kartik-policejob:shiftlog:getMyStats- Fetches the active officer's career stats (total shifts, total hours) and recent history (last 50 shifts).
kartik-policejob:shiftlog:getOfficerLogs- (Requires
shift_logspermission) Fetches aggregated shift durations and total counts for all officers within the department.
- (Requires
kartik-policejob:shiftlog:getOfficerHistory- (Requires
shift_logspermission) Retrieves the detailed shift log history (last 50 shifts) for a specific officer bycitizenid.
- (Requires
kartik-policejob:shiftlog:clockOffWithNotes- Saves the final summary notes and clocks the officer off duty synchronously.
Restraints & Compliance
This module handles physical control over suspects, featuring realistic handcuffs, zipties, escorts, player compliance anims, and physical tackle mechanics.
Surveillance Drone
The Surveillance Drone is a highly advanced tactical tool that allows officers to deploy a flyable quadcopter to scan rooftops, spy on barricaded suspects, search dark areas, and transport small items.