Skip to content

Server Exports ​

Call these from any server script.

Name in this pageWhat to pass
srcA player's server id
identifierA character's id: ESX xPlayer.identifier (e.g. char1:abc123), QBCore / Qbox citizenid
appearanceA look in the FWB Appearance format (see Client Exports)
outfit{ pieces = { ['11'] = { drawable, texture } }, props = { ['0'] = { drawable, texture } } }

Does it save? ​

ExportSaves to the database?Player must be online?
GetPlayerAppearanceNo (reads)Yes
GetCharacterAppearanceNo (reads)No
SavePlayerAppearanceYes, the whole lookYes
SetCharacterAppearanceYes, the whole lookNo (online players wear it at once)
WearOutfitYes (clothes), unless you pass falseYes
ReloadAppearanceNo (loads the saved look again)Yes
GetOutfitsNo (reads)Yes
AddOutfitYes (a new outfit in the wardrobe)Yes
OpenWardrobeOnly what the player does insideYes
AllowCreatorNo (lets the next creator save for free)Yes
DeleteCharacterDeletes the look, outfits and stored piecesNo

Looks ​

GetPlayerAppearance

The saved look of the character a player is playing.

Saves: no.

lua
local appearance, identifier = exports.fwb_appearance:GetPlayerAppearance(src)

Returns ​

  • the look (or nil when the character never saved one) and the character's id
GetCharacterAppearance

A character's saved look, also when the player is offline. Use it for an MDT photo, a mugshot ped or a character preview.

Saves: no.

lua
local appearance = exports.fwb_appearance:GetCharacterAppearance(identifier)

Returns ​

  • the look, or nil when the character has none
SavePlayerAppearance

Saves a whole look (body, face, hair, tattoos, clothes) for the character a player is playing.

Saves: yes, the whole look. The player sees it after ReloadAppearance or their next login. To save and show it at once, use SetCharacterAppearance.

lua
exports.fwb_appearance:SavePlayerAppearance(src, appearance)

Returns ​

  • true, or false when the player has no character loaded
SetCharacterAppearance

Saves a whole look for a character, also offline. When the player is online, they wear it at once.

Saves: yes, the whole look.

lua
exports.fwb_appearance:SetCharacterAppearance(identifier, appearance)

Returns ​

  • true, or false when identifier or appearance is wrong
ReloadAppearance

Makes a player load their saved look again (after your script changed it in the database).

Saves: no.

lua
exports.fwb_appearance:ReloadAppearance(src)

Outfits ​

WearOutfit

Puts an outfit on an online player. Pieces the outfit leaves out stay as they are.

Saves: yes, the clothes, unless save is false (a uniform for one shift, gone at the next login).

lua
exports.fwb_appearance:WearOutfit(src, outfit, save)

Example ​

lua
-- a uniform for the shift only
exports.fwb_appearance:WearOutfit(source, {
    pieces = { ['11'] = { drawable = 55, texture = 0 }, ['4'] = { drawable = 35, texture = 0 } },
}, false)
AddOutfit

Adds an outfit to a player's wardrobe (a job uniform to keep, a reward, a gift).

Saves: yes. The outfit is in the wardrobe for good.

lua
exports.fwb_appearance:AddOutfit(src, name, outfit, wardrobe, model)
  • wardrobe: the wardrobe's id. nil = 'personal'.
  • model: 'mp_m_freemode_01' or 'mp_f_freemode_01'. nil = the player's own model.

Returns ​

  • true, or false when the player has no character loaded
GetOutfits

The outfits in a player's wardrobe.

Saves: no.

lua
local outfits = exports.fwb_appearance:GetOutfits(src, wardrobe)
-- { { id = 12, name = 'Work', model = 'mp_m_freemode_01', outfit = { pieces = {...}, props = {...} } } }

OpenWardrobe

Opens a wardrobe for a player. Only the server can open a shared wardrobe (everyone with access sees the same outfits), so your house script decides who may open it.

Saves: only what the player does inside.

lua
exports.fwb_appearance:OpenWardrobe(src, id, { label = 'Apartment 12', shared = true })

Creator ​

AllowCreator

Lets the player's next creator save for free, also when the character already has a look (a plastic surgeon event, a character reset, a multicharacter with its own starting look).

Saves: no. The creator saves when the player presses Finish.

lua
exports.fwb_appearance:AllowCreator(src)
TriggerClientEvent('my-script:openCreator', src) -- your client then calls exports.fwb_appearance:OpenCreator()

Characters ​

DeleteCharacter

Removes a deleted character's look, outfits and stored pieces. Multicharacter scripts call it when a character is deleted. Characters that no longer exist in the framework are also cleaned up at every start.

Saves: deletes from the database. Stop it with the deleteCharacter hook.

lua
exports.fwb_appearance:DeleteCharacter(identifier)

Hooks ​

registerHook

Adds a server hook from another resource. Same names as in bridge/hooks/server.lua. See Hooks & Open Files.

lua
exports.fwb_appearance:registerHook('pay', function(data)
    if Player(data.source).state.wanted then return false, 'Not while you are wanted' end
    return true
end)
fwbClothing

The version of the clothing contract other FWB scripts check (returns 1).

lua
local version = exports.fwb_appearance:fwbClothing()

FWB Studio documentation.