All resources

rsg-bandana – Docs (v3.0.3)#

Contents#

  1. Files
  2. How it works
  3. Configuration
  4. Exports, events and commands
  5. For other scripts
  6. Troubleshooting

1. Files#

FilePurpose
fxmanifest.luaManifest; depends on rsg-core
shared/config.luaCommand, item, timings, native values
client/client.luaToggle logic, animation, export
server/server.lua/bandana command and optional useable item
server/versionchecker.luaGitHub version check
locales/*.jsonen, de, el, es, fr, ja, nl, pl, pt-br, ro, ru

2. How it works#

  • /bandana pulls the bandana over the face or drops it round the neck, using the RDR2 wearable-state system (male and female, on foot or mounted).
  • Hand-to-face animation: right hand on foot, left hand mounted.
  • Blocked while dead, ragdolled, swimming, hogtied, cuffed or in a vehicle. The state is re-checked after the animation, so it can't finish if the player is downed mid-way.
  • Only works once the character is fully logged in; per-toggle cooldown; the bandana is lowered cleanly if the resource restarts.

3. Configuration#

shared/config.lua:

OptionDefaultMeaning
Command'bandana'Toggle command
UseItemfalseAlso toggle by using an inventory item
ItemName'bandana'Item to register as useable (must exist in rsg-core items)
Cooldown2500ms between toggles
AnimTime1200ms into the animation before the state swaps
PlayAnimtruePlay the hand-to-face animation
DebugfalsePrint neckwear state to F8

NeckwearCategory, StateUp, StateDown and Anims come from decompiled game scripts and should not be changed.

4. Exports, events and commands#

NameSideNotes
IsWearingBandana()client exportReads the ped's real clothing state
rsg-bandana:client:toggleclient eventToggle (sent by the server)
CommandWhoWhat
/bandanaeveryoneRaise or lower the bandana

5. For other scripts#

  • Use exports['rsg-bandana']:IsWearingBandana() for anything that matters (for example witness checks); it stays correct after wardrobe changes.
  • State bag Player(src).state.bandana (server) / LocalPlayer.state.bandana (client) is handy for display, but it is set by the client, so don't trust it for anything a cheater could exploit.

6. Troubleshooting#

ProblemFix
Nothing happensCharacter must be loaded and not dead, swimming, cuffed or in a vehicle
Item does nothingUseItem = true and the item exists in items.lua
Toggles too slowlyLower Cooldown
Wrong state after clothing changeUse the export instead of the state bag

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-bandana 3.0.3. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core

Configuration#

OptionDefaultNotes
Config.Command'bandana'/bandana toggles up/down
Config.UseItemfalsetrue = also toggle by using an inventory item
Config.ItemName'bandana'item to register as useable (must exist in rsg-core items)
Config.Cooldown2500ms between toggles
Config.AnimTime1200ms into the animation before the state swaps
Config.PlayAnimtrueplay the RDR2 hand-to-face animation
Config.Debugfalseprint neckwear state to F8 when toggling
Config.NeckwearCategory0x5FC29285"neckwear" (same for male and female MP peds)
Config.StateUp-1829635046wearable state: bandana over face
Config.StateDownjoaat('BASE')wearable state: bandana round neck
Config.Animstable

Exports#

Client

ExportArgumentsFile
IsWearingBandana``client/client.lua
-- example
local result = exports['rsg-bandana']:IsWearingBandana()

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-bandana:client:toggleclient``client/client.lua
RSGCore:Client:OnPlayerLoadedclient``client/client.lua
RSGCore:Client:OnPlayerUnloadclient``client/client.lua
-- from a server script
TriggerClientEvent('rsg-bandana:client:toggle', 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 -->