AI Core

Notifications

How ai-lib's notification cards reach a third-party notification UI through ai-core, and the one export behind it.

Every ai-* script shows notifications through ai-lib (notify in the lib, aiLib.notify in Lua). ai-lib draws its own cards, unless the server owner picked another notification UI in ai-core's panel (tgiann-lumihud, okokNotify, ox_lib, mythic_notify, brutal_notify). Then ai-lib hands each card to ai-core, and ai-core translates it into that UI's call.

You do not call this yourself. To show a notification, use the lib's notify(text, kind, duration) or aiLib.notify(text, kind, duration): they pick the right UI. This page exists so you know what the export does when you see it.

ExternalNotify

Shows one ai-lib notification card in the notification UI the panel picked. ai-lib calls it for every card while a third-party UI is picked.

Side: Client · Waits: no

Signature
ExternalNotify(notification: Notification): boolean
Lua
local shown = exports['ai-core']:ExternalNotify({ text = 'Saved', kind = 'success' }) -- boolean

Parameters

Prop

Type

Notification

Prop

Type

Returns

boolean: true when a third-party UI was picked, runs, and got the card. false when the card has no text, or when no third-party UI is picked or running: then ai-lib draws the card itself.

Example

resource/client/index.ts
import { notify } from "@aicore-fivem/lib/client";
import { Locale } from "common";

// The right way to notify: ai-lib calls ExternalNotify for you when a third-party UI is picked.
RegisterCommand("saved", () => notify(Locale("SAVED"), "success", 3000), false);

The picked UI's resource name is in GlobalState ai:notify (unset while ai-lib draws its own cards). See State bags.

On this page