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:
| Param | Type | Description |
|---|---|---|
serverId | number | Server ID of the target player |
type | string | 'success', 'error', 'warning', 'info' |
message | string | The message to display |
duration | number? | 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.')