Cut Players Hair

Configuration

Configuration

Everything below is in config.lua, the only file you need to edit. It isn't encrypted. Save it and restart the resource.

Master switch

Config.Enabled = true

Set to false to turn shaving off without removing the resource. Every attempt is refused with «Funcion deshabilitada».

Permission system

Config.RequirePermission = false   -- false = everyone | true = admin-granted only
Config.PersistGrants     = true    -- keep grants across restarts (server KVP)
Config.AdminGroup        = 'group.admin'
Config.RequirePermission Behavior
false (default) Every player with the clipper can shave others
true Only players an admin granted with /recorteperm <id> on

Grants are stored by license. With Config.PersistGrants = false they reset on every restart.

Config.AdminGroup is the ACE group allowed to run /recorteperm. Use group.mod or any group you defined in your server permissions.

Command

Config.Commands = {
    Perm = 'recorteperm',
}
Config.CommandHelp = {
    Perm = 'Otorgar o quitar permiso para recortar a un jugador (admin)',
}

There is no shave command: shaving starts from the item and the target option. Only the admin command can be renamed. CommandHelp is the text in the chat suggestion.

Target option

Config.UseTarget      = true
Config.TargetSystem   = 'auto'          -- 'auto' | 'ox_target' | 'qb-target'
Config.TargetLabel    = 'Recortar'
Config.TargetIcon     = 'fa-solid fa-scissors'
Config.TargetDistance = 2.0
Option Default What it changes
UseTarget true Adds the Recortar option on other players
TargetSystem 'auto' auto uses ox_target if it's started, otherwise qb-target. Or force 'ox_target' / 'qb-target'
TargetLabel 'Recortar' Option text
TargetIcon 'fa-solid fa-scissors' Option icon (Font Awesome)
TargetDistance 2.0 How close you must be to see the option, in metres

The option only shows on players who meet Config.ShaveConditions.

The clipper

Config.ShaveItem        = 'hairclipper'
Config.ShaveItemMissing = 'Necesitas la maquinita para recortar'
Config.RequireInHand    = true
Config.UseItemDistance  = 2.0
Option Default What it changes
ShaveItem 'hairclipper' Item name. Must match your inventory
ShaveItemMissing 'Necesitas la maquinita para recortar' Message when the shaver doesn't carry the item
RequireInHand true true: using the item puts the clipper in your right hand (use it again to put it away), and Recortar only shows while it's in your hand. It's put away on death, in a vehicle, when you draw a weapon or when the item leaves your inventory. false: using the item shaves the closest player, and Recortar shows while you carry the item. With no inventory at all, it always works like false
UseItemDistance 2.0 How close the other player must be when you use the item (only with RequireInHand = false)

The server checks that the shaver carries the item on every inventory.

Bald lock

Config.ShaveHairLockSeconds = 20 * 60

Config.BaldHair = {
    male   = { drawable = 0, texture = 0 },   -- mp_m_freemode_01
    female = { drawable = 0, texture = 0 },   -- mp_f_freemode_01
}
Option Default What it changes
ShaveHairLockSeconds 1200 (20 min) How long the shaved player stays bald, even through the barber, the clothing menu, relogs or restarts (stored by license). 0 disables the lock
BaldHair.male 0 / 0 Hair style (component 2) used as bald on male freemode peds. Also used for non-freemode peds
BaldHair.female 0 / 0 Same for female freemode peds

In the base game the bald style is drawable 0 for both. If your hair pack moved it, put the number you see for that hair in your barber / clothing menu.

Cooldown

Config.Cooldown = 120

Seconds the shaver waits between two shaves. VIPs skip it.

Shave conditions

Config.ShaveConditions = {
    consent = false,
    handsUp = false,
    cuffed  = false,
}
Config.PromptTimeoutMs = 15000

What the other player must be doing to be shaved. Any enabled option is enough:

Option Effect
consent = true They get a Solicitud de Recorte request and must press Aceptar
handsUp = true With their hands up, the shave starts without asking
cuffed = true Handcuffed, the shave starts without asking
All false (default) Anyone can be shaved without asking. They get a notification that you're shaving them

Config.PromptTimeoutMs is how long they have to answer the request (15 s, only with consent).

Hands up means the usual hands-up animations (suty-emotes, rpemotes, qbx_police…). Cuffed means GTA's cuffed state, the arrest animation, or the QB / QBX ishandcuffed metadata.

Trimmer sound

Config.SoundVolume   = 0.6
Config.SoundDistance = 30.0

Full volume (SoundVolume, 0.0–1.0) within 1 m of the shaver. It then fades like a real sound and is silent at SoundDistance metres. Each listener's volume follows their live distance during the shave.

VIP whitelist

Config.WhitelistEnabled = false

Config.VIPLicenses = {
    ['YOUR_LICENSE_HASH'] = true,
}

With Config.WhitelistEnabled = true, VIP licenses can't be shaved, and when they shave someone they skip the request and the cooldown. Add each VIP as ['<license>'] = true, using the license without the license: prefix (txAdmin shows it in the player's identifiers).

Quick reference

Want to… Set
Disable the resource temporarily Config.Enabled = false
Ask before every shave Config.ShaveConditions.consent = true
Only shave cuffed players Config.ShaveConditions.cuffed = true
Restrict to admin-granted players Config.RequirePermission = true
Let moderators grant access Config.AdminGroup = 'group.mod'
Shorter bald time Config.ShaveHairLockSeconds = 5 * 60
No bald lock Config.ShaveHairLockSeconds = 0
Use the item without taking it out first Config.RequireInHand = false
Force qb-target Config.TargetSystem = 'qb-target'

Merry Christmas.

From Suty.