ai-appearance for developers
ai-appearance's client exports, the job outfit shape and the events it uses with AI Core's character screen.
Do not call ai-appearance or read its table from your script. Use AI Core's appearance layer: lib appearance (server appearance.get(charId), client appearance.apply(ped, look), appearance.read(ped), appearance.openMenu(...), appearance.wearOutfit(outfit), appearance.reloadSkin()), or aiLib.appearance in Lua. It works with every clothing script AI Core supports, so the owner can replace ai-appearance. See the lib reference.
Client exports
Typed AiAppearanceClientExports in @aicore-fivem/shared. AI Core's appearance adapter calls them.
ApplyAppearance
Puts an ai-appearance look on a ped.
Side: Client · Waits: no
ApplyAppearance(ped: number, appearance: unknown): booleanlocal ok = exports['ai-appearance']:ApplyAppearance(ped, look)Parameters
Prop
Type
Returns
boolean: true when the look was applied. false when the look is invalid or the ped's model is not the look's model.
GetPedAppearance
Reads the look the local player wears.
Side: Client · Waits: no
GetPedAppearance(ped: number): unknownReturns
The local player's Appearance, or null for any other ped.
WearOutfit
Puts a job outfit (uniform) on the local player. Only the listed pieces change, and the outfit is never saved as the player's own look.
Side: Client · Waits: no
WearOutfit(outfit: JobOutfit): voidexports['ai-appearance']:WearOutfit({ components = { { id = 11, collection = '', index = 55, texture = 0 } }, props = {} })JobOutfit
Prop
Type
OutfitPiece
Prop
Type
Returns
Nothing.
ReloadSkin
Puts the saved look back on the local player (takes a job outfit off). Side: Client · Waits: no.
ReloadSkin(): voidExample
import { appearance } from "@aicore-fivem/lib/client";
import type { JobOutfit } from "@aicore-fivem/shared";
// Through AI Core: works with ai-appearance and the other supported clothing scripts.
const uniform: JobOutfit = {
components: [
{ id: 11, collection: "", index: 55, texture: 0 },
{ id: 4, collection: "", index: 35, texture: 0 },
],
props: [{ id: 0, collection: "", index: 46, texture: 0 }],
};
RegisterCommand("uniform", () => appearance.wearOutfit(uniform), false);
RegisterCommand("ownclothes", () => appearance.reloadSkin(), false);Outfit pieces are addressed by collection name and the index inside it, not by GTA's global drawable number. The base game is collection "". Through AI Core, appearance.wearOutfit and reloadSkin answer false when the running clothing script has no job outfit support.
Events
| Event | Side | Arguments | What it is |
|---|---|---|---|
ai-core:client:characterPortrait | Client (local) | charId: number, url: string | ai-appearance sends each card's portrait (https://nui-img/...) to AI Core's character screen. |
ai-appearance listens to AI Core's server event characterScreen (src, charIds) to know which portraits to make, and to lib onCharacter to dress a loaded character or start the creator.
Database
Table ai_appearance_characters: char_id (= ai_core_characters.id) and data (the Appearance JSON). Only ai-appearance writes it. AI Core's adapter reads it for GetCharacterAppearance.
Log channel
purchases: every paid store visit (through AI Core's logs: console, Discord, Fivemanage, FiveM Stats as the owner set them).