Notify

The Notification System is a highly customizable HUD component featuring 6 distinct visual styles, 8 screen positions, and smart duplicate handling. It supports markdown formatting, dynamic icons, and automatic "Night Mode" theming.


🛠️ Export

Notify

Sends a notification to the player's screen.

exports['ak47_lib']:Notify(data)
-- or
Lib47.Notify(data)

data Object Properties:

Property Type Default Description
description String nil The main message body (Supports Markdown).
title String "INFO" The header text.
type String "inform" Category: 'inform', 'success', 'warning', 'error'.
style String "minimal" Visual theme (see Styles).
position String "top-right" Location: 'top-left', 'top-right', 'top-center', 'bottom-left', 'bottom-right', 'bottom-center', 'center-left', 'center-right'.
duration Number 3000 Time in milliseconds before the notification fades.
icon String (Auto) FontAwesome icon class (e.g., "fa-star").
iconAnimation String nil FA animation (e.g., "spin", "pulse", "bounce").
sound Boolean/Str false true for default sound, or a string path to a custom .mp3.

🎨 Styles

You can change the look of the notification by passing the style property.

Style Name Description
minimal Sleek gradient background with a circular progress ring around the icon.
frost A modern "glassmorphism" pill shape.
frost-fade Similar to frost, but with a transparent gradient fade-out effect.
glass A rigid, rectangular card with sharp corners and high-end blur.
stream Energetic style with a large accent bar and monospace font.
glow-dot Minimalist style featuring a pulsing colored dot instead of an icon.
vertical-line Clean layout separated by a thin vertical line between the icon and text.

📝 Markdown Support

The description field supports basic markdown formatting:

  • **Bold Text** renders as Bold Text
  • *Italic Text* renders as Italic Text
  • `Code Block` renders as a highlighted code snippet.
  • \n creates a new line.

💡 Examples

Example 1: Basic Success Notification

A standard success message using the default minimal style.

exports['ak47_lib']:Notify({
    title = "PURCHASE COMPLETE",
    description = "You bought a **New Vehicle** for `$50,000`.",
    type = "success",
    position = "top-right",
    sound = true
})

Example 2: Minimalist "Glow Dot" Style

Ideal for clean UIs where icons are too distracting.

exports['ak47_lib']:Notify({
    title = "GPS Update",
    description = "A new location has been marked on your map.",
    style = "glow-dot",
    type = "inform",
    position = "bottom-left",
    duration = 5000
})

Example 3: Complex "Stream" Style with Animation

Great for high-action alerts or system-wide broadcasts.

exports['ak47_lib']:Notify({
    title = "System Alert",
    description = "The facility is under lockdown!\n*Proceed to the nearest exit.*",
    type = "error",
    style = "stream",
    icon = "fa-radiation",
    iconAnimation = "spin",
    position = "top-center",
    duration = 10000
})

ℹ️ Features

  • Duplicate Handling: If a notification with the same title and description is sent while one is already active, a "x2" badge will appear and the timer will reset rather than cluttering the screen.
  • Night Mode: Backgrounds automatically shift opacity and color based on in-game time (dimming between 21:00 and 06:00) to reduce eye strain.
  • Interactive Dismiss: Players can click on any notification to dismiss it instantly.