Clothing & Wear
Clothing & Wear
Clothing items that actually go on the ped.
Config.Wear = { enabled = true }
Worn slots
Each player has a wear: container — a small set of slots for hat, glasses, ears, mask, torso, vest, legs, shoes, bag, watch (Config.Wear.slots). Putting an item there changes the ped with the game's own component and prop natives, reading what the ped wore first and putting it back when the item comes off, so it works on whatever clothing resource the server runs. A watchdog puts the item back on top when a clothing resource re-dresses the player.
With the inventory open, press C and the middle column becomes the character: a bag on each side and the person between them. The fullscreen layout opens on it, and in the compact layout it takes the right-hand panel's place. The key can be changed in the inventory's settings (Clothing key).
Variants
One clothing item can map to a specific drawable and texture, so "Blue Hoodie" and "Red Hoodie" are two items rather than one item and a menu.
invvariant <playerId> <slot> <drawable> [texture]
invvariant <playerId> <slot> clear
invwear prints the component, drawable and texture of what a player has on — useful when you are building a clothing catalogue and need to know what the numbers actually are.
Metadata-driven
Variant data rides on the item's metadata, which means a specific shirt keeps its exact appearance through trading, storage and restarts. Two identical-looking hoodies with different metadata stay in separate slots.
Outfits
exports.aty_inventory:SetOutfit(playerId, slot, components)
exports.aty_inventory:GetOutfit(playerId, slot)
An outfit is a whole set of clothes folded into one item — a uniform bag, a duffel of ski masks. SetOutfit writes the component list onto the item in that slot of the player's bag (metadata.outfit; passing nothing empties it), and GetOutfit reads it back. Using the item hands the list to whoever dresses people on the server. The inventory does not read a ped to build one: the clothing resource does that and calls SetOutfit.
invoutfit <playerId> <slot> what is folded in that item
invoutfittest self-test
Providers
A clothing resource can take over putting things on the ped, from its client:
exports.aty_inventory:RegisterWearProvider({
apply = function(list) --[[ put the kit on the ped ]] end,
})
It receives the whole worn kit, and outfits, and owns applying them; the watchdog stands down.