All resources

rsg-radialmenu – Developer Docs#

Contents#

  1. Dependencies
  2. File overview
  3. Menu entries
  4. Exports
  5. Events
  6. Walk styles
  7. Security model
  8. Language
  9. Troubleshooting
  10. Changelog

Dependencies#

  • rsg-core only (no ox_lib). Locales via @rsg-core/shared/locale.lua, notifications via RSGCore.Functions.Notify.
  • Default entries call other resources and are simply ignored if those are missing: rsg-stables, rsg-telegram, rsg-lawman, rsg-medic (/medic field menu), rsg-wardrobe (clothing commands), loadskin / info / myjobs / searchplayer commands.
  • No database tables.

File overview#

FilePurpose
config.luaSettings, walk styles, default menu tree, job menus
client/main.luaOpen/close, menu tree building, NUI callbacks, emergency alerts, exports
client/walkstyles.luaApplies synced walk styles to every nearby player
server/server.luaValidates + stores walk styles (state bag + character metadata)
server/versionchecker.luaConsole version check
html/NUI (SVG radial menu, Font Awesome icons)
locales/*.jsonen, de, el, es, fr, ja, nl, pl, pt-br, ro, ru
  • cmd(id, label, icon, command) – runs a command (ExecuteCommand)
  • cl(id, label, icon, event) – triggers a client event
  • walk(key, label) – applies a walk style (validated server-side, synced via the walkstyle player state bag)
  • A table with items = { ... } is a submenu. Default Clothing menu: Dress, Undress, Hat, Vest, Boots, Pants, Gun Belt, Mask, Shirt (on/off, /sleeve, /collar1, /collar2) and Coats (Coat, Closed Coat).
  • Keep a menu level to roughly 10 entries or fewer; labels get cramped on busy rings, so group extras into submenus.
FieldDescription
idUnique id (used to match NUI selections)
titleLabel, use locale('key')
iconFont Awesome 6 name or full class
typeclient, server, command, rsgcommand
eventEvent / command name
shouldClosefalse keeps the menu open after selecting
itemsMakes the entry a submenu
canOpenFunction evaluated every time the menu opens; empty submenus are hidden
actionFunction run instead of type/event

Exports#

Client side:

  • exports['rsg-radialmenu']:AddOption(data, id) → returns the id. Passing an existing id replaces that option and keeps its slot; new options are appended in the order they were added.
  • exports['rsg-radialmenu']:RemoveOption(id)

Events#

EventSideDescription
rsg-radialmenu:client:onRadialmenuOpenclientFired when the menu opens
rsg-radialmenu:client:onRadialmenuCloseclientFired when the menu closes (also when it closes itself)
rsg-radialmenu:client:setWalkstyleclientTriggerEvent(..., 'angry') or { walkstyle = 'angry' }; client cooldown mirrors the server
rsg-radialmenu:client:reapplyWalkstyleclientRe-apply own walk style (call after skin reloads / wardrobe changes)
rsg-radialmenu:client:noPlayersclient"No one nearby" notification
rsg-radialmenu:client:SendLawmanEmergencyAlert / SendMedicEmergencyAlertclientEmergency button (job check + Config.EmergencyCooldown)
rsg-radialmenu:server:setWalkstyleserverValidated against Config.Walkstyles + Config.WalkstyleCooldown

Walk styles#

Stored in the player state bag walkstyle (replicated) and character metadata walkstyle. The key is restored on character load and for everyone online on resource restart. A character without a saved style clears the state bag, so styles never carry over between characters.

Security model#

  • The NUI only sends { id, event }; the client looks that pair up in its own menu tree and ignores anything else, so a modified UI cannot run arbitrary events.
  • type = 'server' entries send only plain data (no functions) – the target server event must validate everything itself (job, distance, cooldown); this resource cannot protect it.
  • Walk styles: server rejects unknown keys and enforces a cooldown per player.
  • The emergency alert cooldown is client-side. The receiving events (rsg-lawman:server:lawmanAlert, rsg-medic:server:medicAlert) must check the caller's job and rate limit, and should build the message server-side instead of trusting the text sent by the client.
  • Menu cannot be opened (and selections are ignored) while dead, handcuffed or in the pause menu.

Language#

setr rsg:locale "<code>" (falls back to ox:locale, then en). Supported: en, de, el, es, fr, ja, nl, pl, pt-br, ro, ru. Menu labels are read when config.lua loads, so restart the resource after changing language.

Troubleshooting#

ProblemFix
Menu never opens, red console error on startConfig.Keybind is not a key in RSGCore.Shared.Keybinds
Menu stays open after releasing the keyHold mode matches the key name from Config.Keybind (e.g. F6, Q); use a key listed in KEY_ALIASES in html/js/main.js or add yours
Icons missingFont Awesome loads from cdnjs; host it locally (see README)
A command entry does nothingThe command's resource (e.g. rsg-wardrobe) is not started
Walk style resets after clothing/skin changeTrigger rsg-radialmenu:client:reapplyWalkstyle from that resource

Changelog#

  • 3.2.1 – Removed the Name Horse entry (no /sethorsename command exists).
  • 3.2.1 – Medic menu now matches the reworked rsg-medic: Revive / Heal Wounds (events that no longer exist) replaced by a Field Menu entry that runs /medic; removed the call to the non-existent rsg-medic:server:medicAlert.
  • 3.2.0 – Shirt states (/sleeve, /collar1, /collar2) in a Shirt submenu and Coats submenu (keeps rings readable); menu closes on death/cuff/pause; hold-to-open only closes on the keybind release (Enter no longer closes the menu after opening a submenu); clicks use the clicked sector; stable order for dynamic options; plain-data payloads for server entries; invalid keybind guard; walk style no longer leaks between characters; client walk style cooldown; first-minute emergency cooldown bug; removed unused locale keys.
  • 3.1.0 – Removed ox_lib dependency (locales and notify now from rsg-core).

Support: 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-radialmenu 3.3.0. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core

Configuration#

OptionDefaultNotes
Config.Keybind'F6'Key name. In tap mode it is the default of a rebindable key
Config.UseKeyMappingtrueTap mode only: rebindable key via rsg-core RegisterKey (rsg-core 3.5.0+). Hold mode polls Config.Keybind, because the NUI detects its release by key name and a rebound key would never close the menu
Config.HoldToOpentruetrue: hold key, release to close | false: tap to open
Config.EmergencyCooldown60seconds between emergency button presses
Config.WalkstyleCooldown2seconds between walkstyle changes (server enforced)
Config.LawJobs{ vallaw = true, rholaw = true, blklaw = true, strlaw = true, stdenlaw
Config.MedicJobs{ medic = true }
Config.Walkstylestablekey = { clipset, motion type } (server only accepts keys listed here)
Config.MenuItemstable
Config.JobInteractionstable

Exports#

Client

ExportArgumentsFile
AddOption``client/main.lua
RemoveOption``client/main.lua
-- example
local result = exports['rsg-radialmenu']:AddOption()

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
rsg-radialmenu:client:noPlayersclient``client/main.lua
rsg-radialmenu:client:SendLawmanEmergencyAlertclient``client/main.lua
rsg-radialmenu:client:SendMedicEmergencyAlertclient``client/main.lua
rsg-radialmenu:client:setWalkstyleclientdataclient/walkstyles.lua
RSGCore:Client:OnPlayerLoadedclient``client/walkstyles.lua
rsg-radialmenu:client:reapplyWalkstyleclient``client/walkstyles.lua
rsg-radialmenu:server:setWalkstyleserverkeyserver/server.lua
-- from a client script
TriggerServerEvent('rsg-radialmenu:server:setWalkstyle', key)
-- from a server script
TriggerClientEvent('rsg-radialmenu:client:noPlayers', source)

Locales#

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

<!-- END AUTO-REFERENCE -->