Server exports, admin commands, authorization flow, and practical integration points for 0r-clothing_designer
This page is for server owners or developers who want to integrate the resource into their own admin flow.
1. Important Behavior to Understand First#
Opening the UI is not enough by itself.
The resource uses a server-side authorization step before the player can use the RPC flow correctly.
That means:
- server grants access
- client event opens the UI
- UI RPC calls then work for that authorized player
2. Main Server Exports#
Available server exports:
getRuntimeConfig()getTemplateCatalog()rescanTemplates()grantPlayerAccess(source)revokePlayerAccess(source)
3. What These Exports Are For#
getRuntimeConfig()#
Returns the current runtime config table that the resource is using.
Use this when you want to inspect current loaded settings from another resource.
getTemplateCatalog()#
Returns the current template catalog.
Use this when you want to inspect what the resource has already discovered from the template folders.
rescanTemplates()#
Forces a template rescan and returns the refreshed catalog.
Use this after template file changes when you want a server-side refresh action.
grantPlayerAccess(source)#
Authorizes a player for the clothing designer flow.
Use this before opening the UI.
revokePlayerAccess(source)#
Removes that access again.
Use this if your own admin flow wants to explicitly revoke access after use.
4. Correct UI Open Flow#
This is the correct pattern:
local playerSource = source
if exports["0r-clothing_designer"]:grantPlayerAccess(playerSource) then
TriggerClientEvent("0r-clothing_designer:client:openClothingDesigner", playerSource)
end
This is the important part:
- grant access first
- open the UI second
If you only trigger the client event without granting access, the UI can open but resource RPC actions can still fail.
5. Public Client Event#
The UI open event is:
TriggerClientEvent("0r-clothing_designer:client:openClothingDesigner", source)
This opens the NUI and focuses it.
It does not replace the server-side authorization requirement.
6. Admin Commands#
Registered admin commands:
clothingdesignerclothingdesignerstatsclothingdesignerrescan
Default restrictions use group.admin through ox_lib.
7. Practical Admin Examples#
Open the designer for a player#
local playerSource = source
if exports["0r-clothing_designer"]:grantPlayerAccess(playerSource) then
TriggerClientEvent("0r-clothing_designer:client:openClothingDesigner", playerSource)
end
Rescan templates#
local catalog = exports["0r-clothing_designer"]:rescanTemplates()
print(json.encode(catalog))
Read the current template catalog#
local catalog = exports["0r-clothing_designer"]:getTemplateCatalog()
print(json.encode(catalog))
8. Export Output Behavior#
From the shipped UI point of view:
- export flow is addon-first
- replace export is not shown in the shipped UI
Successful addon exports write output to:
0r-clothing_designer/exports0r-clothing_exports
After a successful export, restart:
restart 0r-clothing_exports
so FiveM reloads the newly exported addon files.
9. When to Use This Page#
Use this page when you want to:
- open the designer from your own admin menu
- rescan templates from another resource
- inspect the discovered template catalog
- understand why UI open alone is not enough