Skip to content

Exports ​

All exports are called as exports.np_clothing:<name>(...). Server exports answer nil, false or {} until np_clothing:server:ready. An export that needs a part of np_clothing that isn't running answers nil, 'not_available'. Every table you get back is a copy.

Formats ​

Shape Description
Piece id "<sex>/<slot>/<pack>/<number>", e.g. m/c11/mp_m_freemode_01_mp_m_lowrider_01/3. Base game: m/c11//287. See Update-proof clothing IDs
Slots Components c1 c3 c4 c5 c6 c7 c8 c9 c10 c11, props p0 p1 p2 p6 p7. sex is m (mp_m_freemode_01) or f (mp_f_freemode_01)
Worn { id = <piece id>, t = <texture>, pal = <palette 0..3 | nil> }
Outfit { [slot] = Worn | false }. false removes a prop. A missing slot stays untouched
Owned { identifier, piece, textures (nil = every colourway), source, fake (every colourway fake), fakeTextures (colourways owned only as fakes), serial, boughtAt, price }

Server ​

server

Export Returns Description
getOutfit(src) Outfit | nil What the player wears now, as piece ids
applyOutfit(src, outfit, opts?) Outfit | nil, err Saves the outfit and dresses the player. opts.replace: the outfit is the whole look, missing slots go back to their defaults. opts.force: ignore slot locks (uniform, bandana). Runs the beforeApply hook
storeOutfit(src, tag) bool Saves the current look under tag, e.g. 'prison'. Survives restarts
restoreOutfit(src, tag) Outfit | nil, err Puts the stored look back on (forced) and forgets it. Error: not_found
givePiece(identOrSrc, pieceId, opts?) Owned | nil, err opts = { source = 'gift', textures?, fake?, serial?, price? }. textures = nil grants every colourway. Works for offline characters
hasPiece(identOrSrc, pieceId, texture?) bool In ownership mode free, true for every available piece
getOwned(identOrSrc, filter?) Owned[] filter = { slot?, sex? }
openStore(src, storeId) true | nil, err Opens a store's screen for the player, without the distance check
openWardrobe(src, opts?) true | nil, err opts = { id?, label?, capacity? }, for a property's closet. The session lives where the player stands
openLocker(src, faction) true | nil, err Opens a faction locker. The player must be a member
isPieceAvailable(pieceId) bool The piece is known, its pack is streamed and released, and it is not hidden
resolvePiece(pieceId) PieceRecord | nil The catalogue row: label, brand, pack, textures, price override
isMasked(src) bool The player wears a mask (c1). The same value is in the state bag npcMasked
getUniform(src) { faction, uniform, name, version, onDuty } | nil The uniform set the player wears
registerStore(def) storeId | nil, err A runtime store with the shape of a Config.Stores entry. Removed when your resource stops
registerHook(name, fn) id | nil See Hooks. Removed when your resource stops
removeHook(id) bool
lua
-- a gift from an event resource, every colourway
exports.np_clothing:givePiece(src, 'm/c11/mp_m_freemode_01_mp_m_lowrider_01/3', { source = 'gift' })

-- a jail resource
exports.np_clothing:storeOutfit(src, 'prison')
exports.np_clothing:applyOutfit(src, {
  c11 = { id = 'm/c11//5', t = 0 }, c4 = { id = 'm/c4//7', t = 0 }, p0 = false,
}, { force = true })
-- on release
exports.np_clothing:restoreOutfit(src, 'prison')

-- a pop-up store for a weekend event
local id = exports.np_clothing:registerStore({
  id = 'popup_vinewood', label = 'Pop-up', logo = 'stores/suburban', tier = 'mid', kind = 'standard',
  labels = { 'bigness', 'squash' }, locations = { { coords = vector4(300.0, 180.0, 104.0, 0.0), area = 'Vinewood' } },
})

Client ​

client

Export Returns Description
applyOutfit(outfit, opts?) bool Changes only what this client shows (previews, cutscenes). Nothing is saved
readOutfit() Outfit | nil What the local ped wears, as piece ids
keyFromPed(ped, slot) Worn | false | nil The piece id of one slot of any ped
openStore(storeId) bool Asks the server to open the store screen. The server checks distance and opening hours
openWardrobe() bool The nearest configured wardrobe
isBusy() bool A clothing screen or the dressing camera is open
openQuick() bool Opens the quick toggles. np_menu's Clothing entry calls it
isSlotLocked(slot) bool The slot is locked by a uniform or the np_gangs bandana
lua
-- don't open your own UI over a clothing screen
if exports.np_clothing:isBusy() then return end

-- a cutscene outfit, local only
exports.np_clothing:applyOutfit({ c11 = { id = 'm/c11//4', t = 0 } })