Guardian Duty Menu - Installation
Guardian Duty System - Setup Instructions
1. Database Setup Ensure you have a MySQL or MariaDB database ready. Then, create a table for duty logs using the following SQL command:
CREATE TABLE IF NOT EXISTS duty_hours (
discord_id VARCHAR(255) NOT NULL PRIMARY KEY,
department VARCHAR(255) NOT NULL,
total_time INT DEFAULT 0,
last_updated INT UNSIGNED NOT NULL DEFAULT 0
);
CREATE TABLE IF NOT EXISTS active_users (
discord_id VARCHAR(255) NOT NULL PRIMARY KEY,
department VARCHAR(255) NOT NULL,
last_clock_in DATETIME,
location VARCHAR(255)
);
Put this in your server.cfg ( Change everything to your databases information )
set gd_dbHost "localhost"
set gd_dbUser "root"
set gd_dbPassword ""
set gd_dbName "department_hours"
2. Configuring the Database and the bot
Go inside the Duty_Manager_Bot File
Click on .env file ( If you don't have one make one and put this in it and fill it out )
BOT_TOKEN=
DB_HOST=
DB_USER=
DB_PASSWORD=
DB_NAME=
3. Configuring the Script
Open the config.lua file and set up your database credentials.
Update the
Config.Webhook
variable with your Discord webhook URL.Define your department permissions under
departmentPermissions
.Add more departments if you wish under
Config.Departments
.Add more department logs under
Config.DepartmentLogos
.
// Ace Perms examples
add_ace group.owner command.duty allow // this ace gives you access to /duty
add_ace group.owner dhs.duty allow // this ace gives you access to DHS in the Departments Selections
4. Installing the Script
Place the Guardian Duty Menu folder inside your FiveM server’s
resources
directory.Add
ensure GuardianDutyMenu
to yourserver.cfg
file.Download if not already ox_lib here
ensure ox_lib
to yourserver.cfg
file.
Violet Menu Colors if you want
(Put this in your server.cfg)
setr ox:primaryColor violet
setr ox:primaryShade 4
setr ox:userLocales 1
5. Usage Instructions
Players can go On Duty or Off Duty using the
/duty
command.If required, a permission check ensures only authorized personnel can access specific departments.
Duty status updates are logged in the database and sent to a Discord webhook.
6. Troubleshooting
If the database isn’t recording duty logs, ensure your database connection is properly configured.
Check the server console for errors and verify that
mysql-async
oroxmysql
is installed.If Discord logging isn’t working, confirm the webhook URL is correct.
Last updated