Guardian Notification - Installation

Installation Guide: Guardian-Notification

This guide will walk you through the steps to properly install and use the Guardian-Notification resource on your FiveM server.


Step 1: Place the Resource Folder

First, place the Guardian-Notification folder directly into your server's resources directory.

your-server-folder/
└── resources/
    ├── Guardian-Notification/
    │   ├── client.lua
    │   ├── fxmanifest.lua
    │   └── html/
    │       ├── index.html
    └── ... (other resources)

Step 2: Start the Resource

Next, open your server.cfg file (located in the main server folder) and add the following line to ensure the resource is started when your server boots up. It's recommended to place it with your other NUI resources.

Code snippet

# Starts the Guardian Notification resource
ensure Guardian-Notification

Step 3: Using the Notification System

Guardian-Notification is now installed and ready to be used by any other script on your server. You can send a notification from any client-side script by using its export.

The syntax for the export call is as follows:

Lua

exports['Guardian-Notification']:GuardianNotify(data)

The data variable is a table containing all the details for the notification.

Example Usage:

You can copy and paste this example into any client-side script to test it:

Lua

-- Example call to send a 'success' notification
exports['Guardian-Notification']:GuardianNotify({
    title = "Server Info",
    message = "Welcome to the server! Hope you enjoy your stay.",
    type = "success",       -- Can be 'success', 'error', 'info','warning', 'general', or 'sms'
    location = "top-right", -- Other options: 'center-right', 'bottom-right' etc.
    time = 7000             -- Time in milliseconds (e.g., 7 seconds)
})

Last updated