Skip to content

Events, hooks & commands ​

Server events ​

server

Local server events (AddEventHandler), fired with TriggerEvent after the server did the work. They never travel over the network.

Event Arguments Fired when
np_clothing:server:ready none Stores are loaded and requests are answered
np_clothing:outfitApplied src, outfit, reason A saved look changed. outfit is the full look; reason is e.g. 'store', 'wardrobe', 'locker', 'export'
np_clothing:purchased src, { store, pieces = { { id, t, price, label } }, total, ref, method, fake } A checkout went through
np_clothing:uniformPublished { faction, uniform, name, version, by } A leader published a set, and the lockers were refitted
np_clothing:catalogueChanged { build, hash, added, missing, returned, pieces, moved } A catalogue scan found a difference
lua
AddEventHandler('np_clothing:purchased', function(src, receipt)
  if receipt.fake then print(src, 'bought counterfeits at', receipt.store) end
end)

AddEventHandler('np_clothing:catalogueChanged', function(diff)
  if #diff.missing > 0 then print('clothing packs missing:', table.concat(diff.missing, ', ')) end
end)

Client event ​

client

Event Arguments Fired when
np_clothing:client:applied outfit The local ped was dressed. np_tattoos re-applies its ink on it

Hooks ​

exports.np_clothing:registerHook(name, fn) returns an id. Return false, 'reason' to veto. Hooks run in registration order inside pcall, so a hook that errors is skipped and logged. They are removed when your resource stops, or with removeHook(id).

Hook Payload Vetoes
beforePurchase { source, store, pieces = { { id, t, price } }, total } A checkout, before any money moves
beforeApply { source, outfit, reason } Any saved look change (stores, wardrobe, lockers, exports, staff)
beforeUniformPublish { source, faction, uniform, name, version } Publishing a uniform set, before the faction is charged

A veto reaches the player as vetoed:<reason>.

lua
exports.np_clothing:registerHook('beforeApply', function(data)
  if Player(data.source).state.isInSurgery then return false, 'not_now' end
end)

State bags ​

State bag Value
npcMasked Replicated true while the player wears a mask in c1 (anything but the default piece)
npgBandana Read only: set by np_gangs. While true, c1 is locked to np_gangs

Commands ​

Command Who Description
/clothes [word | restore] everyone Quick toggles: hat, glasses, mask, top, shirt, vest, pants, shoes, bag, chain, ears, watch, bracelet, gloves; restore puts everything back
/outfit <1-4> everyone Quick switch to the outfit on that hotkey (Config.QuickSwitch.command)
/checkfit on-duty Config.Store.authJobs, luxury store staff Authenticity check of the closest player (Counterfeits)
/clothing [packs] np_clothing.packs Opens the pack manager
/clothing scan np_clothing.packs Scans the catalogue now
/clothing thumbs <slot> [pack] np_clothing.packs Renders piece thumbnails (needs screenshot-basic)

Key bindings (Settings → Key Bindings → FiveM, unbound by default): the four outfit hotkeys and the quick toggles menu. Stores, wardrobes, outfitters and lockers open with E at their prompt.

Net events ​

Server → client events such as np_clothing:nui, np_clothing:apply and np_clothing:rpcResult are internal. Don't trigger them yourself; use the exports.