=============== LIBRARY RULES =============== From library maintainers: - Answer only from the published Murphy's Barber documentation, in the user's language. Cite a relevant clickable Markdown source link under https://docs.murphy-workshop.com/murphy-s-barber/. - This is a public RedM plugin. Do not substitute FiveM, another Murphy plugin, or undocumented framework APIs. Do not mention or speculate about unpublished products. - Never invent commands, exports, event names, configuration keys, default values or compatibility. If the documentation does not establish an answer, say so and link to the closest relevant reference. - Ask for the installed framework and plugin version when they affect behavior. A public release note establishes that release, not a guarantee about files actually installed on the user's server. - Keep answers concise and focused. Give only the requested code. Preserve existing configuration entries and label excerpts. Do not use emojis or long dashes. Remove display line numbers from copied code. - Distinguish client and server context, online server player IDs and persistent character identifiers. Do not interchange commands, events and exports without explicit documentation. - Do not promise data preservation, backups, refunds or offline behavior unless the relevant documentation establishes it. Do not recommend deleting data or blindly replacing a full core file. - Store screenshots show one demonstration setup. Do not infer fixed rewards, version, framework, controls or guarantees from a picture. Do not claim that an in-game test was performed. - Never claim access to purchases, accounts, licenses or server actions. For account or order questions only, link to https://murphy-workshop.com/portal or https://murphy-workshop.com/support. - Published reference: exports.murphy_barber:SetHairForChar(charid, payload), côté serveur. charid est l'identifiant du personnage du framework, pas automatiquement son ID serveur connecté. Guide disponible à partir de Barber 1.21.0. - Published reference: Non, les catégories essentielles dont cheveux/barbe sont retirées par Clothing. Utiliser SetHairForChar de Barber pour ces catégories. ### Example: Load hairstyle on character selection preview Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Shows how to apply a hairstyle to a preview ped during character selection. ```lua -- When creating a preview ped for character selection local previewPed = CreatePed(...) local characterId = "char_12345" -- Wait for ped model to load while not DoesEntityExist(previewPed) do Wait(100) end -- Load the character's hairstyle onto the preview ped TriggerEvent("murphy_barber:loadbarberoverlayOnCharacter", characterId, previewPed) ``` -------------------------------- ### Example: Apply hairstyle components Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Demonstrates applying a hairstyle to the current player with database saving, and to a preview ped without saving. ```lua -- Apply hairstyle to current player (and save to database) local hairstyle = { hair = { model = 5, texture = 0 }, beard = { model = 3, texture = 0 } } TriggerEvent("murphy_barber:clotheitem", hairstyle, "1234567", false) -- Apply hairstyle to preview ped (no database save) TriggerEvent("murphy_barber:clotheitem", hairstyle, "1234567", true, previewPed, nil, true, true) ``` -------------------------------- ### Example: Load hairstyle at player spawn Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Demonstrates triggering the load event after a short delay to ensure the player ped is ready. ```lua -- In your spawn handler Wait(500) -- Wait for ped to be ready TriggerEvent("murphy_barber:loadbarberoverlay") ``` -------------------------------- ### Load Hairstyle at Character Spawn Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Example of loading a player's saved hairstyle after the player ped has been created in a spawn handler. ```lua -- In your spawn handler after the player ped is created Citizen.CreateThread(function() -- Wait for player ped to be ready while not DoesEntityExist(PlayerPedId()) or IsEntityDead(PlayerPedId()) do Wait(100) end Wait(500) -- Additional wait for ped components -- Load the player's saved hairstyle TriggerEvent("murphy_barber:loadbarberoverlay") end) ``` -------------------------------- ### SetClothesForChar and SetHairForChar usage Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/character-creator-integration-setclothesforchar-sethairforchar Example of applying clothing and hair data server-side after character creation. These exports are server-side only and validate the provided payload before storage. ```lua -- Server-side, right after your creator finishes a character: local ok, err = exports.murphy_clothing:SetClothesForChar(charid, { hats = { model = 3, texture = 0 }, shirts_full = { model = 5, texture = { palette = 2, tint0 = 17, tint1 = 17, tint2 = 17 } }, pants = { model = 2, texture = 1 }, boots = { model = 4, texture = 0 }, }) if not ok then print(err) end local ok2, err2 = exports.murphy_barber:SetHairForChar(charid, { hair = { model = 2, texture = 0 }, beard = { model = 1, texture = 0 }, }) if not ok2 then print(err2) end ``` -------------------------------- ### Initialize Hairstyle and Overlay Cache Variables Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Required variables for tracking hairstyle and overlay data during character creation. ```lua -- Hairstyle cache - stores current hairstyle selections hairstyleCache = {} -- Overlay cache - stores makeup/overlay data overlay_all_layers = {} -- Base overlay template (copy from murphy_barber/shared/config.lua) baseoverlay = { { name = "eyeliners", opacity = 1.0, var = 0, tx_color_type = 0, tx_normal = 0, palette = 0, tx_unk = 0, palette_color_primary = 0, palette_color_secondary = 0, palette_color_tertiary = 0, visibility = 0, tx_opacity = 1.0, tx_id = 1 }, { name = "lipsticks", opacity = 1.0, var = 0, tx_color_type = 0, tx_normal = 0, palette = 0, tx_unk = 0, palette_color_primary = 0, palette_color_secondary = 0, palette_color_tertiary = 0, visibility = 0, tx_opacity = 1.0, tx_id = 1 }, -- ... more overlay categories } ``` -------------------------------- ### Add resource to server.cfg Source: https://docs.murphy-workshop.com/murphy-s-barber/getting-started/installation Ensure the required dependencies and the plugin are loaded by adding them to your server configuration file. ```cfg ensure oxmysql ensure murphy_barber ``` -------------------------------- ### Customize Menu Options Source: https://docs.murphy-workshop.com/murphy-s-barber/getting-started/configuration Configure the command to open the menu and toggle the native interaction prompt. ```lua Config.MenuCommand = "barbermenu" -- Command to open menu (set to nil to disable) Config.NativePrompt = false -- Use native interaction prompt ``` -------------------------------- ### Configure shared/config.lua Source: https://docs.murphy-workshop.com/murphy-s-barber/getting-started/installation Adjust the framework, enable integrations, and set the menu command in the shared configuration file. ```lua Config.framework = "rsg-core" -- Choose your framework Config.murphy_creator = true -- Enable Murphy Creator integration Config.MenuCommand = "barbermenu" -- Optional menu command -- Configure shop locations and prices as needed ``` -------------------------------- ### Configure Menu Settings Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/troubleshooting Define the command used to open the barber menu and toggle the native interaction prompt. ```lua Config.MenuCommand = "barbermenu" -- Command to open menu Config.NativePrompt = false -- Toggle native interaction prompt ``` -------------------------------- ### Configure Framework Selection Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/troubleshooting Set the Config.framework variable to match your server's framework, such as rsg-core, vorp, or REDEMRP2k23. ```lua Config.framework = "rsg-core" -- Ensure this matches your server's framework ``` -------------------------------- ### Initialize Hairstyle Cache Function Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Initializes the hairstyle cache for all categories based on the gender provided. Requires access to MURPHY_ASSETS. ```lua -- MURPHY_ASSETS is defined in murphy_barber/shared/murphy_assets.lua -- You need to share this file or include it in your creator function InitializeHairstyleCache(gender) hairstyleCache = {} for category, data in pairs(MURPHY_ASSETS[gender]) do hairstyleCache[category] = { model = 0, texture = 0 } end overlay_all_layers = deepcopy(baseoverlay) end ``` -------------------------------- ### Configure Overlay Settings Source: https://docs.murphy-workshop.com/murphy-s-barber/getting-started/configuration Enable or disable specific cosmetic overlays in the Config.Overlayitems table. ```lua Config.Overlayitems = { ["eyeliners"] = true, ["shadows"] = true, ["lipsticks"] = true, -- Disabled overlays ["eyebrows"] = false, ["scars"] = false } ``` -------------------------------- ### Configure Framework in config.lua Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/framework-support Set the Config.framework option to specify the active game framework. Supported options are "vorp", "REDEMRP2k23", and "rsg-core". ```lua Config.framework = "rsg-core" -- Options: "vorp", "REDEMRP2k23", "rsg-core" ``` -------------------------------- ### Configure Customization Pricing in config.lua Source: https://docs.murphy-workshop.com/murphy-s-barber/features/customization Adjust the cost of individual customization options within the Config.Price section. ```lua Config.Price = { ["eyeliners"] = 0.5, ["shadows"] = 0.5, ["blush"] = 0.5, ["lipsticks"] = 0.5 } ``` -------------------------------- ### Load Hairstyle on Character Selection Preview Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Loads hairstyle data onto a specific preview ped without affecting the global player cache. ```lua -- When creating character preview peds local function LoadCharacterPreview(charid, ped) -- Wait for ped to be fully loaded while not DoesEntityExist(ped) do Wait(100) end Wait(200) -- Load hairstyle without affecting player's global cache TriggerEvent("murphy_barber:loadbarberoverlayOnCharacter", charid, ped) end -- Usage local previewPed = CreatePed(pedModel, x, y, z, heading, false, false) LoadCharacterPreview("ABC123", previewPed) ``` -------------------------------- ### Apply Hairstyle During Preview Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Updates the hairstyle cache and applies the selected model and texture to the ped. ```lua function ApplyHairstyle(ped, gender, category, modelIndex, textureIndex) -- Update cache hairstyleCache[category] = { model = modelIndex, texture = textureIndex } -- Get drawable data from MURPHY_ASSETS if modelIndex > 0 and MURPHY_ASSETS[gender][category][modelIndex] then local assetData = MURPHY_ASSETS[gender][category][modelIndex] if assetData.drawable then -- Hair with palette tints local variant = assetData.variants[textureIndex] or assetData.variants[1] local albedo = variant.albedo local normal = variant.normal local material = variant.material local palette = variant.palette -- Apply using natives (see murphy_barber/client/function.lua for UpdateCustomhairstyle) UpdateCustomhairstyle(ped, assetData.drawable, albedo, normal, material, palette, 0, 0, 0) else -- Component-based hair/beard local hash = assetData[textureIndex] and assetData[textureIndex].hash or assetData[1].hash NativeSetPedComponentEnabled(ped, hash, false, true, true) end NativeUpdatePedVariation(ped) end end ``` -------------------------------- ### Set Pricing Source: https://docs.murphy-workshop.com/murphy-s-barber/getting-started/configuration Define individual prices for cosmetic modifications in the Config.Price table. ```lua Config.Price = { ["hair"] = 1, ["beard"] = 1, ["eyeliners"] = 0.5, ["lipsticks"] = 0.5 } ``` -------------------------------- ### Handle Hairstyle Save Server-Side Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Register a server event to process and persist hairstyle and overlay data to the database using MySQL queries. ```lua RegisterServerEvent("murphy_barber_creator:updatehairstyle", function(hairstyle, overlays, outfitid) local source = source local charid = GetCharIdentifier(source) -- Your framework's function if not charid then print("[Barber Creator] Error: No charid found") return local encodedHairstyle = json.encode(hairstyle) local encodedOverlays = json.encode({}) local permanentOverlay = {} -- Extract permanent overlays (makeup that persists) for k, v in pairs(overlays) do if v.visibility and v.visibility > 0 then permanentOverlay[v.name] = v end end local encodedPermanent = json.encode(permanentOverlay) -- Check if entry exists MySQL.query('SELECT * FROM murphy_barber WHERE `charid`=@charid', { charid = charid }, function(result) if result[1] then -- Update existing MySQL.update("UPDATE murphy_barber SET hairstyle = @hairstyle, overlays = @overlays, permanentoverlay = @permanentoverlay, outfit_id = @outfit_id WHERE charid = @charid", { hairstyle = encodedHairstyle, overlays = encodedOverlays, permanentoverlay = encodedPermanent, outfit_id = outfitid or 0, charid = charid }) else -- Insert new MySQL.update("INSERT INTO murphy_barber (charid, hairstyle, overlays, permanentoverlay, outfit_id) VALUES (@charid, @hairstyle, @overlays, @permanentoverlay, @outfit_id)", { charid = charid, hairstyle = encodedHairstyle, overlays = encodedOverlays, permanentoverlay = encodedPermanent, outfit_id = outfitid or 0 }) end end) end) ``` -------------------------------- ### murphy_barber:loadbarberoverlay Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Loads the player's saved hairstyle and overlay configuration. ```APIDOC ## Event: murphy_barber:loadbarberoverlay ### Description Loads the player's saved hairstyle and overlay configuration, typically used after character spawn. ### Usage ```lua TriggerEvent("murphy_barber:loadbarberoverlay") ``` ``` -------------------------------- ### murphy_barber:makeupitem Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Toggles a makeup overlay from a preset onto the player ped. ```APIDOC ## TriggerEvent("murphy_barber:makeupitem", outfitid) ### Parameters - **outfitid** (string/int) - The preset ID to load makeup from ### Description If the same outfitid is triggered twice, it will toggle off the makeup. Only works if the player ped has a valid head component. ``` -------------------------------- ### Open Barber Menu Command Source: https://docs.murphy-workshop.com/murphy-s-barber/features/barber-shops Use this command in the game console to open the barber menu. ```lua /barbermenu ``` -------------------------------- ### Configure Overlay Item Visibility Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/troubleshooting Enable or disable specific makeup and customization options in the Config.Overlayitems table. ```lua Config.Overlayitems = { ["eyeliners"] = true, -- Enabled ["shadows"] = true, -- Enabled ["lipsticks"] = true, -- Enabled ["beardstabble"] = false -- Disabled } ``` -------------------------------- ### murphy_barber:loadbarberoverlay Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Loads the current player's hairstyle and overlays from the database and applies them to the player ped. Recommended for use when a player spawns or selects their character. ```APIDOC ## TriggerEvent("murphy_barber:loadbarberoverlay") ### Description Resets global hairstyle caches, fetches data from the database, and applies hairstyles and makeup overlays to the player ped. ### Usage ```lua TriggerEvent("murphy_barber:loadbarberoverlay") ``` ``` -------------------------------- ### Load Hairstyle on Spawn Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Trigger the hairstyle loading event after character creation or when the player spawns. ```lua -- Just trigger the load event TriggerEvent("murphy_barber:loadbarberoverlay") ``` -------------------------------- ### Build Barber Menu Categories Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Defines the menu data structure and the function to populate categories and items for the NUI. ```lua local menucategories = { male = { categories = { "barber", "lifestyle", "makeup" }, barber = { "hairstabble", "hair", "hair_bonnet", "beardstabble", "beard", "beards_complete", "beards_chin", "beards_chops", "beards_mustache" }, makeup = { "eyeliners", "lipsticks", "shadows", "paintedmasks", "blush", "blush2", "foundation", }, lifestyle = { "eyebrows", "scars", "scars2", "scars3", "acne", "ageing", "complex", "disc", "freckles", "grime", "moles", "spots" }, }, female = { categories = { "barber", "lifestyle", "makeup" }, barber = { "hair", "hair_bonnet", "beard", "beards_complete", "beards_chin", "beards_chops", "beards_mustache" }, makeup = { "eyeliners", "lipsticks", "shadows", "paintedmasks", "blush", "blush2", "foundation", }, lifestyle = { "eyebrows", "scars", "scars2", "scars3", "acne", "ageing", "complex", "disc", "freckles", "grime", "moles", "spots" }, } } function OpenBarberMenu(ped, gender) local showoverlay = GetHead(ped) ~= 0 local categories = {} local items = {} -- Build categories for _, k in ipairs(menucategories[gender].categories) do if k == "makeup" or k == "lifestyle" then if showoverlay then table.insert(categories, { id = k, name = k }) end else table.insert(categories, { id = k, name = k }) end end -- Build items for key, value in pairs(menucategories[gender]) do for index, cat in pairs(value) do if MURPHY_ASSETS[gender][cat] and next(MURPHY_ASSETS[gender][cat]) ~= nil then if tostring(key) ~= "categories" then table.insert(items, { id = cat, name = cat, category = key, totalAmount = #MURPHY_ASSETS[gender][cat], value = hairstyleCache[cat] and hairstyleCache[cat].model or 0, }) end end end end -- Send to your NUI SendNUIMessage({ type = "openBarberMenu", categories = categories, items = items }) end ``` -------------------------------- ### Configure Barber Shop Location Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/troubleshooting Define shop coordinates and prop configurations within the Config.Shops table. ```lua ["Rhodes Barber"] = { coords = vector3(1350.788, -1381.203, 83.28922), props = { model = "p_barberchair01x", rotation = {vector3(0.0, 0.0, 169.46511840820312)} } } ``` -------------------------------- ### Define Shop Locations Source: https://docs.murphy-workshop.com/murphy-s-barber/getting-started/configuration Define barber shop locations and optional props for interaction in the Config.Shops table. ```lua Config.Shops = { ["Saint-Denis Barber"] = { coords = vector3(2656.3066, -1181.0294, 53.2785), props = nil -- No specific chair required }, ["Rhodes Barber"] = { coords = vector3(1350.788, -1381.203, 83.28922), props = { model = "p_barberchair01x", rotation = vector3(0.0, 0.0, 169.46511840820312) } } } ``` -------------------------------- ### Trigger murphy_barber:loadbarberoverlay Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Loads the current player's hairstyle and overlays from the database. Recommended for use when a player spawns or selects their character. ```lua TriggerEvent("murphy_barber:loadbarberoverlay") ``` -------------------------------- ### Trigger murphy_barber:clotheitem Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Applies hairstyle components to a ped, including hair, beard, and other elements. ```lua TriggerEvent("murphy_barber:clotheitem", hairstyleComponents, outfitid, overlay, target, charid, isLoadOnly, isCharselectPreview) ``` -------------------------------- ### exports.murphy_clothing:SetClothesForChar Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/character-creator-integration-setclothesforchar-sethairforchar Updates the character's clothing configuration in the database and synchronizes the changes to the client if the player is online. ```APIDOC ## exports.murphy_clothing:SetClothesForChar(charid, clothes, outfitId) ### Description UPSERTs the character's row in `murphy_clothes`. If the player is online, it pushes `murphy_clothing:loadclothes` to their client to apply the outfit immediately. ### Parameters - **charid** (number/string) - Required - Framework character identifier. - **clothes** (table) - Required - Murphy index format, one entry per category. - **outfitId** (number) - Optional - Saved-outfit preset id to link; defaults to 0. ``` -------------------------------- ### murphy_barber:clotheitem Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Applies hairstyle components (hair, beard, etc.) to a ped. ```APIDOC ## TriggerEvent("murphy_barber:clotheitem", hairstyleComponents, outfitid, overlay, target, charid, isLoadOnly, isCharselectPreview) ### Parameters - **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 - **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 ``` -------------------------------- ### Configure Overlay Types in config.lua Source: https://docs.murphy-workshop.com/murphy-s-barber/features/customization Modify the Config.Overlayitems section to enable or disable specific makeup and skin modification options. ```lua Config.Overlayitems = { ["eyeliners"] = true, ["shadows"] = true, ["blush"] = true, ["lipsticks"] = true, ["scars"] = false, ["acne"] = false, ["freckles"] = false } ``` -------------------------------- ### Save Hairstyle Data Client-Side Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Trigger the saving of hairstyle data using either a server event or the callback system upon finalizing character creation. ```lua -- Client-side: Trigger server save function SaveCharacterBarberData() local gender = IsPedMale(PlayerPedId()) TriggerServerEvent("murphy_barber_creator:updatehairstyle", hairstyleCache, overlay_all_layers, 0) end -- Or use the callback system if available Callback.triggerServer('murphy_creator:SavePreset', function(result, outfitid) if result then print("Barber data saved successfully") end end, hairstyleCache, overlay_all_layers, nil, 0, IsPedMale(PlayerPedId())) ``` -------------------------------- ### murphy_barber:loadbarberoverlayOnCharacter Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Loads hairstyle and overlay data onto a specific character ped without affecting the player's global cache. ```APIDOC ## Event: murphy_barber:loadbarberoverlayOnCharacter ### Description Loads hairstyle and overlay data onto a specific character ped, useful for character selection previews. ### Parameters - **charid** (string) - The character ID - **ped** (entity) - The target ped entity ### Usage ```lua TriggerEvent("murphy_barber:loadbarberoverlayOnCharacter", charid, ped) ``` ``` -------------------------------- ### Trigger murphy_barber:makeupitem Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Toggles a makeup overlay from a preset onto the player ped. Toggling the same outfit ID twice will remove the makeup. ```lua TriggerEvent("murphy_barber:makeupitem", outfitid) ``` -------------------------------- ### murphy_clothing:clothesUpdated Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/character-creator-integration-setclothesforchar-sethairforchar Server event triggered whenever clothing is updated, including shop purchases, outfit swaps, or programmatic changes. ```APIDOC ## Event: murphy_clothing:clothesUpdated ### Description Fired on the server after every clothing save operation. ### Parameters - **source** (int) - The player source ID. - **charid** (int) - The character ID. - **clothes** (object) - The updated clothing data. ``` -------------------------------- ### Hairstyle Data Structure Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api The hairstyleCache table defines the model and texture indices for various character hair and beard components. ```lua hairstyleCache = { hair = { model = 5, texture = 0 }, beard = { model = 3, texture = 2 }, beards_chin = { model = 0, texture = 0 }, beards_chops = { model = 0, texture = 0 }, beards_mustache = { model = 0, texture = 0 }, beards_complete = { model = 0, texture = 0 }, hair_bonnet = { model = 0, texture = 0 }, -- ... other categories } ``` -------------------------------- ### murphy_barber:loadbarberoverlayOnCharacter Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Loads hairstyle and overlays for a specific character onto a specific ped, using isolated caches to prevent global cache pollution. ```APIDOC ## TriggerEvent("murphy_barber:loadbarberoverlayOnCharacter", charid, ped) ### Parameters - **charid** (string/int) - The character identifier from your database - **ped** (number) - The ped handle to apply the hairstyle to ### Description Designed for character selection screens to preview multiple characters without affecting the player's current cached data. ``` -------------------------------- ### Trigger murphy_barber:updatehairstyle Server Event Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Updates hairstyle and overlay data in the database. This event is typically handled automatically by the client. ```lua TriggerServerEvent("murphy_barber:updatehairstyle", hairstyleCache, overlay_all_layers, outfitid) ``` -------------------------------- ### exports.murphy_barber:ReloadAppearance Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/character-creator-integration-setclothesforchar-sethairforchar Re-applies the stored barber look to a player. ```APIDOC ## Export: exports.murphy_barber:ReloadAppearance(source) ### Description Re-applies the stored barber look on top of a freshly loaded skin, useful after events like revives or skin reloads. ### Parameters - **source** (int) - The player source ID. ``` -------------------------------- ### Overlay layer record format Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/character-creator-integration-setclothesforchar-sethairforchar The structure of an overlay layer record used within the SetHairForChar export. ```lua { name = "eyebrows", -- which overlay slot visibility = 1, tx_id = 1, tx_normal = 0, tx_material = 0, tx_color_type = 0, tx_opacity = 1.0, tx_unk = 0, palette = 0, palette_color_primary = 0, palette_color_secondary = 0, palette_color_tertiary = 0, var = 0, opacity = 1.0, } ``` -------------------------------- ### exports.murphy_barber:SetHairForChar Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/character-creator-integration-setclothesforchar-sethairforchar Updates the character's hairstyle and overlays in the database and synchronizes the changes to the client if the player is online. ```APIDOC ## exports.murphy_barber:SetHairForChar(charid, hairstyle, overlays) ### Description UPSERTs the character's row in `murphy_barber` and resets its preset link. If `overlays` is provided, it updates the layers; if `nil`, existing overlays are preserved. If the player is online, it pushes `murphy_barber:loadbarberoverlay` to their client. ### Parameters - **charid** (number/string) - Required - Framework character identifier. - **hairstyle** (table) - Required - Murphy index format containing hair and beard categories. - **overlays** (table) - Optional - List of overlay layer records. ``` -------------------------------- ### Trigger murphy_barber:loadbarberoverlayOnCharacter Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Loads hairstyle and overlays for a specific character onto a specific ped. Designed for character selection screens to preview characters without affecting global caches. ```lua TriggerEvent("murphy_barber:loadbarberoverlayOnCharacter", charid, ped) ``` -------------------------------- ### murphy_barber:updatehairstyle Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/murphy-barber-developer-api Updates the hairstyle data in the database for the current player. This event is typically triggered automatically by the client. ```APIDOC ## Event: murphy_barber:updatehairstyle ### Description Updates the hairstyle data in the database for the current player. ### Parameters - **hairstyle** (table) - The hairstyle components table - **overlays** (table) - The overlay data table - **outfitid** (string/int) - The outfit/preset ID ### Usage ```lua TriggerServerEvent("murphy_barber:updatehairstyle", hairstyleCache, overlay_all_layers, outfitid) ``` ``` -------------------------------- ### exports.murphy_clothing:SetClothesForChar(charid, data) Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/character-creator-integration-setclothesforchar-sethairforchar Sets the clothing configuration for a specific character. This method is server-side only and ensures the clothing data is persisted and applied. ```APIDOC ## exports.murphy_clothing:SetClothesForChar(charid, data) ### Description Sets the clothing configuration for a character. This export validates and stores the clothing data so it persists and re-applies on every spawn. ### Parameters - **charid** (number/string) - The unique identifier for the character. - **data** (table) - A table containing clothing components (e.g., hats, shirts_full, pants, boots) with their respective model and texture configurations. ### Returns - **ok** (boolean) - True if successful, false otherwise. - **err** (string) - Error message if the payload is malformed. ``` -------------------------------- ### exports.murphy_barber:SetHairForChar(charid, data) Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/character-creator-integration-setclothesforchar-sethairforchar Sets the hair and beard configuration for a specific character. This method is server-side only and ensures the barber data is persisted and applied. ```APIDOC ## exports.murphy_barber:SetHairForChar(charid, data) ### Description Sets the hair and beard configuration for a character. This export validates and stores the barber data so it persists and re-applies on every spawn. ### Parameters - **charid** (number/string) - The unique identifier for the character. - **data** (table) - A table containing hair and beard components with their respective model and texture configurations. ### Returns - **ok** (boolean) - True if successful, false otherwise. - **err** (string) - Error message if the payload is malformed. ``` -------------------------------- ### exports.murphy_clothing:GetPlayerClothes Source: https://docs.murphy-workshop.com/murphy-s-barber/reference/character-creator-integration-setclothesforchar-sethairforchar Retrieves the currently worn clothing set for a player with resolved hashes. ```APIDOC ## Export: exports.murphy_clothing:GetPlayerClothes(source) ### Description Returns the online player's worn clothing set. ### Parameters - **source** (int) - The player source ID. ### Returns - **object** - A dictionary where keys are categories and values contain { hash, drawable, albedo, normal, material, palette, tint0, tint1, tint2 }. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.