Skip to content

Notifications Contract

Contract: INotifications
Default provider: shiva-notifications

Sends UI notifications to players.

Methods

INotifications:notify(serverId, type, message, duration?)

Send a notification to a player.

lua
local notify = container:make('INotifications')

notify:notify(source, 'success', 'Transaction complete!')
notify:notify(source, 'error', 'Insufficient funds.')
notify:notify(source, 'info', 'Server restart in 5 minutes.', 10000)

Parameters:

ParamTypeDescription
serverIdnumberServer ID of the target player
typestring'success', 'error', 'warning', 'info'
messagestringThe message to display
durationnumber?Duration in milliseconds (default: 5000)

INotifications:notifyAll(type, message, duration?)

Send a notification to all connected players.

lua
notify:notifyAll('warning', 'Server restarting in 10 minutes.')

Released under the MIT License.