- Multiple Notification Types: Supports different types of notifications (e.g.,
warning,primary,error, etc.). - Custom Duration: Set custom display duration for each notification.
- Ox Library Integration: Optional integration with the
ox_liblibrary for extended functionality. - HTML/CSS/JavaScript Interface: Uses a web interface for rendering the notifications, allowing easy customization of the appearance.
-
Download or clone this repository.
-
navigate into the web folder and run
npm i
-
once that's complete run
npm run build
-
This will build the files found in the releases and the script should function normaly.
-
Add the following line to your server configuration (
server.cfg):start gm_notify
-
If you want the script to function normaly you should probably not change the scripts name!
In your client scripts, you can trigger notifications using the following event:
Client side
TriggerEvent("ws_notify:client:Nofity", "notifyType", "message", duration)Server side
TriggerClientEvent("ws_notify:client:Nofity", source, "notifyType", "message", duration)notifyType: The type of notification (e.g.,warning,primary, etc.).message: The message you want to display.duration: (Optional) The duration of the notification display in milliseconds (default is 5000ms).
If using ox_lib, notifications can be triggered using:
TriggerEvent("ox_lib:notify", data)Where data is a table that can include the following fields:
type: Notification type (e.g.,success,error, etc.).title: The title of the notification.description: The description of the notification.duration: (Optional) The duration of the notification.
The notifications are rendered using an HTML interface, allowing for customization of the look and feel of notifications. You can find the HTML, CSS files in the web directory.
Configuration options are stored in the shared/client.lua file. You can modify options such as:
ox_lib_replacement: Set this totrueif you're using theox_libto handle notifications. Please visit our documentation for more info.
gm_notify/
│
├── client/
│ ├── client.lua # Handles the client-side notification logic.
│ ├── debug.lua # Debugging tools for the notification system.
│
├── shared/ # Shared configuration files between client and server.
│ └── client.lua
│
├── fxmanifest.lua # Resource manifest for FiveM.
├── web/ # web assets.
- Modifying Notification UI: You can customize the HTML/CSS files in the
webfolder to change the look and feel of the notifications. - If you want to make changes to the script you can run it on a browser with:
npm run dev
ox_lib
Feel free to contribute by submitting issues or pull requests.