HG-Notify Developer Guide
The HG-Notify script provides a set of exports that allow you to send notifications to players. Here's how you can use them:
Client Side
You can display a notification using the ToggleNotify
export from client side.
exports['hg-notify']:ToggleNotify({
status = "success", --(1)!
title = "Success", --(2)!
text = "This is a success notification", --(3)!
audio = "success", -- optional --(4)!
effect = "slide", -- optional --(5)!
speed = 300, -- optional --(6)!
customClass = "", -- optional --(7)!
showIcon = true, --(8)!
autotimeout = 3000,-- optional --(9)!
type = "outline", -- optional --(10)!
position = "right top", -- optional --(11)!
gap = 20, -- optional --(12)!
padding = 20 -- optional --(13)!
})
- Notification type :
'error'
||'warning'
||'success'
||'info'
- Notification title (obviously)
- Notification body text (you can use html)
- Notification Sound:
'error'
||'warning'
||'success'
||'info'
- Notificaiton Effect:
'fade'
||'slide'
- transition-duration in milliseconds
- Css class
- Show Notification icon ? (
true
orfalse
) - Notification duration in milliseconds
- Notification Style:
'outline'
||'filled'
- Notification position: Combine x and y position.
'left'
,'right'
,'top'
,'bottom'
,'x-center'
,'y-center'
or use only'center'
to center both x and y - Gap between notifications
- Padding of the notifications
You can force clear all notification using the ClearNotify
export from client side.
- Force close all notifications
Server Side
You can display a notification for a specific player using the ToggleNotify
export from server side.
exports['hg-notify']:ToggleNotify(source, {
status = "success", --(1)!
title = "Success", --(2)!
text = "This is a success notification", --(3)!
audio = "success", -- optional --(4)!
effect = "slide", -- optional --(5)!
speed = 300, -- optional --(6)!
customClass = "", -- optional --(7)!
showIcon = true, --(8)!
autotimeout = 3000,-- optional --(9)!
type = "outline", -- optional --(10)!
position = "right top", -- optional --(11)!
gap = 20, -- optional --(12)!
padding = 20 -- optional --(13)!
})
- Notification type :
'error'
||'warning'
||'success'
||'info'
- Notification title (obviously)
- Notification body text (you can use html)
- Notification Sound:
'error'
||'warning'
||'success'
||'info'
- Notificaiton Effect:
'fade'
||'slide'
- transition-duration in milliseconds
- Css class
- Show Notification icon ? (
true
orfalse
) - Notification duration in milliseconds
- Notification Style:
'outline'
||'filled'
- Notification position: Combine x and y position.
'left'
,'right'
,'top'
,'bottom'
,'x-center'
,'y-center'
or use only'center'
to center both x and y - Gap between notifications
- Padding of the notifications
Variables Table
Parameter | Type | Values | Default |
---|---|---|---|
status |
String | 'error' , 'warning' , 'success' 'info' |
null |
title |
String | null |
|
text |
String | You can send any type of HTML. | null |
audio |
String | Audio path: ui/assets/ | null |
customIcon |
String | You can send any type of HTML. | null |
customClass |
String | null |
|
speed |
Number | Transition duration in milliseconds. | 300 |
effect |
String | 'fade' , 'slide' |
'fade' |
showIcon |
Boolean | true |
|
showCloseButton |
Boolean | true |
|
autoclose |
Boolean | true |
|
autotimeout (with autoclose: true ) |
Number | 3000 |
|
gap (margin between notifications) |
Number | 20 |
|
distance (distance to edges) |
Number | 20 |
|
type |
String | 'outline' , 'filled' |
'outline' |