From the reference libraryRedM

:scissors: Hair & beard coloring

jo_libs/redm_scripts/hairdresser-coloring.md

:scissors: Hair & beard coloring

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

:::: tabs ::: tab BUY Buy the add-on :::

::: tab PREVIEW <iframe width="560" height="315" src="https://www.youtube.com/embed/L59H6mLFu_Y?si=WpVh0x8uw5KuyYEX" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> ::: ::::

1. Installation

::: warning Hairdresser script is required to use this add-on :::

To install kd_hairdresser_coloring:

  • Drag and drop the resource into your resources folder
    • kd_hairdresser_coloring
  • Add this ensure in your server.cfg after ensure kd_hairdresser
    • ensure kd_hairdresser_coloring

Congratulation, the Hair & Beard coloring add-on is ready to be used!

2. Usage

Go into the hairdresser to dye or hair/beard.

3. Config.lua file

<ScriptConfig scriptPath="redm/hair-coloring" />

4. For developers

Filters are the new way to modify data used by the script. These filters are fired at a specific point in time during the execution of the script. But contrary to events, filters are synchronous.

  • Syntax:
-- @param <actionName> - name of the action
-- @param <argumentList> - list of arguments which are passed
exports.kd_hairdresser_coloring:registerFilter(<actionName>, function(variable)
  -- Add your new data here
	return variable -- Don't forget to return the value
end)

4. For developers > <Badge type="client" text="Client" /> Restrict the coloring

Fires after completed the coloring prompt

-- @param canUse - boolean
exports.kd_hairdresser_coloring:registerFilter('canOpenColorPalette', function(canUse)
	return canUse
end)

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

:::: tabs ::: tab BUY Buy the add-on :::

::: tab PREVIEW <iframe width="560" height="315" src="https://www.youtube.com/embed/L59H6mLFu_Y?si=WpVh0x8uw5KuyYEX" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> ::: ::::

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

:::: tabs ::: tab Open coloring Go to a hairdresser and select a compatible hair, beard, or hair accessory item.

When the selected item can be colored, the coloring prompt appears in the buy prompt group. Press C by default to open the color palette menu. :::

::: tab Coloring features In the color palette menu, you can:

  • Choose a palette - Switch between enabled tint palettes
  • Adjust tints - Edit the three tint values used by the selected component
  • Preview colors - See the selected color before buying
  • Buy the color - Apply and save the colored component through the Hairdresser purchase flow

The add-on supports hair, beard, and hair accessories by default. :::

::::

3. Configuration

<ScriptConfig scriptPath="redm/hair-coloring" />

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.

4. For developers > Actions > <Badge type="client" text="Client" /> Init

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

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

4. For developers > 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.

4. For developers > Filters > <Badge type="client" text="Client" /> Can open color palette

Control whether the player can open the color palette.

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

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