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).
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
| Export | What | Lib |
|---|---|---|
GetPlayerData(): AiPlayerData | null | The local player's data: character, money, jobs, duty, job, gangs, active gang, metadata. | getPlayerData, onPlayerData |
IsPlayerLoaded(): boolean | Whether a character is loaded. | |
IsDead(): boolean | The local player is down in whatever death script runs. | medical.isDead |
GetDefinitions(file: "jobs" | "gangs"): Record<string, unknown> | null | Job or gang definitions as the panel file holds them. |
local data = exports['ai-core']:GetPlayerData()
if data and data.duty == 'police' then
-- on duty
endHUD
| Export | What | Lib |
|---|---|---|
HideHud(reason: string): void | Hides every HUD while any reason holds (a stopped resource's reasons go with it). | hud.hide |
ShowHud(reason: string): void | Drops a reason. | hud.show |
IsHudVisible(): boolean | Whether HUDs show now. | hud.visible |
OpenHudSettings(): boolean | Opens the running HUD's own settings; false without one. | |
HasHudSettings(): boolean | Whether the running HUD has settings. |
core.HideHud("photo-mode");
// ...
core.ShowHud("photo-mode");exports['ai-core']:HideHud('photo-mode')
exports['ai-core']:ShowHud('photo-mode')Keybinds and key hints
| Export | What | Lib |
|---|---|---|
GetKeybindKey(name: string): string | null | The key a lib Keybind was registered with; null until registered. | Keybind.currentKey |
ShowKeyHint(id: string, hint: KeyHintRequest): void | Shows a key hint (label, keybind?, key?, icon?) until hidden. | keyHints.show |
HideKeyHint(id: string): void | Hides it. | keyHints.hide |
GetKeyHints(): KeyHintView[] | The hints HUDs show now (id, key, label, icon?). | |
OpenKeyboard(): void | Opens the keys screen: every key with an action. |
exports['ai-core']:ShowKeyHint('noclip_speed', { label = 'Speed', key = 'SHIFT', icon = 'gauge' })Weather and time sync
| Export | What | Lib |
|---|---|---|
PauseWorldSync(reason: string): void | Pauses the weather and time sync while any reason holds (interiors, scenes). | world.pauseSync |
ResumeWorldSync(reason: string): void | Drops a reason. | world.resumeSync |
IsWorldSyncPaused(): boolean | Whether the sync is paused now. |
Items
| Export | What | Lib |
|---|---|---|
OpenInventory(): void | Opens the player's own inventory screen. | inventory.openInventory |
HasItem(item: string, count?: number): boolean | Whether the player holds the item. | inventory.hasItem |
GetCurrentWeapon(): HeldWeapon | null | The weapon item in hand (name, label, image?). | inventory.currentWeapon |
OpenItemPicker(requestId: number, request: ItemPickerRequest): void | Admin 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.
| Export | What | Lib |
|---|---|---|
AddRadialItem(item: RadialItem): void | Adds or replaces an item (id, label, icon?, parent?, items?, canShow?, onPressed?, keepOpen?, whileDead?). | radial.add |
RemoveRadialItem(id: string): void | Removes an item. | radial.remove |
RefreshRadial(): void | Reads every canShow of an open wheel again. | radial.refresh |
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
| Export | What | Lib |
|---|---|---|
GetGestureProvider(): string | null | The emote script answering hands up and pointing. | gestures.provider |
IsHandsUp(): boolean | The local player has the hands up. | gestures.isHandsUp |
IsPointing(): boolean | The local player points. | gestures.isPointing |
Appearance
| Export | What | Lib |
|---|---|---|
ApplyAppearance(ped: number, look: CharacterAppearance): boolean | Puts a look from GetCharacterAppearance on a ped of the same model through the active clothing script. | appearance.apply |
GetPedAppearance(ped: number): CharacterAppearance | null | The 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.