Skip to content

✂️ Hairdresser

Documentation relating to jo_hairdresser.

1. Installation

jo_hairdresser works on all frameworks compatible with jo_libs (the list).

To install jo_hairdresser:

  • Download the library: jo_libs
  • Unzip the folder and drop it into your resources folder
  • Download jo_hairdresser from your account
  • Unzip the folder and drop it into your resources folder
  • Add this ensure to your server.cfg
    • ensure jo_libs
    • ensure jo_hairdresser

Congratulations, the Hairdresser script is ready to use!

WARNING

Make sure you have oxmysql ensured in your server.cfg.

For VORP

To fix clothes and skin, you have to edit two files:

lua
LoadCharacterSelect(playerPed, value.skin, value.components)
CachedSkin = value.skin
canContinue = false
ApplyFaceOverlays(value.skin)
canContinue = true
FaceOverlay("grime", value.skin.grime_visibility, value.skin.grime_tx_id, 0, 0, 0, 1.0, 0, 1, 0, 0, 0, 1, value.skin.grime_opacity)
Wait(500)

TriggerServerEvent("jo_libs:server:applySkinAndClothes", playerPed, value.skin, value.components) 
Wait(500) 
IsPedReadyToRender(playerPed) 

data.PedHandler = ClonePed(playerPed, false, false, false, false)
lua
local function ConvertTable(comps, compTints)
	local NewComps = {}

	for k, comp in pairs(comps) do
		NewComps[k] = { comp = comp, tint0 = 0, tint1 = 0, tint2 = 0, palette = 0 }

		if compTints and compTints[k] and compTints[k][tostring(comp)] then
			local compTint = compTints[k][tostring(comp)]
			NewComps[k].tint0 = compTint.tint0 or 0
			NewComps[k].tint1 = compTint.tint1 or 0
			NewComps[k].tint2 = compTint.tint2 or 0
			NewComps[k].palette = compTint.palette or 0
			NewComps[k].state = compTint.state or nil
		end
	end

	return NewComps
end

2. Usage

3. Configuration

The configuration file is config.lua in the resource root. Do not edit this file directly as your changes may be lost during updates. Instead, use overwriteConfig.lua to store your customizations.

  • config.lua - Default configuration maintained by developers. Do not modify this file.
  • overwriteConfig.lua - This is where you place only the values you want to override.

How to customize the configuration

  1. Open /overwriteConfig.lua
  2. Find the value you want to change in config.lua (e.g., Config.language )
  3. Copy only that line into overwriteConfig.lua
  4. Edit the copied value to your liking

The script loads config.lua first, then overwriteConfig.lua overwrites only the values you redefine. This ensures your customizations are preserved when updating the script.

Loading configuration...

Add-ons

The Hairdresser script supports optional add-ons:

4. For developers

Actions

Actions are one of the two types of Hooks. They provide a way to run a function at a specific point in the execution of scripts. Callback functions for an Action do not return anything back to the calling Action hook. They are the counterpart to Filters.

Below is a complete list of all available actions in the jo_hairdresser script.

Client InitPrompt

Triggered after the hairdresser prompt groups are created.

lua
exports.jo_hairdresser:registerAction('InitPrompt', function()
    -- Your code here
end)

Client LoopIn

Triggered every frame while the player is inside the hairdresser menu.

lua
-- @param currentPrompt - string: current prompt group ("select" or "buy")
exports.jo_hairdresser:registerAction('LoopIn', function(currentPrompt)
    -- Your code here
end)

Client reloadAll

Triggered after hair, beard, hair accessories, teeth, and overlays are reloaded.

lua
exports.jo_hairdresser:registerAction('reloadAll', function()
    -- Your code here
end)

Client switchPrice

Triggered when the player switches between payment options.

lua
-- @param priceIndex - int: index of the selected price option
exports.jo_hairdresser:registerAction('switchPrice', function(priceIndex)
    -- Your code here
end)

Events

Client Listen menu closing

Triggered when the hairdresser menu closes.

lua
AddEventHandler('jo_hairdresser:event:Close', function()
    -- Your code here
end)

Client Listen menu opening

Triggered when the hairdresser menu opens.

lua
AddEventHandler('jo_hairdresser:event:Open', function()
    -- Your code here
end)

Client Open the hairdresser

Call this event from your own scripts to start the hairdresser interaction.

lua
TriggerEvent('jo_hairdresser:Enter')

Client Reload skin

Reload the player skin from the server, then apply hairdresser components.

lua
TriggerEvent('jo_hairdresser:client:reloadSkin')

Filters

Filters allow you to modify data or permissions synchronously at specific points in the script. Below is the complete list of jo_hairdresser filters and how to use them.

Server Can buy

Control whether the purchase can continue before money is charged.

lua
-- @param canBuy - boolean (default true)
-- @param source - serverID of the player
-- @param data - table: purchase data
-- @param moneyType - any: selected money type/payment context
exports.jo_hairdresser:registerFilter('canBuy', function(canBuy, source, data, moneyType)
	return canBuy
end)

Client Can open menu

Control whether the player can open the hairdresser menu.

lua
-- @param canOpen - boolean (default true)
exports.jo_hairdresser:registerFilter('canOpenMenu', function(canOpen)
	return canOpen
end)

Add entries to the native hairdresser menu.

lua
-- @param items - table
exports.jo_hairdresser:registerFilter('mainMenuItems', function(items)
	return items
end)

Client Reload all

Control whether hairdresser components can be reloaded.

lua
-- @param canUse - boolean
exports.jo_hairdresser:registerFilter('reloadAll', function(canUse)
	return canUse
end)

Client Root menu items

Add high-level entries to the root hairdresser menu.

lua
-- @param items - table
exports.jo_hairdresser:registerFilter('rootMenuItems', function(items)
	return items
end)

Client Update current data before buy

Modify the current buy data before it is sent to the server purchase flow.

lua
-- @param currentData - table: current menu item data
exports.jo_hairdresser:registerFilter('updateCurrentDataBeforeBuy', function(currentData)
	return currentData
end)

Client Update lang for NUI

Alter the language table before it is sent to the NUI menu.

lua
-- @param lang - table
exports.jo_hairdresser:registerFilter('updateLangForNUI', function(lang)
	return lang
end)

Client Update menu prompt

Override which prompt group is displayed while navigating menus.

lua
-- @param promptType - string ("select" or "buy")
-- @param currentData - table: current menu item data
exports.jo_hairdresser:registerFilter('updateMenuPrompt', function(promptType, currentData)
	return promptType
end)

Last updated: