All resources

rsg-barbers – Docs (v3.0.0)#

Contents#

  1. Files
  2. How it works
  3. Configuration
  4. Events and callbacks
  5. Database
  6. Security
  7. Server owner how-tos
  8. Troubleshooting

1. Files#

FilePurpose
fxmanifest.luaManifest; depends on rsg-core, rsg-character, rsg-target, oxmysql
config.luaPrices, target/prompt, makeup ranges, locations
shared/hairs.lua, shared/overlays.lua, shared/functions.luaHair/overlay data and price/hash helpers
client/npcs.luaBarber NPCs, blips, rsg-target or prompt
client/client.luaChair, camera, lighting, NUI, live preview
server/server.luaPurchase validation, payment, skin save
server/versionchecker.luaGitHub version check
html/NUI panel (index.html, style.css, script.js)
locales/*.jsonen, cs, de, el, es, fr, it, ja, nl, pl, pt-br, ro, ru

2. How it works#

  • Barber NPCs spawn and fade in near each shop (DistanceSpawn) with map blips.
  • Interact with the NPC through rsg-target (or an rsg-core prompt when UseTarget = false), sit in the chair with a scripted camera and studio lighting.
  • Change hair style/colour, beard style/colour (male) and makeup: stubble (male), eyeshadow, blush, lipstick, eyeliner.
  • The menu opens with the current look loaded. Cancel, close or Esc reverts the preview via exports['rsg-character']:ApplySkin().
  • Press Pay (or Enter) to buy. You are only charged when something changed.
  • The NUI has Hair & Beard and Makeup tabs, arrow steppers (hold to repeat), clickable opacity bars and Shift + mouse wheel.

3. Configuration#

config.lua:

OptionDefaultMeaning
DebugfalseDebug prints
BarberCost5Default cash price; a location can override with price
UseTargettruersg-target on the NPC, or a prompt at coords
Key'J'Prompt key when not using target
MaxDistance3.0Server-checked distance from the chair when paying
Cooldown3Seconds between purchase attempts
MenuAlign'right'Panel side (right/left)
DistanceSpawn20.0NPC spawn/despawn distance
FadeIn, BlipSprite, BlipScaleNPC fade and blip
Makeuplist{ key, label, min, max, default, hop, maleOnly }; also used by the server to validate values
BarberLocationslistname, barberid, npcmodel, npccoords, coords, seat, camPos, camRot, lighting, optional price

4. Events and callbacks#

NameSideNotes
rsg-barbers:client:openclient event(barberid) opens the barber menu (also reachable via the older rsg-barber:client:menu)
rsg-barbers:server:purchasecallback(barberid, payload); returns { ok, reason, price }

5. Database#

No new tables. The saved look is written to the playerskins table (from rsg-character) for the character.

6. Security#

The server works out hair and beard hashes itself, checks every makeup value against Config.Makeup ranges, checks distance to the chair, applies a cooldown, takes cash before saving and refunds it if the save fails.

7. How-tos#

  • Add a shop: copy a BarberLocations entry with a unique barberid and set the NPC, chair and camera positions.
  • Change a price for one shop: add price = 10 to that location.
  • Language: setr rsg:locale "de" in server.cfg.

8. Troubleshooting#

ProblemFix
No NPCMove within DistanceSpawn; check the model and coordinates
Can't interactStart rsg-target, or set UseTarget = false
Look didn't saveCharacter needs a playerskins row (rsg-character)
Preview stuckClose and reopen; the cancel path calls ApplySkin

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

Dependencies#

rsg-core, rsg-character, rsg-target, oxmysql

Configuration#

OptionDefaultNotes
Config.Debugfalse
Config.BarberCost5default price (cash) for a new style; a location can override with price
Config.UseTargettruetrue = rsg-target on the barber NPC, false = rsg-core prompt at coords
Config.Key'J'prompt key when Config.UseTarget = false
Config.MaxDistance3.0max distance (server checked) from the chair when paying
Config.Cooldown3seconds between purchase attempts per player
Config.MenuAlign'right'NUI panel side: 'right' or 'left'
Config.DistanceSpawn20.0spawn/despawn distance for barber NPCs
Config.FadeIntrue
Config.BlipSprite-2090472724
Config.BlipScale0.2
Config.Makeuptable
Config.BarberLocationstable

Callbacks#

CallbackSideArgumentsFile
rsg-barbers:server:purchaseserversource, cb, barberid, payloadserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-barbers:server:purchase', function(result)
    -- use result
end, barberid, payload)

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-barbers:client:openclientbarberidclient/client.lua
-- from a server script
TriggerClientEvent('rsg-barbers:client:open', source, barberid)

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 -->