Skip to content

✂️ Hair & Beard Coloring

Documentation relating to the jo_hairdresser_coloring add-on for the Hairdresser script.

1. Installation

WARNING

The Hairdresser script is required to use this add-on.

To install jo_hairdresser_coloring:

  • Drag and drop the resource into your resources folder
    • jo_hairdresser_coloring
  • Add this ensure to your server.cfg after ensure jo_hairdresser
    • ensure jo_hairdresser_coloring

Congratulations, the Hair & Beard Coloring add-on is ready to use!

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

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 the available action in the jo_hairdresser_coloring script.

Client Init

Triggered when the add-on links to jo_hairdresser and registers its Hairdresser menu hooks.

lua
exports.jo_hairdresser_coloring:registerAction('init', function()
    -- Your code here
end)

Filters

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

Client Can open color palette

Control whether the player can open the color palette.

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

When the palette is opened from another add-on, the external context is passed as a second argument.

lua
-- @param canOpen - boolean (default true)
-- @param context - table: external color palette context
exports.jo_hairdresser_coloring:registerFilter('canOpenColorPalette', function(canOpen, context)
	return canOpen
end)

Last updated: