Skip to Content

Hooks

A hook runs before LB Appearance does something, and can change or cancel it. The handler gets the hook’s data, and returns:

  • false to cancel
  • new data to replace it
  • nothing to keep the data as it is
HookSideDataRuns before
savingAppearanceClientAppearanceThe player’s appearance is saved
savingOutfitClientAppearanceThe player saves what they wear as an outfit
usingOutfitBagClientUsingOutfitBagHookDataThe player uses an outfit bag

usingOutfitBag can only be cancelled.

---@class OutfitBagContents ---@field gender "male" | "female" ---@field clothes ClothingPiece[] ---@class UsingOutfitBagHookData ---@field worn ClothingPiece[] # The clothes that go into the bag ---@field contents? OutfitBagContents # The clothes that come out of the bag, nil when it's empty

See GetAppearance for Appearance, and lb-appearance:purchased for ClothingPiece.

RegisterHook

Registers a hook handler. The export returns an ID that can be passed to RemoveHook.

---@param name "savingAppearance" | "savingOutfit" | "usingOutfitBag" ---@param handler fun(data: any): any ---@return number hookId local hookId = exports["lb-appearance"]:RegisterHook(name, handler)

For example, stop players from using outfit bags while cuffed:

exports["lb-appearance"]:RegisterHook("usingOutfitBag", function() if IsPedCuffed(PlayerPedId()) then return false end end)

Hooks are automatically removed when the resource that registered them stops.

RemoveHook

---@param hookId number exports["lb-appearance"]:RemoveHook(hookId)