RVT Armário

API and integration

Commands, permissions, events and an integration example.

The resource declares no exports. Integration with other resources works through commands and the notification event.

Commands

Names can be changed in Config.Commands. The id is the passport on vRP (TargetId = 'passport') and the server id elsewhere.

CommandWhoWhat it does
/armarioPlayerOpens the wardrobe. Does not open inside a vehicle or while dead.
/skinmenuPlayerOpens the skin menu.
/aceitarroupaPlayerAccepts a shared outfit invitation.
/recusarroupaPlayerDeclines a shared outfit invitation.
/addskinplayer <id> <model>Admin or consoleUnlocks the skin for the player. The model must be in Config.Skins.
/resetarmario <id>Admin or consoleDeletes the player's saved outfits. Purchased slots, skins and earnings are untouched.
/armariosaldo <id> <amount>Admin or consoleSets the internal wallet balance. Standalone mode only.

Permissions

PermissionWhat for
rvt_clothes.adminAdmin commands (Config.AdminAce). The server console can always use them.
rvt_clothes.premiumExtra slots defined in Config.PremiumSlots. Create as many permissions as you need.

Besides ACE, QBCore and ESX accept groups listed per permission in Config.FrameworkPermissions (for example ['rvt_clothes.admin'] = { 'admin' } inside qb or esx), and vRP uses Config.Creative.Permissions. These lists ship empty: no admin access is granted by group name. QBox uses ACE. Never grant the admin permission to builtin.everyone.

Events

EventSideUse
rvt_clothes:notifyServer to clientShows a notification: (message, kind), where kind is success, error or inform. Other resources may trigger it.
rvt_clothes:request / responseInternalInterface to server communication. Do not use.
rvt_clothes:shareOffer / shareReplyInternalShared outfit invitation. Do not use.
rvt_clothes:creativeSessionInternalActive vRP character. Do not use.

The resource does not emit events to other resources, such as outfit saved or purchase completed. To know when the character has loaded, it listens to the events in Config.ClientEvents and, on vRP, Config.Creative.LoadedEvent and UnloadedEvent.

Example

-- server: unlock a skin for a player (ExecuteCommand on the server runs as console)
ExecuteCommand(('addskinplayer %d %s'):format(12, 'my_custom_ped'))

-- server: show a notification through the wardrobe notifier
-- kind: 'success' | 'error' | 'inform'
TriggerClientEvent('rvt_clothes:notify', source, 'Outfit saved', 'success')

-- client: open the wardrobe from another resource
ExecuteCommand('armario')
Read the saved data

For reports, read the state in read-only mode. Never write to the file.

-- server: read-only inspection of the saved data from another resource.
-- Never write this file: the wardrobe keeps its own copy in memory and would overwrite it.
local raw = LoadResourceFile('rvt_clothes', 'data/state.json')
local state = raw and json.decode(raw)
if state then
    local count = 0
    for _ in pairs(state.listings) do count = count + 1 end
    print(('Market listings stored: %d'):format(count))
end
Internal methods (interface protocol)

Reference for anyone changing the interface. They are called through the rvt_clothes:request event and answered on rvt_clothes:response with ok = true, or ok = false and error.

  • Wardrobe: getInfos, addOutfit, editOutfit, deleteOutfit, selectOutfit, getSavedAppearance, getSession, buySlot, shareOutfit.
  • Skins: getSkinsInfos, selectSkin.
  • Marketplace: marketList, marketCreate, marketEdit, marketUpdateClothes, marketDelete, marketBuy, marketMine, marketPurchases, marketRestore, claimProceeds, marketPhotoConfig.