forge/docs/CLIENT_NOTIFICATIONS_USAGE_GUIDE.md
Jacob Schmidt 89169f1e84 Update documentation and add new client usage guides
- Revised README.md for the Forge Client Example Addon to clarify its purpose as a template.
- Enhanced MODULE_REFERENCE.md to categorize guides into Server and Extension guides and Client guides.
- Created detailed usage guides for various client addons including Actor, Bank, CAD, Garage, Locker, Notifications, Organization, Phone, and Store.
- Added a Client Common Usage Guide to outline shared browser UI bridge patterns.
- Introduced a Client Main Usage Guide to define the foundational elements for client addons.
- Established authoritative state notes and usage rules across new guides to ensure clarity on server ownership and client responsibilities.
2026-04-18 13:04:01 -05:00

1.8 KiB

Client Notifications Usage Guide

The client notifications addon owns the notification HUD, notification sound, and local notification service used by Forge client and server modules.

Runtime Behavior

The notification display is created during client initialization. The browser HUD sends:

notifications::ready

When that event is received, NotificationService initializes and sends a startup notification.

Create a Notification

Use the notification service when available:

GVAR(NotificationService) call ["create", [
    "success",
    "Title",
    "Notification text.",
    4000
]];

Arguments:

Argument Purpose
_type Notification type, such as success, info, warning, or error.
_title Notification title.
_content Notification body text.
_duration Display duration in milliseconds.

The service dispatches a browser forge:notify custom event.

CBA Event Surface

Other addons can use the client notification event:

["forge_client_notifications_recieveNotification", [
    "warning",
    "Garage",
    "Vehicle spawn position is blocked.",
    3000
]] call CBA_fnc_localEvent;

The event payload is:

[_type, _title, _content, _duration]

Usage Rules

  • Use the shared notification service instead of opening separate transient browser UIs.
  • Keep server-driven player feedback short and actionable.
  • Treat notification state as transient client UI state.
  • Do not use notifications as the only record of durable domain changes.