kyoNotify
Usage
Notification data
| Field | Type | Default | Description |
|---|
type | string | 'info' | 'success', 'error', 'warning' or 'info' |
title | string | 'SISTEMA' | Title |
message | string | '...' | Text. text is accepted too |
icon | string | 'fa-solid fa-bell' | Font Awesome class |
duration | number | 5000 | Milliseconds. time is accepted too |
Client
SendNotify
exports.kyoNotify:SendNotify({
type = 'success',
title = 'SHOP',
message = 'Payment completed.',
icon = 'fa-solid fa-circle-check',
duration = 5000,
})
HelpText
Shows or hides a persistent help text.
-- show
exports.kyoNotify:HelpText('shop', 'E', 'OPEN SHOP', true)
-- hide
exports.kyoNotify:HelpText('shop', nil, nil, false)
| Parameter | Type | Description |
|---|
id | string | Unique id of the help text, used to hide it |
key | string | Key shown (default E) |
message | string | Text |
show | boolean | true to show, false to hide |
Server
SendNotify
exports.kyoNotify:SendNotify(source, {
type = 'error',
title = 'ALERT',
message = 'Restricted area.',
})
Use -1 as source for every player.
SendNotifyAll
exports.kyoNotify:SendNotifyAll({
type = 'info',
title = 'SERVER',
message = 'Restart in 10 minutes.',
})
Events
| Event | Side | Arguments |
|---|
kyoNotify:display | Client (net event) | data |
kyoNotify:help | Client (net event) | id, key, message, show |
kyoNotify:send | Server (local event only) | target, data |
-- from the server
TriggerClientEvent('kyoNotify:display', source, { type = 'info', title = 'INFO', message = 'Hello' })
kyoNotify:send is deliberately not a network event, so clients cannot send notifications to other players.
Test commands
| Command | What it does |
|---|
/kyonotify | Shows the four notification types |
/kyohelp | Shows a help text for 5 seconds |