Notification

This page will contain information on how to use the notification.

πŸ”” Notifications

The notification system in orbit-dynamichud allows you to send fully customizable UI notifications directly from Lua to the NUI frontend.

It supports custom titles, descriptions, icons, colors, duration, and different notification types.


πŸ“¦ Client side event for adding a notification

Client-side usage

TriggerEvent("orbit-dynamichud:notify", data)

Server-side usage

TriggerClientEvent("orbit-dynamichud:notify", source, data)

🧠 How It Works (Internally)

The resource listens for:

RegisterNetEvent("orbit-dynamichud:notify", SendNotification)

Which sends the data directly to the NUI:

SendNUIMessage({
    action = "addNotification",
    data = data,
})

The frontend then processes the notification and handles:

  • Duplicate prevention (based on id)

  • Default titles

  • Sound playback

  • Automatic removal after duration


🧩 Data Structure

Here is the full structure of the data table:


🎨 Notification Types

If title is not provided, a default title will be assigned based on type.

Supported types:

Type
Default Behavior

success

Success styling

error

Error styling

warning

Warning styling

info

Info styling

inform

Same as info

primary

Success title fallback

If no type is provided:


πŸ›  Examples

βœ… Basic Info Notification


⚠️ Warning Notification


❌ Error With Custom Title


🎨 Fully Customized Notification


πŸ”Š Sound Behavior

When a notification is added:

  • A UI sound is played automatically.

  • Volume is based on:

    • savedSettings.ui_volume

  • Sound respects savedSettings.sounds_enabled.

No additional configuration is required.


βš™οΈ Important Notes

  • Notifications are de-duplicated by id.

  • If an existing notification already has the same id, it will not be added again.

  • If no id is provided, the system auto-increments internally.

  • Duration is in milliseconds.

  • All fields are optional, only description is recommended.


🧾 Best Practice

For most use cases, keep it simple:

Only use custom icons/colors when necessary to maintain visual consistency across your server.

Last updated