AI Core

ai-core client exports

Every client export of ai-core - player data, HUD, key hints, world sync, items, radial, gestures, looks and dialogs.

Typed as AiCoreClientExports in @aicore-fivem/shared (exports.ts).

TypeScript
import { resourceExport } from "@aicore-fivem/lib/client";
const core = resourceExport("ai-core");

Most of these have a lib helper that is easier to use (shown in the last column); Lua resources have the same helpers on aiLib.

Player

ExportWhatLib
GetPlayerData(): AiPlayerData | nullThe local player's data: character, money, jobs, duty, job, gangs, active gang, metadata.getPlayerData, onPlayerData
IsPlayerLoaded(): booleanWhether a character is loaded.
IsDead(): booleanThe local player is down in whatever death script runs.medical.isDead
GetDefinitions(file: "jobs" | "gangs"): Record<string, unknown> | nullJob or gang definitions as the panel file holds them.
Lua
local data = exports['ai-core']:GetPlayerData()
if data and data.duty == 'police' then
  -- on duty
end

HUD

ExportWhatLib
HideHud(reason: string): voidHides every HUD while any reason holds (a stopped resource's reasons go with it).hud.hide
ShowHud(reason: string): voidDrops a reason.hud.show
IsHudVisible(): booleanWhether HUDs show now.hud.visible
OpenHudSettings(): booleanOpens the running HUD's own settings; false without one.
HasHudSettings(): booleanWhether the running HUD has settings.
TypeScript
core.HideHud("photo-mode");
// ...
core.ShowHud("photo-mode");
Lua
exports['ai-core']:HideHud('photo-mode')
exports['ai-core']:ShowHud('photo-mode')

Keybinds and key hints

ExportWhatLib
GetKeybindKey(name: string): string | nullThe key a lib Keybind was registered with; null until registered.Keybind.currentKey
ShowKeyHint(id: string, hint: KeyHintRequest): voidShows a key hint (label, keybind?, key?, icon?) until hidden.keyHints.show
HideKeyHint(id: string): voidHides it.keyHints.hide
GetKeyHints(): KeyHintView[]The hints HUDs show now (id, key, label, icon?).
OpenKeyboard(): voidOpens the keys screen: every key with an action.
Lua
exports['ai-core']:ShowKeyHint('noclip_speed', { label = 'Speed', key = 'SHIFT', icon = 'gauge' })

Weather and time sync

ExportWhatLib
PauseWorldSync(reason: string): voidPauses the weather and time sync while any reason holds (interiors, scenes).world.pauseSync
ResumeWorldSync(reason: string): voidDrops a reason.world.resumeSync
IsWorldSyncPaused(): booleanWhether the sync is paused now.

Items

ExportWhatLib
OpenInventory(): voidOpens the player's own inventory screen.inventory.openInventory
HasItem(item: string, count?: number): booleanWhether the player holds the item.inventory.hasItem
GetCurrentWeapon(): HeldWeapon | nullThe weapon item in hand (name, label, image?).inventory.currentWeapon
OpenItemPicker(requestId: number, request: ItemPickerRequest): voidAdmin tools: the searchable item grid; the result arrives as MENU_EVENTS.menuResult.itemPicker

Radial menu

Items reach whichever radial menu runs; ai-core drops them when the adding resource stops.

ExportWhatLib
AddRadialItem(item: RadialItem): voidAdds or replaces an item (id, label, icon?, parent?, items?, canShow?, onPressed?, keepOpen?, whileDead?).radial.add
RemoveRadialItem(id: string): voidRemoves an item.radial.remove
RefreshRadial(): voidReads every canShow of an open wheel again.radial.refresh
Lua
exports['ai-core']:AddRadialItem({
  id = 'myscript_engine', label = 'Engine', icon = 'power-off', parent = 'vehicle',
  canShow = function() return IsPedInAnyVehicle(PlayerPedId(), false) end,
  onPressed = function() ExecuteCommand('engine') end,
})

Gestures

ExportWhatLib
GetGestureProvider(): string | nullThe emote script answering hands up and pointing.gestures.provider
IsHandsUp(): booleanThe local player has the hands up.gestures.isHandsUp
IsPointing(): booleanThe local player points.gestures.isPointing

Appearance

ExportWhatLib
ApplyAppearance(ped: number, look: CharacterAppearance): booleanPuts a look from GetCharacterAppearance on a ped of the same model through the active clothing script.appearance.apply
GetPedAppearance(ped: number): CharacterAppearance | nullThe look a ped wears now.appearance.read

The menus, input dialogs, notifications, prompts, progress bar and minigames are ai-lib's, not ai-core's: see Script exports.

On this page