Skip to main content

Sending Notifications

From a client script​

exports['gs-notify']:Notify('Garage', 'Your vehicle is ready.', 'success')

From a server script​

The first value is who gets it:

exports['gs-notify']:Notify(source, 'Paycheck', 'You received $4,200.', 'money')
TargetWho receives it
source or a player idThat player
{ 1, 2, 7 }Those players
'all' or nilEveryone

Ways to write a call​

All of these work on the client and the server (server calls add the target first):

Notify('Title', 'Message', 'info', 5000) -- title + message + type + duration (ms)
Notify('Message', 'success') -- message + type
Notify('Message') -- message only
Notify({ type = 'success', title = 'Done', message = 'Saved.', duration = 4000 }) -- table, full control
info

With two strings, if the second one is a type name (success, error, ...), it's read as message + type. Otherwise it's title + message.

Options​

Use these in the table style. Everything is optional.

OptionWhat it doesDefault
typeLook and sound (see Types)info
titleHeading, up to 60 charactersthe type name
messageBody text, up to 300 characters. ~n~ makes a new lineempty
durationMilliseconds on screen (1200 to 60000). 0 = stays until closed5500
positionWhere it appears (see Positions)top-center
persistenttrue = stays until closedfalse
progressShow the countdown bartrue
priorityStronger glow and entry animationfalse
iconA type name like 'money', or a short emojiby type
imageA picture instead of an icon: https://, nui:// or a relative pathnone
accentA custom colour, like '#ff8800'by type
soundfalse = silent, or a type name to use that soundby type
volume0.0 to 1.00.5
idYour own id, so you can update or close it laterauto
metadataInfo pills (see below)none
actionsButtons (see below)none

Other names also work: description, text or msg for message; length or time for duration; sticky for persistent; avatar for image.

Types​

success · error · warning · info · message · dispatch · system · announcement · money · staff

Common names are mapped for you: primary/inform → info, warn/caution → warning, danger → error, police/ems → dispatch, bank/cash → money, admin → staff.

Positions​

top-left · top-center · top-right · middle-left · middle-right · bottom-left · bottom-center · bottom-right

Info pills​

metadata = {
{ label = 'Crew', value = '4/4' },
{ label = 'Payout', value = '$84,500' }
}

Up to 6 pills. A simple table like { Crew = '4/4', Payout = '$84,500' } also works.

Buttons​

exports['gs-notify']:Notify({
type = 'dispatch',
title = '10-80 In Progress',
message = 'High speed chase',
actions = {
{ label = 'Set GPS', event = 'myjob:setGps' },
{ label = 'Report', event = 'myjob:server:report', server = true },
{ label = 'Dismiss' }
}
})
Button optionWhat it does
labelButton text
eventEvent to trigger on click (optional)
servertrue = trigger a server event
argsValue passed to the event. If left out, the notification id is passed
closefalse = keep the notification open after the click

Up to 3 buttons. Players press F10 to show the cursor, click, then press ESC to hide it. Buttons can only come from your own scripts, never from a player's request.

Update or close a notification​

exports['gs-notify']:Notify({ id = 'download', title = 'Download', message = '40%', persistent = true })
exports['gs-notify']:Notify({ id = 'download', type = 'success', title = 'Download', message = 'Done!' }) -- replaces it
exports['gs-notify']:Close('download')
exports['gs-notify']:Clear() -- close everything

Notify returns the notification id, so you can save it and close it later.

Other client exports​

exports['gs-notify']:SetPosition('bottom-right') -- change the default position
exports['gs-notify']:OpenSettings() -- open the player settings menu

Events​

If you prefer events to exports:

-- server -> client
TriggerClientEvent('gs-notify:notify', source, 'Title', 'Message', 'success')
TriggerClientEvent('gs-notify:close', source, 'my-id')
TriggerClientEvent('gs-notify:clear', source)

-- client -> server (rate-limited; only admins can target other players)
TriggerServerEvent('gs-notify:server:notify', nil, 'Title', 'Message', 'info')