Server exports

Server exports for notifications, dispatch alerts and announcements.

Notify

Sends a notification to one player, or to everyone with -1. Everything after the player id is the same as the client Notify.

lua
exports.mayo_notify:Notify(source, 'You were paid $500', 'success')
exports.mayo_notify:Notify(source, { title = 'Bank', message = 'You were paid $500', type = 'success' })

Dispatch

Sends a dispatch alert and returns how many players got it.

lua
local sent = exports.mayo_notify:Dispatch({ 'police', 'sheriff' }, {
    type = 'police',
    code = '10-71',
    title = 'Shots fired',
    message = 'Multiple shots reported near the Vinewood Bowl.',
    priority = 'high',
    coords = coords,
    postal = '7032',
    fields = {
        { label = 'Suspect', value = 'Male, black hoodie' },
        { label = 'Vehicle', value = 'Gray Sultan RS' },
    },
    blip = { sprite = 110, label = 'Shots fired' },
})

The first argument is who gets it: a player id, -1 for everyone, a job name, or a list of job names. See Who gets an alert.

FieldDefaultWhat it does
typepoliceA type from Types. Sets the color, icon, sound and blip color
codeA short code like 10-71, up to 12 characters
titleThe type's labelUp to 80 characters
messageUp to 300 characters. description also works
priorityhigh, medium or low
fieldsUp to 6 rows of { label, value }
coordsAdds the street name, a blip and the waypoint key
locationThe street at coordsYour own location text, up to 100 characters
postalUp to 12 characters
durationConfig.Alerts.DurationIn ms
iconThe type's iconA built-in icon or a Font Awesome name
blip{ sprite, color, scale, label, time } to change the blip, or false for no blip
soundThe type's sound{ 'name', 'soundSet' } for another sound, or false for none
idGeneratedYour own id for the alert

Announce

Sends an announcement to everyone, or to one player when you pass a player id as the second argument.

lua
exports.mayo_notify:Announce({
    title = 'Restart in 10 minutes',
    message = 'Find a safe spot and log off.',
    author = 'Staff',
    duration = 10000,
})
FieldDefaultWhat it does
titleUp to 120 characters
messageUp to 600 characters
authorShown under the message, up to 60 characters
durationConfig.Announce.DurationIn ms

An announcement needs a title or a message.