Client exports
Client exports for notifications, text UI and alerts.
Notify
Shows a notification and returns its id.
exports.mayo_notify:Notify('Vehicle stored', 'success')
exports.mayo_notify:Notify('Vehicle stored', 'success', 5000, 'Garage')
exports.mayo_notify:Notify({
title = 'Garage',
message = 'Vehicle stored',
type = 'success',
duration = 5000,
icon = 'car',
iconColor = '#BF5AF2',
position = 'top-right',
id = 'garage',
persistent = false,
sound = false,
})| Field | Default | What it does |
|---|---|---|
title | Up to 120 characters | |
message | Up to 1000 characters. description, text and msg also work | |
type | info | A type from Types or an alias. style also works |
duration | Config.DefaultDuration | In ms. 0 keeps it on screen until you remove it. length, time and timeout also work |
icon | The type's icon | A built-in icon or a Font Awesome name |
iconColor | The type's color | Any hex color. color also works |
position | Config.Position | See Positions |
id | Generated | Sending the same id again updates that card instead of adding a new one |
persistent | false | true keeps it on screen until you remove it |
sound | The type's sound | { 'name', 'soundSet' } for another sound, or false for none |
A notification needs a title or a message. Other call styles work too, so scripts written for other notify resources can call it as they are:
exports.mayo_notify:Notify('message', 'type', duration, 'title') -- QBCore and ESX style
exports.mayo_notify:Notify({ description = 'message', type = 'error' }) -- ox_lib style
exports.mayo_notify:Notify('type', duration, 'message', 'title') -- esx_notify style
exports.mayo_notify:Notify({ text = 'message', caption = 'title' }, 'type', duration) -- QBCore text tableRemove
Removes a notification by id.
local id = exports.mayo_notify:Notify({ message = 'Searching...', persistent = true })
exports.mayo_notify:Remove(id)Clear
Removes every notification and alert on screen.
exports.mayo_notify:Clear()Text UI
exports.mayo_notify:ShowTextUI('Open garage', { key = 'E', position = 'center-left' })
exports.mayo_notify:HideTextUI()
local open, text = exports.mayo_notify:IsTextUIOpen()| Option | Default | What it does |
|---|---|---|
key | The key cap. Text like [E] - Open garage sets it for you | |
icon | Shown when there's no key. A built-in icon or a Font Awesome name | |
iconColor | Config.AccentColor | Any hex color |
position | Config.TextUI.Position | See Positions |
The text can be up to 200 characters. Calling ShowTextUI again while it's open changes the text.
Dispatch
Shows a dispatch alert to this player only, and returns its id. It takes the same fields as the server export. To send an alert to a job, use the server export.
exports.mayo_notify:Dispatch({ type = 'ems', title = 'Injured person', coords = GetEntityCoords(PlayerPedId()) })Announce
Shows an announcement to this player only. Takes a message, or a table with title, message, author and duration.
exports.mayo_notify:Announce('Welcome to the server!')