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.
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.
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.
| Field | Default | What it does |
|---|---|---|
type | police | A type from Types. Sets the color, icon, sound and blip color |
code | A short code like 10-71, up to 12 characters | |
title | The type's label | Up to 80 characters |
message | Up to 300 characters. description also works | |
priority | high, medium or low | |
fields | Up to 6 rows of { label, value } | |
coords | Adds the street name, a blip and the waypoint key | |
location | The street at coords | Your own location text, up to 100 characters |
postal | Up to 12 characters | |
duration | Config.Alerts.Duration | In ms |
icon | The type's icon | A built-in icon or a Font Awesome name |
blip | { sprite, color, scale, label, time } to change the blip, or false for no blip | |
sound | The type's sound | { 'name', 'soundSet' } for another sound, or false for none |
id | Generated | Your 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.
exports.mayo_notify:Announce({
title = 'Restart in 10 minutes',
message = 'Find a safe spot and log off.',
author = 'Staff',
duration = 10000,
})| Field | Default | What it does |
|---|---|---|
title | Up to 120 characters | |
message | Up to 600 characters | |
author | Shown under the message, up to 60 characters | |
duration | Config.Announce.Duration | In ms |
An announcement needs a title or a message.