nss_libs - Notify
This is a library for display notifications on the screen.
API Reference
getNotifyApi()
Returns NssLibsNotifyApi — the Notify API instance (client-side only)
---@type NssLibsNotifyApi
NOTIFY = exports.nss_libs:getNotifyApi()NOTIFY:alert(title, message, duration_in_ms, priority)
Shows an alert-style notification.
| Param | Type | Default | Description |
|---|---|---|---|
title | string | — | Notification title |
message | string | — | Notification body text |
duration_in_ms | number? | — | Display duration in milliseconds |
priority | boolean? | — | Clears all other messages and shows this one instantly |
Returns NssLibsNotifyApi — self (chainable)
NOTIFY:success(title, message, duration_in_ms, priority)
Shows a success-style notification.
| Param | Type | Default | Description |
|---|---|---|---|
title | string | — | Notification title |
message | string | — | Notification body text |
duration_in_ms | number? | — | Display duration in milliseconds |
priority | boolean? | — | Clears all other messages and shows this one instantly |
Returns NssLibsNotifyApi — self (chainable)
NOTIFY:notify(title, message, duration_in_ms, icon_dict, icon_name, color, priority)
Shows a fully customizable notification.
| Param | Type | Default | Description |
|---|---|---|---|
title | string | — | Notification title |
message | string | — | Notification body text |
duration_in_ms | number? | — | Display duration in milliseconds |
icon_dict | string? | — | Texture dictionary for the icon |
icon_name | string? | — | Texture name for the icon |
color | string? | — | Color name |
priority | boolean? | — | Clears all other messages and shows this one instantly |
Returns NssLibsNotifyApi — self (chainable)
TIP
See rdr3_discoveries/textures for available textures and rdr3_discoveries/colours for available colors.
NOTIFY:tipRight(title, message, duration_in_ms)
Shows a tip notification on the right side of the screen.
| Param | Type | Default | Description |
|---|---|---|---|
title | string | — | Notification title |
message | string | — | Notification body text |
duration_in_ms | number? | — | Display duration in milliseconds |
Returns NssLibsNotifyApi — self (chainable)
NOTIFY:setDefaultSuccessStyle(icon_dict, icon_name, color)
Overrides the default style for success notifications.
| Param | Type | Default | Description |
|---|---|---|---|
icon_dict | string? | — | Texture dictionary for the icon |
icon_name | string? | — | Texture name for the icon |
color | string? | — | Color name |
Returns NssLibsNotifyApi — self (chainable)
NOTIFY:setDefaultAlertStyle(icon_dict, icon_name, color)
Overrides the default style for alert notifications.
| Param | Type | Default | Description |
|---|---|---|---|
icon_dict | string? | — | Texture dictionary for the icon |
icon_name | string? | — | Texture name for the icon |
color | string? | — | Color name |
Returns NssLibsNotifyApi — self (chainable)
NOTIFY:setDefaultNotifyStyle(icon_dict, icon_name, color)
Overrides the default style for custom notifications.
| Param | Type | Default | Description |
|---|---|---|---|
icon_dict | string? | — | Texture dictionary for the icon |
icon_name | string? | — | Texture name for the icon |
color | string? | — | Color name |
Returns NssLibsNotifyApi — self (chainable)
Examples
NOTIFY:alert('What the fuck!?', 'Something gone really wrong', duration_in_ms)NOTIFY:success('Cool!', 'You made it', duration_in_ms)local icon_dict = 'hud_textures'
local icon_name = 'check'
local color = 'COLOR_WHITE'
local priority = true
NOTIFY:notify('Attention', 'You are great', duration_in_ms, icon_dict, icon_name, color, priority)NOTIFY:tipRight('Tip', 'If you eat you will get fat!', duration_in_ms)Full Setup Example
-- Getting the API
---@type NssLibsNotifyApi
NOTIFY = exports.nss_libs:getNotifyApi()
local duration_in_ms = 5000 -- 5 seconds
NOTIFY:alert('What the fuck!?', 'Something gone really wrong', duration_in_ms)
NOTIFY:success('Cool!', 'You made it', duration_in_ms)
NOTIFY:tipRight('Tip', 'If you eat you will get fat!', duration_in_ms)Override Default Styles
All notify methods have default styles, but you can override them:
NOTIFY:setDefaultSuccessStyle('YOUR_ITEM_DICT', 'YOUR_ITEM_NAME', 'YOUR_COLOR')
NOTIFY:setDefaultAlertStyle('YOUR_ITEM_DICT', 'YOUR_ITEM_NAME', 'YOUR_COLOR')
NOTIFY:setDefaultNotifyStyle('YOUR_ITEM_DICT', 'YOUR_ITEM_NAME', 'YOUR_COLOR')