documentation
  • GENERAL INFORMATION
    • 🔷Tebex Integration
    • 👾Code Creator
    • 🔌REACT
  • PACKAGES
    • RADIO
    • NPC DIALOG
    • CARPLAY
    • SCOREBOARD
    • CARSHOP
    • GARAGE
    • GUNSHOP
    • RENT A CAR
    • CRAFTING
    • DRIVING SCHOOL
    • CUSTOMS
    • CASE
    • DAİLYREWARD
    • BLACKMARKET
    • REPORT
    • CLOTHESHOP
    • REGİSTER
    • CREATOR
    • VIPSYSTEM
    • NOTIFICATION
    • FİSHİNG
    • DİVİNG
    • PROGRESS & NOTIFY
    • NEW YEAR
Powered by GitBook
On this page
  1. PACKAGES

NOTIFICATION

Notification System Setup This section outlines the setup of a notification system using a custom event and a command in a FiveM server. The notification system allows for different types of alerts to

RegisterNetEvent('es:showNotification', function(message, title, type, length, icon)
    AddNotify(message, title, type, length, icon)
end)

Parameters:

  • message: The content of the notification, which will be shown to the player.

  • title: The title of the notification, typically summarizing the type of alert.

  • type: The notification type, which determines the visual style (e.g., "info", "error", "warning", "announce", "purple").

  • length: The duration (in milliseconds) for which the notification will be displayed.

  • icon: The icon associated with the notification, either as an image file or a Font Awesome icon class.

Usage

You can trigger this event from anywhere within the server code using:

TriggerEvent('es:showNotification', "This is your message", "Notification Title", "info", 5000, "fas fa-info-circle")

This will display a notification with the specified message, title, type, and icon for 5 seconds.

2. Command Registration: notify

A command named notify is registered, which triggers a series of notifications with predefined messages. This is useful for testing or broadcasting specific notifications to the player.

Command Definition

RegisterCommand("notify", function(source, args)
    AddNotify("Your phone has received a new message. Check it for important details and updates.", "PHONE NOTIFICATION", "info", 5000, "phone.png")
    Wait(1000)
    AddNotify("An error occurred. Please review the details to avoid potential issues.", "ERROR NOTIFICATION", "error", 5000, "fas fa-info-circle")
    Wait(1000)
    AddNotify("Caution! A potential issue has been detected. Immediate attention is required.", "WARNING NOTIFICATION", "warning", 5000, "fas fa-info-circle")
    Wait(1000)
    AddNotify("Important announcement for all players. Please read the following information carefully.", "ANNOUNCEMENT NOTIFICATION", "announce", 5000, "announce.png")
    Wait(1000)
    AddNotify("A special chat message has been sent to you containing unique information.", "CHAT NOTIFICATION", "purple", 5000, "chat.png")
    AddNotify("Your phone has received a new message. Check it for important details and updates.", "PHONE NOTIFICATION", "info", 5000, "phone.png")
    Wait(1000)
    AddNotify("An error occurred. Please review the details to avoid potential issues.", "ERROR NOTIFICATION", "error", 5000, "fas fa-info-circle")
    Wait(1000)
    AddNotify("Caution! A potential issue has been detected. Immediate attention is required.", "WARNING NOTIFICATION", "warning", 5000, "fas fa-info-circle")
    Wait(1000)
    AddNotify("Important announcement for all players. Please read the following information carefully.", "ANNOUNCEMENT NOTIFICATION", "announce", 5000, "announce.png")
    Wait(1000)
    AddNotify("A special chat message has been sent to you containing unique information.", "CHAT NOTIFICATION", "purple", 5000, "chat.png")
end, false)
  • Usage:

    • Players can trigger this command by typing /notify in the chat.

    • The command will sequentially display several predefined notifications with 1-second intervals between them.

Example Notifications

  1. Phone Notification: Message: "Your phone has received a new message. Check it for important details and updates." Title: "PHONE NOTIFICATION" Type: "info" Icon: "phone.png"

  2. Error Notification: Message: "An error occurred. Please review the details to avoid potential issues." Title: "ERROR NOTIFICATION" Type: "error" Icon: "fas fa-info-circle"

  3. Warning Notification: Message: "Caution! A potential issue has been detected. Immediate attention is required." Title: "WARNING NOTIFICATION" Type: "warning" Icon: "fas fa-info-circle"

  4. Announcement Notification: Message: "Important announcement for all players. Please read the following information carefully." Title: "ANNOUNCEMENT NOTIFICATION" Type: "announce" Icon: "announce.png"

  5. Chat Notification: Message: "A special chat message has been sent to you containing unique information." Title: "CHAT NOTIFICATION" Type: "purple" Icon: "chat.png"

  6. Conclusion

    This setup provides a flexible way to trigger and manage notifications within the FiveM server, using either custom events or a simple command. The notifications can be easily customized to fit various scenarios, improving communication with players.

PreviousVIPSYSTEMNextFİSHİNG

Last updated 8 months ago