Exports
Client and server exports of Yecoyz Appearance for other resources.
Get yecoyz_appearanceOther resources can open the menu, read and set appearances, and check the menu state through exports. Call a client export with exports['yecoyz_appearance']:name(...) on the client, and a server export with the same syntax on the server.
Yecoyz Appearance also provides the esx_skin, skinchanger, qb-clothing, fivem-appearance and illenium-appearance names, so most scripts that call those work without changes.
Client exports
| Export | Arguments | Returns | Description |
|---|---|---|---|
startPlayerCustomization |
callback, config |
Nothing | Opens the full menu. Does nothing if it is already open. config takes allowExit, ped, tabs and isNewCharacter. |
setPedAppearance |
ped, appearance |
true, or false if the ped doesn't exist |
Applies an appearance to any ped. ESX and skinchanger formats are converted automatically. |
getPedAppearance |
ped |
Appearance table, or nil |
Reads the current appearance of any ped. |
setPlayerAppearance |
appearance |
true |
Applies an appearance to the local player and saves it to the database. |
getPlayerAppearance |
None | Appearance table | Returns the local player's current appearance. |
loadPlayerAppearance |
callback (optional) |
Nothing | Loads the saved appearance from the database and applies it. callback(appearance) runs afterwards. |
openClothingMenu |
callback (optional) |
Nothing | Opens the clothing and accessories tabs only. |
openBarberMenu |
callback (optional) |
Nothing | Opens the barber tab only. |
openSurgeonMenu |
callback (optional) |
Nothing | Opens the face tab only. |
openMaskMenu |
callback (optional) |
Nothing | Opens the clothing tab in mask mode. |
openOutfitMenu |
None | Nothing | Opens the list of saved outfits. |
openPedMenu |
pedModels (optional) |
Nothing | Opens the ped picker. Without a list it uses Config.Peds, or a built-in list if that is empty. |
isMenuOpen |
None | true or false |
Whether the menu is open. |
closeMenu |
None | Nothing | Closes the menu. |
NoteThe
callbackargument is passed to the menu, but it is not called when the player saves. To use the result, read it withgetPlayerAppearance()after the menu closes.
Server exports
| Export | Arguments | Returns | Description |
|---|---|---|---|
getPlayerAppearance |
source |
Appearance table, or nil |
The saved appearance of the player's character. |
setPlayerAppearance |
source, appearance |
true, or false if the player has no character |
Saves the appearance and applies it to the player. |
Example
Open the menu when a player uses your own command, then save the result:
-- client
RegisterCommand('makeover', function()
exports['yecoyz_appearance']:startPlayerCustomization(nil, { allowExit = true })
end)-- server
local appearance = exports['yecoyz_appearance']:getPlayerAppearance(source)
if appearance then
print(('Player %s has %d components'):format(source, #appearance.components))
endAppearance format
An appearance is a table in this shape. Components and props are keyed by their ID, and the other fields match DefaultAppearance in the config.
{
model = 'mp_m_freemode_01',
components = { [11] = { drawable = 15, texture = 0 } },
props = {},
headBlend = { shapeFirst = 0, shapeSecond = 0, skinFirst = 0, skinSecond = 0, shapeMix = 0.5, skinMix = 0.5 },
faceFeatures = {},
headOverlays = {},
hair = { style = 0, color = 0, highlight = 0 },
eyeColor = 0,
}