API
Events and callbacks for Yecoyz Appearance, for scripts that talk to it directly.
Get yecoyz_appearanceMost scripts should use the exports. Use the events and callbacks below when you need to talk to Appearance directly.
Client events
| Event | Arguments | Description |
|---|---|---|
yecoyz_appearance:openMenu |
options |
Opens the menu. The options are the ones startPlayerCustomization and the other open exports use: allowExit, ped, tabs, categories, isNewCharacter, pedModels, initialModel, shopMode, shopPrice. |
yecoyz_appearance:closeMenu |
None | Closes the menu and unfreezes the player. |
yecoyz_appearance:applyAppearance |
ped, appearance |
Applies an appearance to a ped. For the local player it also updates the saved current appearance. |
yecoyz_appearance:applyReloadedSkin |
appearance |
Applies an appearance reloaded from the database, used by /reloadskin. |
yecoyz_appearance:menuStateChanged |
open (boolean) |
Sent when the menu opens or closes. |
lua
-- client: open the barber tab only
TriggerEvent('yecoyz_appearance:openMenu', { categories = { 'barber' }, allowExit = true })Server events
| Event | Arguments | Description |
|---|---|---|
yecoyz_appearance:saveAppearance |
appearance |
Saves the appearance of the player who sent it. |
yecoyz_appearance:reloadSkin |
None | Reloads the player's saved appearance from the database and applies it. |
Server callbacks
Call these with Core.Callback from a resource that loads @yecoyz_core/import.lua. See the yecoyz_core callbacks.
| Callback | Arguments | Returns | Description |
|---|---|---|---|
yecoyz_appearance:getAppearance |
source |
Appearance table, or nil |
The player's saved appearance. |
yecoyz_appearance:getOutfits |
source |
List of outfits | The player's saved outfits, newest first. Each has id, name and outfit_data. |
yecoyz_appearance:saveOutfit |
source, name, outfitData |
true or false |
Saves an outfit. Fails when the outfit limit (Config.Shops.MaxOutfits) is reached. |
yecoyz_appearance:deleteOutfit |
source, outfitId |
true or false |
Deletes one of the player's outfits. |
yecoyz_appearance:shopPurchase |
source, shopMode, appearance |
{ success, price } or { success = false, reason } |
Charges the player for a shop item and returns the result. reason is invalid_data or no_money. |
lua
-- client
local appearance = Core.Callback.Await('yecoyz_appearance:getAppearance')