RedM documentation
Murphy's Barber
Reference
Murphy Barber - Developer API
This documentation covers all the events available for developers who want to integrate murphy_barber with external scripts, character creators, or other resources.
Table of Contents
Client Events
murphy_barber:loadbarberoverlay
Loads the current player's hairstyle and overlays from the database and applies them to the player ped. Use this event when a player spawns or selects their character.
Usage:
Description:
- Resets global hairstyle caches to ensure a clean state
- Fetches hairstyle data from the database for the current player
- Applies hairstyles and makeup overlays to the player ped
- This is the recommended event for loading hairstyles at player spawn
Example:
murphy_barber:loadbarberoverlayOnCharacter
Loads hairstyle and overlays for a specific character onto a specific ped. This is designed for character selection screens where you need to preview multiple characters without affecting the player's current cached data.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| charid | string/int | The character identifier from your database |
| ped | number | The ped handle to apply the hairstyle to |
Usage:
Description:
- Uses isolated local caches to prevent polluting the global player cache
- Safe to use on preview peds in character selection
- Waits for the ped to be valid and fully loaded before applying
- Perfect for character selection menus showing multiple characters
Example:
murphy_barber:clotheitem
Applies hairstyle components to a ped. This event handles the actual application of hair, beard, and other hairstyle elements.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| hairstyleComponents | table | Table containing hairstyle data (model, texture per category) |
| outfitid | string/int | The outfit/preset ID |
| overlay | boolean | If true, keeps existing overlays; if false, removes and reloads overlays |
| target | number (optional) | Ped handle. Defaults to PlayerPedId() |
| charid | string/int (optional) | Character ID for database queries |
| isLoadOnly | boolean (optional) | If true, skips saving to database |
| isCharselectPreview | boolean (optional) | If true, uses isolated caches (for preview peds) |
Usage:
Example:
murphy_barber:makeupitem
Toggles makeup overlay from a preset onto the player ped.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| outfitid | string/int | The preset ID to load makeup from |
Usage:
Description:
- If the same
outfitidis triggered twice, it will toggle off the makeup - Only works if the player ped has a valid head component
Server Events
murphy_barber:updatehairstyle
Updates the hairstyle data in the database for the current player.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| hairstyle | table | The hairstyle components table |
| overlays | table | The overlay data table |
| outfitid | string/int | The outfit/preset ID |
Usage:
Note: This event is typically called automatically by the client when making changes. You shouldn't need to call this directly unless implementing custom logic.
Integration Examples
Loading Hairstyle at Character Spawn
Loading Hairstyle on Character Selection Preview
Integration with Custom Character Creator
For developers integrating murphy_barber with their own character creator, here's how murphy_creator does it:
1. Required Variables
You need to track hairstyle and overlay data during character creation:
2. Initialize Hairstyle Cache
When entering character creation, initialize the hairstyle cache for all categories:
3. Build Barber Menu Categories
Build the menu data structure for your NUI:
4. Apply Hairstyle During Preview
When the player changes a hairstyle in the creator menu:
5. Save Hairstyle at End of Character Creation
When the character creation is finalized, save the hairstyle data to the database:
Server-side handler (add to your server script):
6. Load Hairstyle on Spawn
After character creation or when the player spawns:
Key Files to Reference
For full implementation details, refer to these files in murphy_creator:
| File | Purpose |
|---|---|
client/function/barber.lua |
Hairstyle loading and application logic |
client/NUI/NUIMessages.lua |
OpenBarberMenu() function |
client/NUI/NUICallbacks.lua |
NUI callbacks for hairstyle changes |
server/callbacks.lua |
murphy_creator:SavePreset callback |
shared/murphy_assets.lua |
Hairstyle data (shared with murphy_barber) |
Required Shared Files
Your creator needs access to these files from murphy_barber:
- murphy_assets.lua - Contains all hairstyle/overlay definitions
- config.lua - Contains
baseoverlaytemplate and configuration
You can either:
- Copy these files to your creator
- Or include murphy_barber's shared folder in your
fxmanifest.lua
Database Tables
Murphy_barber uses the following tables:
murphy_barber
Stores the current hairstyle for each character.
| Column | Type | Description |
|---|---|---|
| charid | int/varchar | Character identifier |
| hairstyle | LONGTEXT | JSON encoded hairstyle data |
| overlays | LONGTEXT | JSON encoded overlay data |
| permanentoverlay | LONGTEXT | JSON encoded permanent overlays |
| outfit_id | int | Current outfit ID |
murphy_barber_preset
Stores saved presets/outfits.
| Column | Type | Description |
|---|---|---|
| id | int | Auto-increment primary key |
| charid | int/varchar | Character identifier |
| outfit_id | varchar(50) | Unique preset ID |
| price | float | Preset price |
| name | varchar(255) | Preset name |
| hairstyle | LONGTEXT | JSON encoded hairstyle |
| overlays | LONGTEXT | JSON encoded overlays |
| gender | LONGTEXT | Character gender |
Hairstyle Data Format
The hairstyle components table follows this structure:
Each category has:
model: The component index (0 = none/default)texture: The texture variation
Available categories are defined in shared/murphy_assets.lua.
Last updated: September 9, 2026