FiveM Docs
Core Resources

esx_notify

esx_notify reference for ESX Legacy. Show NUI notifications with ESX.ShowNotification, the Notify export or server events, plus types, positions and config.

esx_notify is the default notification UI of ESX Legacy. It draws small toast notifications with a type (success, error, info, warning), an optional title and a configurable screen position. You rarely call it directly: ESX.ShowNotification on the client and xPlayer.showNotification on the server both end up in this resource.

Overview

Resourceesx_notify
SideClient only (server code uses events or xPlayer)
Dependencieses_extended (loads @es_extended/imports.lua)
UINUI page (nui/index.html), jQuery, Material Symbols icons
RequiredYes, ESX.ShowNotification errors when it is missing

Configuration

Config.lua has two keys.

KeyDefaultDescription
Config.notificationSoundEnabledtruePlays a short generated tone per notification. The pitch depends on the type.
Config.position"middle-right"Default position when a call passes no valid position.

Valid positions: top-right, top-left, top-middle, bottom-right, bottom-left, bottom-middle, middle-left, middle-right. Any other value falls back to Config.position.

Notification types

TypeIcon
successcheck circle
errorerror
infoinfo (also used for unknown types)
warningwarning triangle

Functions

ESX.ShowNotification

Client wrapper in es_extended. This is the call you use in almost every script.

ESX.ShowNotification(message, notifyType, length, title, position)
NameTypeDescription
messagestringText to show. Supports color codes and ~br~.
notifyTypestring?success, error, info or warning. Default "info".
lengthnumber?Duration in milliseconds. Default 5000.
titlestring?Bold title above the message. Default "New Notification".
positionstring?One of the positions above. Default Config.position.
client/main.lua
ESX.ShowNotification("You bought a ~g~water bottle~s~.", "success", 3000, "Shop")

ESX.ShowNotification("Inventory full!~br~Some items were dropped.", "warning", 4000, "Inventory", "bottom-left")

xPlayer.showNotification

Server side, the xPlayer object has the same signature. It triggers the client event esx:showNotification, which calls ESX.ShowNotification.

server/main.lua
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
    xPlayer.showNotification("Your paycheck has arrived.", "info", 5000, "Bank")
end

Notify export

The raw export. Note the different argument order: type and length come first.

exports["esx_notify"]:Notify(notifyType, length, message, title, position)
NameTypeDescription
notifyTypestringNotification type. Non-string values become "info".
lengthnumberDuration in ms. Invalid values (negative, NaN, infinite, non-number) become 3000.
messageanyConverted with tostring. ~br~ becomes a line break.
titlestring?Optional title.
positionstring?Optional position.
client/main.lua
exports["esx_notify"]:Notify("error", 4000, "You don't have enough money!", "Transaction failed")

Events

EventSideArguments
esx:showNotificationClient (net, registered by es_extended)message, type, length, title, position
ESX:NotifyClient (net, registered by esx_notify)type, length, message, title, position

Trigger them from the server when you have no xPlayer at hand:

server/main.lua
TriggerClientEvent("esx:showNotification", playerId, "Server restart in 5 minutes", "warning", 10000, "Server")

Formatting

The NUI escapes HTML, so you cannot inject markup. Two formatting helpers exist:

  • ~br~ (or a literal <br>) inserts a line break.
  • Color codes: ~r~ red, ~b~ blue, ~g~ green, ~y~ yellow, ~p~ purple, ~c~ grey, ~m~ dark grey, ~u~ black, ~o~ orange.

~s~ does not reset the color

In 1.16.4 the NUI script removes every ~s~ before it applies colors. A color code therefore colors the rest of the message, not just the next word. Put the colored part at the end of the message, or split the information into title and message.

Debug commands

When Config.EnableDebug is true in es_extended, esx_notify registers test commands: /oldnotify, /notify, /notify1, /notify2, /notify3 and /notify4. They are not available on a normal server.

Common issues

  • Nothing shows up. Check that esx_notify is started after es_extended and that no other resource overrides ESX.ShowNotification.
  • Wrong text in the title or a number as the message. You passed the ESX.ShowNotification argument order to the export, or the other way around.
  • Replacing esx_notify with another UI. Keep a resource named esx_notify or edit es_extended/client/modules/ui/notifications.lua; es_extended only checks for this resource name.

Frequently asked questions

Independent documentation

esx-fivem.com is a community project and is not affiliated with the ESX Framework team. Facts on this page were checked against the upstream source. Official resources: docs.esx-framework.org and github.com/esx-framework.
Edit on GitHub

Last updated on

On this page