Exports
- Added
- Updated
Server side
Server-side exports take the target as their first argument. playerId is integer|integer[] — a single id, an array of them, or -1 for everyone connected.
notify
Shows a notification to a player.
| Argument | Type | Description |
|---|---|---|
playerId | integer|integer[] | Target player, or -1 for everyone |
payload | Payload | The same table as the client side |
Returns boolean — false when the payload or the target was unusable.
exports.REC_Notify:notify(playerId, payload)
RegisterCommand("payday", function(source)
exports.REC_Notify:notify(source, {
type = "success",
title = "REC_Notify",
description = "Payday has landed.",
icon = "money",
})
exports.REC_Notify:notify(-1, {
type = "info",
description = "Payday has been paid out to everyone.",
})
end, true)
hide
Dismisses one of a player's notifications.
| Argument | Type | Description |
|---|---|---|
playerId | integer|integer[] | Target player, or -1 for everyone |
id | string | The id the notification was sent with |
Returns boolean.
exports.REC_Notify:hide(playerId, id)
payload.id yourself when you intend to dismiss a notification later.clear
Dismisses everything on a player's screen.
| Argument | Type | Description |
|---|---|---|
playerId | integer|integer[] | Target player, or -1 for everyone |
Returns boolean.
exports.REC_Notify:clear(playerId)
defaultNotify
Displays an ox_lib-compatible notification payload.
| Argument | Type |
|---|---|
playerId | integer|integer[] |
payload | REC_Notify.Shared.DefaultNotify.Payload |
Returns: boolean.
exports.REC_Notify:defaultNotify(playerId, payload)
Client side
notify
Shows a notification to the player running the script.
| Argument | Type | Description |
|---|---|---|
payload | Payload | The table below |
Returns string? — the id of the notification, nil when nothing was shown.
exports.REC_Notify:notify(payload)
Citizen.CreateThread(function()
exports.REC_Notify:notify({
type = "success",
title = "REC_Notify",
description = "The vehicle has been stored.",
duration = 4000,
position = "top-right",
})
end)
Payload is REC_Notify.Shared.Notify.Payload. Every field is optional:
| Field | Type | Description |
|---|---|---|
type | NotifyType? | success / error / info / warning / neutral |
title | string? | Drawn in the accent color |
description | string? | Body text |
duration | integer? | Milliseconds. Falls back to config.ui.defaultDuration |
position | Position? | Falls back to config.ui.position |
icon | string? | A Font Awesome name or class, such as circle-check or fa-solid fa-circle-check |
color | string? | Accent color as hex |
playSound | boolean? | Falls back to config.sound.default |
sound | string? | An audio file in web/build/sounds/, replacing the sound of the type |
id | string? | Sending the same id again replaces what is on screen |
title nor description is dropped, and notify returns nil.hide
Dismisses one notification before its time is up.
| Argument | Type | Description |
|---|---|---|
id | string | The id notify returned |
Returns boolean.
exports.REC_Notify:hide(id)
clear
Dismisses everything on screen, queued notifications included.
Takes no arguments. Returns boolean.
exports.REC_Notify:clear()
defaultNotify
Displays an ox_lib-compatible notification for the local player.
| Argument | Type |
|---|---|
payload | REC_Notify.Shared.DefaultNotify.Payload |
Returns boolean.
exports.REC_Notify:defaultNotify(payload)
