Andrew's Duty Log
Overview
Andrew’s Duty Log is a FiveM resource designed for tracking duty time for players in various departments. It records when a player starts and stops duty and automatically submits a summary to a Discord webhook. This is ideal for roleplay servers with Law Enforcement, Fire Rescue, or other role-specific jobs.
Key Features:
Start/stop duty tracking with an in-game command.
Automatic calculation of duty duration.
Submission of duty logs to Discord via webhook.
Department and subdivision management.
Permission-based access to departments.
Customizable Discord formatting via webhook.
Script Workflow
1️⃣ Starting Duty
Player types the in-game command (e.g.,
/duty— configurable in the main script).The script:
Checks the player’s department permission.
Records the start time.
Marks the player as “on duty.”
2️⃣ Stopping Duty
Player types the same command again.
The script:
Calculates total duty duration.
Formats a Discord embed message.
Submits the log to the configured webhook.
Resets duty state for the player.
3️⃣ Automatic Department Verification
Each department has its own permission and subdivisions.
Players can only log duty for departments they are allowed to use.
Subdivision names are included in the Discord log for clarity.
Configuration
Config.lua Overview
Config Options
webhookURL
string
Discord webhook to which duty logs are sent. Replace with your server’s webhook.
allowedDepartments
table
Table of departments recognized by the system.
permission
string
ACE permission required to start duty for this department.
displayName
string
Friendly name shown in Discord embeds.
subdivisions
table
Subdivisions under the department, each with a name and displayName.
Example Departments
Tip: To add more departments, copy a block, change the
permission,displayName, and subdivisions.
In-Game Command Usage
Start Duty
/duty
Records start time, marks player on duty.
Stop Duty
/duty
Calculates duration, sends Discord log, resets state.
The actual command name is defined in the main script. Confirm your version if it differs.
Discord Webhook Logging
When a player stops duty, the script sends a formatted embed to the webhook:
Player Name
Department
Subdivision
Start Time
End Time
Total Duty Duration
Webhook Example:
Permissions System
Uses ACE permissions.
Players must have the department-specific permission to start/stop duty.
Example ACE permission setup in
server.cfg:
Replace
group.adminwith your server groups as needed.
Subdivisions
Departments can have multiple subdivisions.
Example:
Department: Law Enforcement
Subdivisions: SWAT, Detective
Subdivisions are recorded in Discord for clarity.
Players select subdivision automatically or via command arguments depending on implementation.
Adding New Departments/Subdivisions
Open
config.lua.Add a new entry under
Config.allowedDepartments:
Add ACE permissions for the department in
server.cfg.
Notes & Tips
Multiple duty sessions: Each start/stop is tracked individually.
Discord Webhook Security: Ensure your webhook URL is private.
Server Restart: Players on duty when the server restarts may lose session tracking — consider persistent storage if required.
Customization: You can edit embed colors, titles, and field formatting in the main Lua script.
Last updated