Skip to content

Exports, events & hooks ​

The code is protected by escrow, but these exports, events and config hooks let your other scripts work with ZAIDERS Appearance.

Client exports ​

openShop ​

Opens a menu wherever the player is: a housing wardrobe, a job locker, an ox_target zone on a shop.

lua
exports.zaiders_appearance:openShop('clothing')                      -- the clothing store
exports.zaiders_appearance:openShop('barber')                        -- the barber shop
exports.zaiders_appearance:openShop('tattoo')                        -- the tattoo shop
exports.zaiders_appearance:openShop('wardrobe')                      -- outfits and uniforms
exports.zaiders_appearance:openShop('wardrobe', { tab = 'job' })     -- straight to the job's uniforms
exports.zaiders_appearance:openShop('wardrobe', { tab = 'gang' })    -- straight to the gang's uniforms

It returns true when the kind is valid and the menu is on its way, and false for an unknown kind. The usual rules still apply: the player can't be dead, downed or cuffed, Config.CanOpenMenu is asked, and the server checks every payment and save, wherever the menu was opened.

lua
-- An ox_target zone that opens the wardrobe of a police station
exports.ox_target:addBoxZone({
    coords = vec3(461.5, -998.1, 30.6),
    size = vec3(2, 2, 2),
    options = {
        {
            label = 'Locker room',
            icon = 'fa-solid fa-shirt',
            groups = 'police',
            onSelect = function()
                exports.zaiders_appearance:openShop('wardrobe', { tab = 'job' })
            end,
        },
    },
})

isOpen ​

lua
if exports.zaiders_appearance:isOpen() then
    -- a menu is open, or opening
end

Server exports ​

ownsPed ​

Whether a player's current character owns a ped of the Peds shop (bought, given or redeemed with a code):

lua
local owns = exports.zaiders_appearance:ownsPed(source, 'a_c_chop')  -- true or false

Client events ​

HUD ​

Fired when a menu or the panel opens and closes. Your HUD can listen to it to hide itself:

lua
-- hidden: true when a menu opens, false when it closes
-- menu: 'clothing', 'barber', 'tattoo', 'wardrobe', 'creator' or 'panel'
AddEventHandler('zaiders_appearance:hud', function(hidden, menu)
    -- your HUD here
end)

If your HUD has an export to show and hide it, you don't need code: add it to Config.HideHud.resources. See Config reference.

Creator closed ​

Fired when the character creator closes, normally right after the new character is saved:

lua
AddEventHandler('zaiders_appearance:creator:closed', function()
    -- for example, show your spawn selector
end)

Config hooks ​

shared/config.lua is open, so you can write small functions there that run in the player's game.

Your notifications ​

lua
Config.Notify = function(text, kind)
    -- kind: 'inform', 'success' or 'error'
    exports['my_notify']:Notify(text, kind)
end

Your own rule to open the menus ​

lua
Config.CanOpenMenu = function()
    -- return false to keep the menu closed, for example during a police chase
    return not LocalPlayer.state.inChase
end

Your HUD ​

lua
Config.HideHud = {
    enabled = true,
    resources = {
        { resource = 'my-hud', export = 'SetHudVisible' },                    -- gets false on open, true on close
        { resource = 'other-hud', event = 'other-hud:toggle', hide = false, show = true },
        { resource = 'third-hud', export = 'SetVisible', changed = 'third-hud:changed' },
    },
    custom = function(hidden, menu)
        -- anything else
    end,
}

Exports of other clothing menus ​

ZAIDERS Appearance also answers the exports and events of illenium-appearance, fivem-appearance, qb-clothing and ESX's skinchanger and esx_skin, while those resources aren't running. Scripts made for them work without changes. See Frameworks & compatibility.

The appearance format ​

Looks are saved in QBCore's appearance format, the same JSON illenium-appearance and qb-clothing use, in playerskins.skin (QBCore and Qbox) or in skinchanger's format in users.skin (ESX). In the menu, Peds → Character JSON copies a character's look in that format. Admins can also paste one there.

Support for Zaiders Store FiveM clothing packs and scripts.