Appearance
Read a character's stored look from whichever clothing script the server runs.
Looks go through ai-core, never through a clothing script's own exports, events or tables (ai-appearance included). ai-core reads them from the active clothing script: the one the panel's Clothing script setting picks, or the first one running. Putting a look on a ped happens on the client (client export ApplyAppearance, lib appearance.apply); see Client exports.
A look is a CharacterAppearance: { model, data }. model is the ped model hash; data is the clothing script's own format. Treat data as a sealed box: pass it back to ApplyAppearance unchanged.
GetAppearanceSystem
The resource name of the clothing script ai-core reads looks from.
Side: Server · Waits: no · Lib: appearance.provider()
GetAppearanceSystem(): string | nulllocal system = exports['ai-core']:GetAppearanceSystem() -- string or nilParameters
None.
Returns
string | null: the clothing script's resource name. null when none runs (peds then wear default clothes).
Example
import { addCommand, resourceExport } from "@aicore-fivem/lib/server";
const core = resourceExport("ai-core");
addCommand("clothingsystem", { help: "Shows the clothing script in use", restricted: true }, () => {
console.log(core.GetAppearanceSystem() ?? "none");
});GetCharacterAppearance
A character's stored look, whether the character is loaded or not. Use it to dress a ped as that character: a sleeping body, a statue, a photo, a preview.
Side: Server · Waits: no (answers through done) · Lib: appearance.get(charId) returns a Promise
GetCharacterAppearance(charId: number, done: (look: CharacterAppearance | null) => void): voidexports['ai-core']:GetCharacterAppearance(charId, function(look) end) -- look: table or nilParameters
Prop
Type
Returns
Nothing. done gets { model, data }, or null when the character has no stored look, no clothing script runs, charId is not a positive whole number, or the clothing script failed (logged). Without a function as done the call does nothing.
Example
import { onClientCallback, online, resourceExport } from "@aicore-fivem/lib/server";
import { fail } from "@aicore-fivem/lib/shared";
import type { CharacterAppearance } from "@aicore-fivem/shared";
const core = resourceExport("ai-core");
// The client asks for the player's own look to dress a photo-booth ped.
onClientCallback("myscript:myLook", async (source) => {
const charId = online.charId(source);
if (charId === undefined) return fail("NO_CHARACTER");
const look = await new Promise<CharacterAppearance | null>((resolve) => core.GetCharacterAppearance(charId, resolve));
return look ? { ok: true, look } : fail("NO_LOOK");
});A look can be a few kilobytes. Send it to the one player who needs it, never to everyone (-1).