Notifications

Send notifications to a player from the server side.

SendNotify

KOJA.Server.SendNotify(data)
Field
Type
Description

source

number

Player server ID

type

string?

"success", "error", "info", "warning"

title

string?

Notification title

desc

string

Notification body text

time

number?

Duration in milliseconds

icon

string?

Icon name (backend-specific)

color

string?

Accent colour (backend-specific)

The backend used is determined by Config.Notify — the same setting as the client.

Examples

-- Success
KOJA.Server.SendNotify({
    source = source,
    type   = 'success',
    title  = 'Job Completed',
    desc   = 'You received $500.',
    time   = 5000,
})

-- Error
KOJA.Server.SendNotify({
    source = source,
    type   = 'error',
    desc   = 'You do not have enough money.',
})

-- Info
KOJA.Server.SendNotify({
    source = source,
    type   = 'info',
    title  = 'Server',
    desc   = 'Maintenance in 5 minutes.',
    time   = 10000,
})

Notify all players

koja-lib does not expose a "broadcast" helper. Use a standard server event:

Backends

Config.Notify
Backend

"esx"

ESX showNotification

"qb"

QBCore QBCore.Functions.Notify

"ox"

exports.ox_lib:notify

"lib"

koja-lib built-in notification

Last updated