Skip to content

Appearance โ€” Hooks & Open Files โ€‹

Hooks let you add your own rules to the script, or react when something happens, without editing the escrowed code. They work like ox_inventory's registerHook.

  • Before hooks run before something happens. Return false (or false, 'Text', the player sees the text) to stop it. Hooks marked changeable may also change data: the script uses what you leave in it.
  • After events run once it has happened. Use them for logs, XP, rewards or a Discord webhook.
WhereFor
bridge/hooks/server.luaServer owners. Not escrowed: an empty function for every hook. Fill in the ones you need.
exports.fwb_appearance:registerHook(name, fn)Other resources (a before hook)
AddEventHandler('fwb_appearance:<event>', fn)Other resources (every after event)

NOTE

Developer note: these open functions are for your own rules and integrations. FWB Studio does not support third-party code written inside them.


Before hooks โ€‹

HookWhendata
openShopA player opens a shopsource, shopId, shopName, type
payA player pays (the price is already worked out)source, shopId, shopName, type, total, account ('cash' | 'bank'), appearance, old
saveCreatorThe creator is savedsource, appearance
saveClothesAnother script saves the player's clothes (outfit bag, uniform script, WearOutfit) ยท changeablesource, appearance
legacySaveA save from a script made for another clothing system (esx_skin:save, qb-clothing:saveSkin, illenium saveAppearance)source, from, appearance
openWardrobeA wardrobe openssource, wardrobe, label, shared
wardrobeSomething is done in a wardrobesource, wardrobe, action, outfitId, name, code
bossA boss menu action of a player owned shopsource, shopId, action, payload, role
adminAn admin menu actionsource, action, payload
deleteCharacterA deleted character's look and wardrobes are about to be removed. false keeps themidentifier

Example โ€‹

lua
-- bridge/hooks/server.lua
function before.pay(data)
    if Player(data.source).state.wanted then
        return false, 'Not while you are wanted'
    end
    return true
end

After events โ€‹

EventWhendata
appearanceSavedA look was savedsource, identifier, appearance, reason (shop | creator | clothes | legacy | export)
purchasedA player paid in a shopsource, shopId, shopName, type, total, account, appearance
creatorFinishedA new character finished the creatorsource, appearance
outfitWornAn outfit was put on from a wardrobesource, wardrobe, outfitId, job, appearance
wardrobeChangedAn outfit was saved, renamed, deleted, shared, taken out ...source, wardrobe, action, outfitId, name, code
bossChangedSomething changed in a boss menusource, shopId, action, payload
deliveredStock was unloaded at a player owned shopsource, shopId, units
adminChangedThe admin changed somethingsource, action, payload
characterDeletedA deleted character's look and wardrobes were removedidentifier

Example โ€‹

lua
AddEventHandler('fwb_appearance:purchased', function(data)
    print(('%s paid $%d in %s'):format(GetPlayerName(data.source), data.total, data.shopName))
end)

Open files โ€‹

Every file in bridge/ is not escrowed. Change them freely; keep your copy when you update.

FileWhat it is for
bridge/hooks/server.lua, bridge/hooks/client.luaThe hooks on this page and on Client Hooks
bridge/creator.luaThe creator's starting look for men and women
bridge/framework/*ESX, QBCore, Qbox and standalone: players, money, jobs, identifiers
bridge/inventory/*Clothing as items: ox_inventory, qb-inventory, qs-inventory, codem, core, jpr, one, origen, ps, tgiann
bridge/import/*Importing looks and outfits from esx_skin, illenium-appearance, fivem-appearance, qb-clothing, bl_appearance, nf-skins, onex, rcore_clothing (_template for your own)
bridge/society.luaWhere shop money goes for player owned shops
bridge/capture.luaThe picture studio: base clothes, hidden body parts, creator peds
bridge/themes.luaThe menu themes

FWB Studio documentation.