All resources

rsg-wardrobe – Technical Documentation#

Contents#

  1. Architecture
  2. Data formats
    • Wardrobe menu (NUI)
    • Persistence
  3. Exports
  4. Events and callbacks
  5. Security model
  6. Database
  7. How-tos
  8. Troubleshooting

1. Architecture#

FilePurpose
fxmanifest.luaManifest; locales via @rsg-core/shared/locale.lua
shared/config.luaPermission, cooldown, clothing slots, skin colour table
server/server.luaCommands, permission/jail/cooldown checks, skin callback, server exports
client/client.luaToggle logic, natives, bare body re-apply, hat anim, revive re-apply, client exports
client/menu.luaNUI bridge, outfits, clothing care, /hattip
html/Wardrobe menu (index.html, style.css, app.js)
server/versionchecker.luaChecks GitHub for a newer version
locales/*.jsonPlayer-facing text

Command flow: player types a command → server checks ACE, jail (for /dress//undress) and cooldown → triggers a client event → client removes or restores the item and remembers the removed hash so the next toggle puts back the same item.

Menu flow: /wardrobe (server checks ACE) → rsg-wardrobe:client:openMenu → menu.lua sends locale text, slot labels and state to the NUI → clicks post NUI callbacks → menu.lua forwards them to server events/callbacks, which run the same checks as commands → client refreshes the slot state.

When clothing is removed, the bare upper or lower body is re-applied from rsg-character's GetBodyComponents() ({ male, female }) using the player's body_size and skin_tone from playerskins.skin.

2. Data formats#

Config.ClothingComponents entry:

{ name = 'hat', comps = 'hats', data = 'currentHat', hash = 2569388135 }
  • name – used by commands and exports
  • comps – key in exports['rsg-character']:GetClothesCache()
  • data – client state key that stores the removed component hash
  • hash – ped component category hash (0 for shirt wearable states)

Config.SkinColours entry: { body = 1..5, colour = 1..6, index = n }.

Animation entries (Config.HatAnimation.Anim, Config.Care.BrushAnim, Config.Care.DryAnim):

{ dict = 'mech_loco@player@zero@generic@streamed_idles@a', clip = 'fidget_dust_off', duration = 4000 }

Played upper-body only (flag 31) and skipped when mounted, in a vehicle or dead. Values come from rdr3_discoveries animations/ingameanims/ingameanims_list.lua.

GetClothingState() / NUI slot entry:

{ name = 'hat', worn = true, removed = false, available = true }

available is false when the slot isn't worn, wasn't removed and isn't in the rsg-character clothes cache (greyed out in the menu).

Wardrobe menu (NUI)#

FilePurpose
html/index.htmlPanel with Clothing / Outfits / Care tabs and a name/confirm modal
html/style.cssLeather & gold house theme (Roboto, monochrome, no vignette, no native selects)
html/app.jsRendering, tab switching, NUI callbacks, drag-to-move

NUI messages from Lua: open (text, labels, state), state (refresh), close. All text comes from the locale files (ui_* and slot_* keys); the NUI escapes every string it renders.

The dirt bar reads _GET_PED_DIRT_LEVEL (0x0105FEE8F9091255) and colours green < 35%, amber < 70%, red above. Wetness has no getter, so it isn't shown.

Persistence#

WhatWhereLifetime
Saved outfitsplayeroutfit tablePermanent
Current outfitplayerskins.clothes (updated when wearing an outfit)Permanent
Removed items (for toggling back)Client memoryUntil relog, outfit change or /undress
Removed slot listwardrobeRemoved replicated state bagSame as above
Menu positionPlayer's NUI localStorage (rsg-wardrobe:pos)Per client, survives restarts

3. Exports#

Server#

ExportParamsReturnsNotes
TogglePlayerClothing(src, name)player id, slot name–No permission check
RemovePlayerClothing(src)player id–Strips all clothing
DressPlayer(src)player id–Applies saved playerskins.clothes

Client#

ExportParamsReturns
ToggleClothing(name)slot name–
RemoveAllClothing()––
IsWearing(name)slot namenative result (truthy when worn)
GetClothingState()–{ { name, worn, removed, available }, ... }
OpenWardrobe()––
CleanClothes()–clears dirt and wetness (no anim)

State bag: wardrobeRemoved (replicated) – array of slot names the player has taken off.

4. Events and callbacks#

NameSidePayload
rsg-wardrobe:client:OnOffClothingclientslot name
rsg-wardrobe:client:removeAllClothingclient–
rsg-wardrobe:client:dressclientclothes table
rsg-wardrobe:server:getPlayerSkincallbackreturns playerskins.skin JSON string
rsg-wardrobe:client:openMenuclient–
rsg-wardrobe:server:toggleserverslot name (validated against the command list)
rsg-wardrobe:server:undress / :dressserver–
rsg-wardrobe:server:getOutfitscallback{ id, name, is_default }[]
rsg-wardrobe:server:saveOutfitcallbackname → bool
rsg-wardrobe:server:wearOutfitcallbackid → bool (also sends client:dress)
rsg-wardrobe:server:deleteOutfitcallbackid → bool

NUI callbacks: close, toggle, undress, dress, getOutfits, saveOutfit, wearOutfit, deleteOutfit, care (brush/dry/hattip).

Also listens to rsg-medic:client:revive to keep removed items off.

Listens to rsg-character:client:ApplyClothes (resets remembered items) and triggers rsg-weapons:server:RemoveAllObjects when undressing.

5. Security model#

  • No money or items are handled.
  • All commands check Config.RequiredPermission and a per-player cooldown (Config.CommandCooldown).
  • /dress and /undress are blocked while metadata.injail > 0.
  • /dress reads the outfit from the database on the server; the client never sends clothing data.
  • Client events only change the caller's own ped, so triggering them from a cheat client has no effect on others.
  • Menu events go through the same permission/jail/cooldown checks as commands; slot names are checked against the server's command list.
  • Outfits: saving copies the player's current playerskins.clothes on the server, never client data, so outfits can't create clothing the player doesn't own. Wear/delete only touch rows with the player's citizenid; the Default outfit can't be deleted. Names are trimmed to 40 chars with control characters and <> removed, and the NUI escapes all text.
  • Clothing care and hat animations are purely visual (client-only).
  • Server exports perform no permission checks; calling resources must do their own.

6. Database#

No tables of its own. Uses rsg-character's tables:

  • playerskins (citizenid, skin, clothes) – read; clothes updated when wearing an outfit
  • playeroutfit (id, citizenid, name, clothes, is_default) – read/insert/delete

7. How-tos#

  • Restrict to a group: set Config.RequiredPermission = 'wardrobe' and add_ace group.vip command.wardrobe allow.
  • Remove a command: delete its line from toggleCommands in server/server.lua.
  • Change language: setr rsg:locale fr.
  • Disable a feature: set Config.Outfits.Enabled, Config.Care.Enabled or Config.HatAnimation.Enabled to false (the menu tab hides automatically).
  • Open from another script: exports['rsg-wardrobe']:OpenWardrobe() (e.g. from an rsg-target option on a wardrobe prop).
  • Change animations: look up dict/clip in rdr3_discoveries animations/ingameanims/ingameanims_list.lua and set them in config.

8. Troubleshooting#

ProblemCause / fix
Missing torso/legs after removing an itemPlayer skin not loaded yet; it loads 3 s after login or on resource restart
Toggle does nothingItem isn't in rsg-character's clothes cache (not part of the saved outfit)
"No saved outfit" on /dressPlayer has no clothes row in playerskins
Commands ignored when spammedCooldown working as intended
Menu doesn't openCheck ui_page files are present and no other NUI has focus
Outfits tab emptyrsg-character too old (no playeroutfit.is_default column); update rsg-character
Hat anim looks odd on womenThe clip is from the male rig; set Config.HatAnimation.Enabled = false or swap the anim
/hattip does nothingEmote not supported on the current ped/state (mounted, armed); test on foot
Locale keys showing instead of textrsg-core too old for @rsg-core/shared/locale.lua

Support the Project : https://rexshack.tebex.store/

<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

Generated from the source of rsg-wardrobe 3.1.0. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core, rsg-character, oxmysql

Configuration#

OptionDefaultNotes
Config.RequiredPermission''
Config.CommandCooldown750
Config.KeepRemovedOnRevivetrue
Config.MenutableWardrobe menu (NUI)
Config.Command'wardrobe'
Config.OutfitstableSaved outfits (uses rsg-character's playeroutfit table, no extra tables needed)
Config.Enabledtrue
Config.MaxOutfits30
Config.HatAnimationtableemote from rdr3_discoveries animations/kit_emotes_list/kit_emotes_list.lua
Config.Anim{ dict = 'mech_loco_m@character@arthur@fidgets@hat@normal@unarmed@norm
Config.SwapAt900
Config.FinishAfter700
Config.TipEmote'KIT_EMOTE_GREET_HAT_TIP_1'
Config.TipCommand'hattip'
Config.Caretableanims from rdr3_discoveries animations/ingameanims/ingameanims_list.lua
Config.BrushCommand'brushoff'
Config.DryCommand'dryoff'
Config.BrushClearsBloodtrue
Config.BrushAnim{ dict = 'mech_loco@player@zero@generic@streamed_idles@a', clip = 'fid
Config.DryAnim{ dict = 'mech_loco@generic@fallback@streamed_idles@shake_off', clip =
Config.ClothingComponents``
Config.SkinColours``

Exports#

Server

ExportArgumentsFile
TogglePlayerClothingsource, nameserver/server.lua
RemovePlayerClothingsourceserver/server.lua
DressPlayersourceserver/server.lua

Client

ExportArgumentsFile
GetClothingState``client/client.lua
ToggleClothing``client/client.lua
RemoveAllClothing``client/client.lua
IsWearingnameclient/client.lua
CleanClothes``client/menu.lua
OpenWardrobe``client/menu.lua
-- example
local result = exports['rsg-wardrobe']:TogglePlayerClothing(source, name)

Callbacks#

CallbackSideArgumentsFile
rsg-wardrobe:server:getPlayerSkinserversource, cbserver/server.lua
rsg-wardrobe:server:getOutfitsserversource, cbserver/server.lua
rsg-wardrobe:server:saveOutfitserversource, cb, nameserver/server.lua
rsg-wardrobe:server:deleteOutfitserversource, cb, idserver/server.lua
rsg-wardrobe:server:wearOutfitserversource, cb, idserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-wardrobe:server:getPlayerSkin', function(result)
    -- use result
end)

Events#

Server events can be fired by any client, so every handler re-validates the player, the arguments and any permission, distance or cooldown on the server. Never add a reward to a handler without those checks.

EventSideArgumentsFile
RSGCore:Client:OnPlayerLoadedclient``client/client.lua
rsg-medic:client:reviveclient``client/client.lua
rsg-wardrobe:client:OnOffClothingclient``client/client.lua
rsg-wardrobe:client:dressclient``client/client.lua
rsg-wardrobe:client:removeAllClothingclient``client/client.lua
rsg-wardrobe:client:openMenuclient``client/menu.lua
rsg-wardrobe:server:toggleservernameserver/server.lua
rsg-wardrobe:server:undressserver``server/server.lua
rsg-wardrobe:server:dressserver``server/server.lua
-- from a client script
TriggerServerEvent('rsg-wardrobe:server:toggle', name)
-- from a server script
TriggerClientEvent('RSGCore:Client:OnPlayerLoaded', source)

Commands#

CommandNotesFile
/undresslocale('sv_text_35')server/server.lua
/dresslocale('sv_text_34')server/server.lua

Locales#

Language files in locales/: cs, de, el, en, es, fr, it, ja, nl, pl, pt-br, ro, ru. Set the language with setr rsg:locale "en".

<!-- END AUTO-REFERENCE -->