NSS Docs
DiscordStoreHomepage
nss_libs
nss_libs
  • README
  • Changelog
  • UI components
    • NssUiApi basics
    • NssAudio
    • NssButton
    • NssClient
    • NssConfirm
    • NssHelper
    • NssLoadingIndicator
    • NssModal
    • NssPadLock
    • NssResponsive
    • NssSimpleTextEditor
    • NssSvgReplacer
    • NssTextBox
    • NssTip
  • Client/server modules
    • AttachProp
    • Blip
    • Character
      • Client Character
      • Server Character
    • Chunk
    • ClientEvent
    • ConfigValidator
    • Database
    • DatabaseUpdater
    • DependencyAutoRestart
    • Discord
    • EntityInRange
    • Helper
      • Client Helper
      • Server Helper
      • Shared Helper
    • Inventory
    • Keyboard
    • Notify
    • Npc
    • ParticleFxPlayer
    • PointInRange
    • Prompts
    • ServerEvent
    • VersionCheck
Powered by GitBook
On this page
  • Example
  • client.lua

Was this helpful?

  1. Client/server modules

Notify

This is a library for display notifications on the screen.

Example

client.lua

-- Getting the API
---@type NssLibsNotifyApi
NOTIFY = exports.nss_libs:getNotifyApi()

-- Define a duration (in milliseconds). All notify methods have a duration argument, but this is optional.
local duration_in_ms = 5000 -- 5 seconds

------------------------------------------------------------------------------------
-- Example for alert
------------------------------------------------------------------------------------

NOTIFY:alert('What the fuck!?', 'Something gone really wrong', duration_in_ms)

------------------------------------------------------------------------------------
-- Example for success
------------------------------------------------------------------------------------

NOTIFY:success('Cool!', 'You made it', duration_in_ms)

------------------------------------------------------------------------------------
-- Example for custom notify
------------------------------------------------------------------------------------

-- See https://github.com/femga/rdr3_discoveries/tree/f729ba03f75a591ce5c841642dc873345242f612/useful_info_from_rpfs/textures for available textures
-- See https://github.com/femga/rdr3_discoveries/tree/7149acf64a4784afa4582afdd1b0009a137aed50/useful_info_from_rpfs/colours for available colors
local icon_dict = 'hud_textures'
local icon_name = 'check'
local color = 'COLOR_WHITE'

local priority = true -- Clears all other messages and show the new one instant

NOTIFY:notify('Attention', 'You are great', duration_in_ms, icon_dict, icon_name, color, priority)

------------------------------------------------------------------------------------
-- Example for tip right
------------------------------------------------------------------------------------

NOTIFY.tipRight('Tip', 'If you eat you will get fat!', duration_in_ms)

All notify methods having default styles, but you can override them by passing a table as the last argument.

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

Last updated 10 months ago

Was this helpful?