Skip to content

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)

lua
---@type NssLibsNotifyApi
NOTIFY = exports.nss_libs:getNotifyApi()

NOTIFY:alert(title, message, duration_in_ms, priority) ​

Shows an alert-style notification.

ParamTypeDefaultDescription
titlestring—Notification title
messagestring—Notification body text
duration_in_msnumber?—Display duration in milliseconds
priorityboolean?—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.

ParamTypeDefaultDescription
titlestring—Notification title
messagestring—Notification body text
duration_in_msnumber?—Display duration in milliseconds
priorityboolean?—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.

ParamTypeDefaultDescription
titlestring—Notification title
messagestring—Notification body text
duration_in_msnumber?—Display duration in milliseconds
icon_dictstring?—Texture dictionary for the icon
icon_namestring?—Texture name for the icon
colorstring?—Color name
priorityboolean?—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.

ParamTypeDefaultDescription
titlestring—Notification title
messagestring—Notification body text
duration_in_msnumber?—Display duration in milliseconds

Returns NssLibsNotifyApi — self (chainable)


NOTIFY:setDefaultSuccessStyle(icon_dict, icon_name, color) ​

Overrides the default style for success notifications.

ParamTypeDefaultDescription
icon_dictstring?—Texture dictionary for the icon
icon_namestring?—Texture name for the icon
colorstring?—Color name

Returns NssLibsNotifyApi — self (chainable)


NOTIFY:setDefaultAlertStyle(icon_dict, icon_name, color) ​

Overrides the default style for alert notifications.

ParamTypeDefaultDescription
icon_dictstring?—Texture dictionary for the icon
icon_namestring?—Texture name for the icon
colorstring?—Color name

Returns NssLibsNotifyApi — self (chainable)


NOTIFY:setDefaultNotifyStyle(icon_dict, icon_name, color) ​

Overrides the default style for custom notifications.

ParamTypeDefaultDescription
icon_dictstring?—Texture dictionary for the icon
icon_namestring?—Texture name for the icon
colorstring?—Color name

Returns NssLibsNotifyApi — self (chainable)

Examples ​

lua
NOTIFY:alert('What the fuck!?', 'Something gone really wrong', duration_in_ms)
lua
NOTIFY:success('Cool!', 'You made it', duration_in_ms)
lua
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)
lua
NOTIFY:tipRight('Tip', 'If you eat you will get fat!', duration_in_ms)

Full Setup Example ​

lua
-- 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:

lua
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')

NIGHTSHIFT STUDIO Documentation