=============== LIBRARY RULES =============== From library maintainers: - Answer only from the published Murphy's Clothing documentation, in the user's language. Cite a relevant clickable Markdown source link under https://docs.murphy-workshop.com/murphy-s-clothing/. - 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_clothing:SetClothesForChar(charid, payload), serveur uniquement. Utilise l'identifiant personnage du framework. Guide requiert Clothing 3.44.0+; ne pas écrire directement dans les tables SQL. - Published reference: Clothing retire les catégories essentielles, dont cheveux et barbe. Les transmettre à exports.murphy_barber:SetHairForChar, avec une version compatible documentée. ### Reverse-Lookup Index Construction Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/character-creator-integration-setclothesforchar-sethairforchar A startup script to build a reverse-lookup table for mapping GUIDs or hashes to catalog indexes. ```lua local index = {} for gender, categories in pairs(MURPHY_ASSETS) do index[gender] = {} for category, assets in pairs(categories) do index[gender][category] = {} for i, asset in ipairs(assets) do if asset.drawable then index[gender][category][asset.drawable] = { model = i } else for v, entry in ipairs(asset) do if entry.hash then index[gender][category][entry.hash] = { model = i, texture = v } end end end end end end ``` -------------------------------- ### getNakedState Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Gets the current naked state of the player. ```lua TriggerEvent('murphy_clothing:getNakedState') -- Returns the state via event return ``` -------------------------------- ### murphy_clothing:GetOutfit Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Gets a specific outfit by ID. ```APIDOC ## murphy_clothing:GetOutfit ### Description Gets a specific outfit by ID. ### Usage Callback.triggerServer('murphy_clothing:GetOutfit', function(datatable, gender) ... , outfitId) ``` -------------------------------- ### Custom Translation in lang.lua Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/translations Example of the key-value structure used to define category translations in the lang.lua file. ```lua Lang.Categories = { ["head"] = "Cabeça", -- Portuguese ["upper"] = "Corpo Superior", -- Portuguese ["lower"] = "Corpo Inferior", -- Portuguese -- Add more language mappings } ``` -------------------------------- ### murphy_clothing:GetWearable Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Gets wearable state data for an outfit. ```APIDOC ## murphy_clothing:GetWearable ### Description Gets wearable state data for an outfit. ### Usage Callback.triggerServer('murphy_clothing:GetWearable', function(datatable) ... , outfitId, charId) ``` -------------------------------- ### murphy_clothing:GetCurrentClothes Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Gets the current clothes for the player. ```APIDOC ## murphy_clothing:GetCurrentClothes ### Description Gets the current clothes for the player. ### Usage Callback.triggerServer('murphy_clothing:GetCurrentClothes', function(datatable, outfitId) ... ) ``` -------------------------------- ### murphy_clothing:GetCurrentOutfitList Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Gets list of all saved outfits for the player. ```APIDOC ## murphy_clothing:GetCurrentOutfitList ### Description Gets list of all saved outfits for the player. ### Usage Callback.triggerServer('murphy_clothing:GetCurrentOutfitList', function(outfitList) ... ) ``` -------------------------------- ### murphy_clothing:GetPlayerTemperatureProtection Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Gets temperature protection data from server. ```APIDOC ## murphy_clothing:GetPlayerTemperatureProtection ### Description Gets temperature protection data from server. ### Usage Callback.triggerServer('murphy_clothing:GetPlayerTemperatureProtection', function(protection) ... ) ``` -------------------------------- ### Add resource to server.cfg Source: https://docs.murphy-workshop.com/murphy-s-clothing/getting-started/installation Ensure the required oxmysql dependency and the murphy_clothing resource are loaded on server startup. ```cfg ensure oxmysql ensure murphy_clothing ``` -------------------------------- ### Initialize bcc-corehud protection variables Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/murphy-clothing-temperature-protection-integration Define the current protection state and the ColdResistance mapping table at the top of the client script. ```lua local currentProtection = { cold = 0, heat = 0 } -- Maps protection level (0-3) to the minimum temperature the player can withstand local ColdResistance = { [0] = 5.0, -- Level 0: starts freezing at 5 C [1] = -5.0, -- Level 1: protected down to -5 C [2] = -15.0, -- Level 2: protected down to -15 C [3] = -20.0, -- Level 3: protected down to -20 C } ``` -------------------------------- ### Configure Shop Management Source: https://docs.murphy-workshop.com/murphy-s-clothing/getting-started/configuration Set commands for loading clothes and managing the clothing system, including keybinds for menu access and removing clothing. ```lua Config.LoadClothesCommand = "loadclothes" Config.ClothesManagement = { Command = "ClothesManagement", -- Menu management command Keybind = 0x70, -- F1 key by default GetNakedKeybind = 0x71 -- F2 key to remove all clothing } ``` -------------------------------- ### Configure Framework Support Source: https://docs.murphy-workshop.com/murphy-s-clothing/getting-started/configuration Set the framework used by the plugin. Supported options include 'vorp', 'REDEMRP2k23', and 'rsg-core'. ```lua Config.framework = "vorp" -- Options: "vorp", "REDEMRP2k23", "rsg-core" ``` -------------------------------- ### murphy_clothing:GetCurrentClothesCharid Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Gets clothes for a specific character ID. ```APIDOC ## murphy_clothing:GetCurrentClothesCharid ### Description Gets clothes for a specific character ID. ### Usage Callback.triggerServer('murphy_clothing:GetCurrentClothesCharid', function(datatable, outfitId) ... , characterId) ``` -------------------------------- ### LoadBasSkin Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Loads and caches the base MP body skin. ```lua TriggerEvent('murphy_clothes:LoadBasSkin') ``` -------------------------------- ### Configure Menu Settings Source: https://docs.murphy-workshop.com/murphy-s-clothing/getting-started/configuration Define the command to open the clothing menu, toggle native prompts, and set the required item for access. ```lua Config.MenuCommand = "openmenu" -- Command to open clothing menu Config.NativePrompt = false -- Use native prompt instead of interaction menu Config.OutfitItem = "clothes" -- Required item to access clothing system ``` -------------------------------- ### Configure Pricing Source: https://docs.murphy-workshop.com/murphy-s-clothing/getting-started/configuration Control whether users pay the full outfit price plus modification costs or only the modification cost. ```lua Config.ModifyOutfitFullPrice = false -- true: Pay full outfit price + modification cost -- false: Pay only modification cost ``` -------------------------------- ### Configure shared/config.lua Source: https://docs.murphy-workshop.com/murphy-s-clothing/getting-started/installation Set the framework type and optional menu command in the shared configuration file. ```lua Config.framework = "vorp" -- Set your framework Config.MenuCommand = "openmenu" -- Optional menu command ``` -------------------------------- ### Fetch initial protection on spawn Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/murphy-clothing-temperature-protection-integration Optional thread to initialize protection levels after the murphy_clothing resource has loaded. ```lua Citizen.CreateThread(function() Wait(5000) -- Wait for murphy_clothing to load local protection = exports['murphy_clothing']:GetTemperatureProtection() if protection then currentProtection.cold = protection.coldProtection or 0 currentProtection.heat = protection.heatProtection or 0 end end) ``` -------------------------------- ### OpenClothingMenu Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Opens the standard clothing menu. ```lua TriggerEvent('murphy_clothes:OpenClothingMenu') ``` -------------------------------- ### clotheitem Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Applies a complete outfit to a ped. ```lua TriggerEvent('murphy_clothes:clotheitem', clothesTable, outfitId, targetPed, charId) ``` -------------------------------- ### OpenClothesMenuCreator Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Opens the clothing menu in creator mode. ```lua TriggerEvent('murphy_clothing:OpenClothesMenuCreator') ``` -------------------------------- ### Metabolism and Temperature Integration Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Shows how to retrieve temperature protection values using GetTemperatureProtection and how to respond to clothing changes via the murphy_clothes:TemperatureUpdate event. ```lua -- Get temperature protection for survival scripts local protection = exports.murphy_clothing:GetTemperatureProtection() if protection.coldProtection < 2 then -- Player doesn't have enough warm clothing print("Player will get cold damage!") end -- Listen for clothing changes AddEventHandler('murphy_clothes:TemperatureUpdate', function(protection) -- Update metabolism based on new clothing UpdatePlayerMetabolism(protection) end) ``` -------------------------------- ### GetEquippedClothing Client-Side Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Returns detailed information about all currently equipped clothing items. ```lua local equipped = exports.murphy_clothing:GetEquippedClothing() --[[ Returns: { ["hats"] = { model = 1, texture = 0, category = "hats" }, ... } ]] ``` -------------------------------- ### EquipMultipleClothes Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Equips multiple clothing items at once. ```lua TriggerEvent('murphy_clothes:EquipMultipleClothes', { ["hats"] = { model = 1, texture = 0 }, ["shirts_full"] = { model = 5, texture = 2 } }, PlayerPedId()) ``` -------------------------------- ### Listen for murphy_clothes:TemperatureUpdate Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Triggered after clothing changes to provide updated temperature protection data. ```lua AddEventHandler('murphy_clothes:TemperatureUpdate', function(protection) -- Same structure as TemperatureProtectionData end) ``` -------------------------------- ### applyWearable Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Applies wearable state data, such as upper and lower body variations. ```lua TriggerEvent('murphy_clothes:applyWearable', wearableData, targetPed) ``` -------------------------------- ### setNaked Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Sets a specific naked state for the player. ```lua TriggerEvent('murphy_clothing:setNaked', true, true) -- naked: boolean, notify: boolean ``` -------------------------------- ### Configure Shop Locations in config.lua Source: https://docs.murphy-workshop.com/murphy-s-clothing/features/clothing-shops Define the coordinates for clothing shop locations within the Config.Shops table. ```lua Config.Shops = { ["Saint-Denis Tailor"] = vector3(2554.636, -1170.411, 53.68349) } ``` -------------------------------- ### Listen for murphy_clothes:TemperatureProtectionData Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Listener event to receive temperature protection data including warm/cold items and protection values. ```lua AddEventHandler('murphy_clothes:TemperatureProtectionData', function(protection) -- protection.warmItems -- protection.coldItems -- protection.coldProtection -- protection.heatProtection -- protection.categories end) ``` -------------------------------- ### Loadlowerbody Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Sets the lower body component in the baseskin cache. ```lua TriggerEvent('murphy_clothes:Loadlowerbody', componentHash) ``` -------------------------------- ### Add a Jewelry Button Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/f1-menu-customization-guide Configures a dedicated button for jewelry items and adds the corresponding label to the language file. ```lua Config.Removecategories = { -- ... existing config jewelry = { "jewelry_necklaces", "jewelry_earrings", "jewelry_bracelets", "jewelry_rings_left", "jewelry_rings_right" }, } ``` ```lua ["Remove_jewelry"] = "Remove Jewelry", ``` -------------------------------- ### Configure Config.framework in config.lua Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/framework-support Set the framework type by modifying the Config.framework variable. Supported options are "vorp", "rsg-core", and "REDEMRP2k23". ```lua Config.framework = "vorp" -- Options: "vorp", "rsg-core", "REDEMRP2k23" ``` -------------------------------- ### Equip-UnequipCategory Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Toggles a specific clothing category on or off. ```lua TriggerEvent('murphy_clothes:Equip-UnequipCategory', "hats") ``` -------------------------------- ### Add an Eyewear Button Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/f1-menu-customization-guide Configures a dedicated button for glasses and adds the corresponding label to the language file. ```lua Config.Removecategories = { -- ... existing config glasses = { "eyewear" }, } ``` ```lua ["Remove_glasses"] = "Remove Glasses", ``` -------------------------------- ### Loadupperbody Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Sets the upper body component in the baseskin cache. ```lua TriggerEvent('murphy_clothes:Loadupperbody', componentHash) ``` -------------------------------- ### Listen for murphy_clothes:OnClothingChanged Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Triggered when any clothing category changes, providing the category name and its equipped status. ```lua AddEventHandler('murphy_clothes:OnClothingChanged', function(category, equipped) -- category: string (clothing category that changed) -- equipped: boolean (whether it's now equipped) end) ``` -------------------------------- ### Callback murphy_clothing:GetPlayerTemperatureProtection Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves temperature protection data from the server. ```lua Callback.triggerServer('murphy_clothing:GetPlayerTemperatureProtection', function(protection) -- protection: temperature data table end) ``` -------------------------------- ### Listen for murphy_clothes:outfitchanged Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Triggered when an outfit is changed or loaded. ```lua AddEventHandler('murphy_clothes:outfitchanged', function() -- Outfit has been changed end) ``` -------------------------------- ### Callback murphy_clothing:GetOutfit Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves a specific outfit's clothes data and gender by providing the outfit ID. ```lua Callback.triggerServer('murphy_clothing:GetOutfit', function(datatable, gender) -- datatable: outfit clothes data -- gender: "male" or "female" end, outfitId) ``` -------------------------------- ### Apply Custom Outfit Programmatically Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Uses the EquipMultipleClothes export to apply a full set of clothing items, including model and texture specifications, in a single call. ```lua -- Equip multiple items at once exports.murphy_clothing:EquipMultipleClothes({ ["hats"] = { model = 5, texture = 2 }, ["coats"] = { model = 10, texture = 1, tint0 = 5, tint1 = 0, tint2 = 0 }, ["shirts_full"] = { model = 3, texture = 0 }, ["pants"] = { model = 8, texture = 2 }, ["boots"] = { model = 4, texture = 1 } }) ``` -------------------------------- ### GetEquippedClothing Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves detailed information about all equipped clothing items. ```APIDOC ## GetEquippedClothing() ### Description Returns detailed information about all equipped clothing items. ### Returns - **table** - A map of categories to their full clothing item details. ``` -------------------------------- ### Toggle and Check Specific Clothing Categories Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Demonstrates toggling a clothing category using the murphy_clothes:Equip-UnequipCategory event and checking if a category is currently equipped with IsClothingCategoryEquipped. ```lua -- Toggle hat on/off TriggerEvent('murphy_clothes:Equip-UnequipCategory', "hats") -- Check if specific category is equipped if exports.murphy_clothing:IsClothingCategoryEquipped("coats") then print("Player is wearing a coat") end ``` -------------------------------- ### loadclothes Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Triggers the loading of the player's current clothes from the database. ```lua TriggerEvent('murphy_clothing:loadclothes') ``` -------------------------------- ### SetClothesForChar and SetHairForChar usage Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/character-creator-integration-setclothesforchar-sethairforchar Demonstrates how to use the server-side exports to set clothing and hair data for a character. 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 ``` -------------------------------- ### Check and React to Bandana State Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Demonstrates how to check if a bandana is equipped using the IsBandanaEquipped export and how to listen for the murphy_clothes:ToggleBandana event to trigger identity visibility changes. ```lua -- Using export if exports.murphy_clothing:IsBandanaEquipped() then print("Player has bandana/mask equipped!") end -- Using event AddEventHandler('murphy_clothes:ToggleBandana', function(state) if state then -- Player put on bandana - hide identity TriggerEvent('your_script:hideIdentity') else -- Player removed bandana - show identity TriggerEvent('your_script:showIdentity') end end) ``` -------------------------------- ### ApplyClothesToCharid Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Applies clothes to a ped based on a character ID. ```lua TriggerEvent('murphy_clothes:ApplyClothesToCharid', charId, targetPed) ``` -------------------------------- ### Configure F1 Menu Keybinds in shared/config.lua Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/f1-menu-customization-guide Modify the Command, Keybind, and GetNakedKeybind settings to customize menu access. Set values to nil to disable specific features. ```lua Config.ClothesManagement = { Command = "ClothesManagement", -- Command to open the menu (nil to disable) Keybind = 0x70, -- F1 key (nil to disable keybind) GetNakedKeybind = 0x71 -- F2 key to remove all clothes (nil to disable) } ``` -------------------------------- ### Configure Clothing Temperature in shared/config.lua Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/murphy-clothing-temperature-protection-integration Define which clothing categories provide warmth or cooling and set the protection thresholds based on the number of items equipped. ```lua Config.ClothingTemperature = { ["coats"] = "warm", ["coats_closed"] = "warm", ["ponchos"] = "warm", ["cloaks"] = "warm", ["vests"] = "warm", ["gloves"] = "warm", ["boots"] = "warm", ["chaps"] = "warm", ["shirts_full"] = "neutral", ["skirts"] = "cold", ["pants"] = "neutral", ["hats"] = "neutral", } Config.TemperatureProtection = { cold = { [0] = 0, -- 0 warm items = no protection [1] = 1, -- 1 warm item = light [2] = 1, -- 2 warm items = light [3] = 2, -- 3 warm items = medium [4] = 2, -- 4 warm items = medium [5] = 3, -- 5+ warm items = heavy }, heat = { [0] = 0, [1] = 1, [2] = 2, [3] = 3, } } ``` -------------------------------- ### GetTemperatureProtection() Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/murphy-clothing-temperature-protection-integration Retrieves the full temperature protection data for the current player. ```APIDOC ## GetTemperatureProtection() ### Description Returns the complete temperature protection data object for the player. ### Signature `exports['murphy_clothing']:GetTemperatureProtection()` ### Returns - **protection** (table) - An object containing warmItems, coldItems, coldProtection, heatProtection, and categories. ``` -------------------------------- ### OpenWardrobe Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Opens the outfit list in wardrobe mode, allowing players to equip saved outfits without charge. ```lua TriggerEvent('murphy_clothes:OpenWardrobe') ``` -------------------------------- ### GetTemperatureProtection Client-Side Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Returns the player's temperature protection data, including counts of warm/cold items and protection levels against heat and cold. ```lua local protection = exports.murphy_clothing:GetTemperatureProtection() --[[ Returns: { warmItems = 3, -- Number of warm clothing items equipped coldItems = 1, -- Number of cold clothing items equipped coldProtection = 2, -- Protection level against cold (0-3) heatProtection = 1, -- Protection level against heat (0-3) categories = {"coats", "shirts_full", "boots", "skirts"} } Protection levels: 0 = No protection 1 = Light protection 2 = Medium protection 3 = Heavy protection ]] ``` -------------------------------- ### GetClothingInfo Client-Side Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Returns detailed information about a specific clothing category if it is currently equipped, otherwise returns nil. ```lua local hatInfo = exports.murphy_clothing:GetClothingInfo("hats") --[[ Returns (if equipped): { category = "hats", model = 1, texture = 0, temperature = "neutral" } Returns nil if not equipped ]] ``` -------------------------------- ### Callback murphy_clothing:GetCurrentClothes Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves the current clothes data and outfit ID for the player. ```lua Callback.triggerServer('murphy_clothing:GetCurrentClothes', function(datatable, outfitId) -- datatable: table of clothes data -- outfitId: current outfit ID end) ``` -------------------------------- ### Manage Naked State for Medical Scripts Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Provides methods to set or toggle the player's naked state, useful for medical examinations or hospital scripts. ```lua -- Undress player for medical examination exports.murphy_clothing:SetNaked(true, true) -- After treatment, dress player back exports.murphy_clothing:SetNaked(false, true) -- Toggle naked (useful for keybinds) exports.murphy_clothing:ToggleNaked(true) ``` -------------------------------- ### GetPlayerTemperatureProtection Server Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves a player's temperature protection data, including counts of warm/cold items and protection values. ```lua local protection = exports.murphy_clothing:GetPlayerTemperatureProtection(source) --[[ Returns: { warmItems = 3, coldItems = 1, coldProtection = 2, heatProtection = 1 } ]] ``` -------------------------------- ### Listen for murphy_clothes:ToggleBandana Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Triggered when the bandana state changes. Also triggers syn_robbery:bandana for compatibility. ```lua AddEventHandler('murphy_clothes:ToggleBandana', function(state) -- state: boolean (true = bandana up, false = bandana down) end) ``` -------------------------------- ### Callback murphy_clothing:GetCurrentOutfitList Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves an array of all saved outfit records for the player. ```lua Callback.triggerServer('murphy_clothing:GetCurrentOutfitList', function(outfitList) -- outfitList: array of outfit records end) ``` -------------------------------- ### murphy_clothing:clothesUpdated Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/character-creator-integration-setclothesforchar-sethairforchar Server event fired after every clothing save, including shop purchases, outfit swaps, or manual updates via SetClothesForChar. ```APIDOC ## Event: murphy_clothing:clothesUpdated ### Description Server event fired after every clothing save (shop, outfit swap, or SetClothesForChar). ### Parameters - **source** (int) - The player source ID. - **charid** (int) - The character ID. - **clothes** (table) - The updated clothing data. ``` -------------------------------- ### Define Clothing Shop Locations Source: https://docs.murphy-workshop.com/murphy-s-clothing/getting-started/configuration Specify the coordinates for clothing shop locations. ```lua Config.Shops = { ["Saint-Denis Tailor"] = vector3(2554.636, -1170.411, 53.68349), -- Add more shop locations } ``` -------------------------------- ### GetEquippedCategories Client-Side Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Returns a table of all currently equipped clothing categories including their model and texture data. ```lua local equippedCategories = exports.murphy_clothing:GetEquippedCategories() --[[ Returns: { ["hats"] = { model = 1, texture = 0 }, ["coats"] = { model = 5, texture = { palette = 2, tint0 = 0, tint1 = 0, tint2 = 0 } }, ... } ]] ``` -------------------------------- ### Callback murphy_clothing:GetWearable Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves wearable state data for a specific outfit and character ID. ```lua Callback.triggerServer('murphy_clothing:GetWearable', function(datatable) -- datatable: wearable state data end, outfitId, charId) ``` -------------------------------- ### Listen for clothing temperature updates Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/murphy-clothing-temperature-protection-integration Event handler to update local protection variables when murphy_clothing broadcasts changes. ```lua AddEventHandler('murphy_clothes:TemperatureUpdate', function(protection) if type(protection) == 'table' then currentProtection.cold = tonumber(protection.coldProtection) or 0 currentProtection.heat = tonumber(protection.heatProtection) or 0 end end) ``` -------------------------------- ### Remove a Button Entirely Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/f1-menu-customization-guide Demonstrates how to remove a button by commenting out or deleting the entry from Config.Removecategories. ```lua Config.Removecategories = { head = { ... }, neck = { ... }, torso = { ... }, shirts = { ... }, legs = { ... }, feet = { ... }, hands = { ... }, -- weapons = { ... }, -- REMOVED accessories = { ... } } ``` -------------------------------- ### GetEquippedCategories Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves all currently equipped clothing categories. ```APIDOC ## GetEquippedCategories() ### Description Returns a table of all currently equipped clothing categories with their model and texture data. ### Returns - **table** - A map of categories to their model and texture data. ``` -------------------------------- ### Add a Separate Hat Only Button Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/f1-menu-customization-guide Configures a dedicated button for hats and adds the corresponding label to the language file. ```lua Config.Removecategories = { -- Existing head button now without hats head = { "masks", "eyewear", "headwear", "face_props", "hat_accessories", "masks_large" }, -- New separate hat button hat = { "hats" }, -- ... rest of config } ``` ```lua Lang.Categories = { ["Remove_hat"] = "Remove Hat", -- ... rest of labels } ``` -------------------------------- ### EquipMultipleClothes Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Applies multiple clothing items to the player at once. ```APIDOC ## exports.murphy_clothing:EquipMultipleClothes(outfitData) ### Description Equips a set of clothing items defined by category, model, and texture. ### Parameters - **outfitData** (table) - Required - A table where keys are clothing categories (e.g., "hats", "coats") and values are tables containing `model`, `texture`, and optional tint values. ``` -------------------------------- ### murphy_clothes:GetTemperatureProtection Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Requests temperature protection data from the system. ```APIDOC ## TriggerEvent('murphy_clothes:GetTemperatureProtection') ### Description Requests temperature protection data. The result is returned via the 'murphy_clothes:TemperatureProtectionData' event. ``` -------------------------------- ### GetPlayerTemperatureProtection(source) Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves a player's temperature protection data on the server side. ```APIDOC ## GetPlayerTemperatureProtection(source) ### Description Server-side function to get a player's temperature protection data. ### Parameters - **source** (number) - Required - Player server ID ### Returns - **table** - Contains warmItems, coldItems, coldProtection, and heatProtection values. ``` -------------------------------- ### GetEquippedClothing() Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/murphy-clothing-temperature-protection-integration Retrieves a list of all currently equipped clothing items categorized by type. ```APIDOC ## GetEquippedClothing() ### Description Returns a table of all clothing items currently equipped by the player, mapped by category. ### Signature `exports['murphy_clothing']:GetEquippedClothing()` ### Returns - **equipped** (table) - A dictionary where keys are categories and values are tables containing {model, texture, category}. ``` -------------------------------- ### toggleNaked Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Toggles the player's naked state. ```lua TriggerEvent('murphy_clothing:toggleNaked', true) -- notify: boolean ``` -------------------------------- ### Listen for murphy_clothes:BandanaStatus Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Listener event to receive the bandana status as a boolean. ```lua AddEventHandler('murphy_clothes:BandanaStatus', function(hasBandana) -- hasBandana: boolean end) ``` -------------------------------- ### SaveClothesCreator Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Saves the current outfit configured in creator mode. ```lua TriggerEvent('murphy_clothing:SaveClothesCreator') ``` -------------------------------- ### EquipMultipleClothes Client-Side Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Equips multiple clothing items simultaneously. Supports model, texture, and tint values, and accepts an optional ped entity. ```lua local success = exports.murphy_clothing:EquipMultipleClothes({ ["hats"] = { model = 1, texture = 0, tint0 = 0, tint1 = 0, tint2 = 0 }, ["shirts_full"] = { model = 5, texture = 2 }, ["coats"] = { model = 3, texture = 1 } }, PlayerPedId()) -- Returns: boolean (success) ``` -------------------------------- ### Overlay layer record format Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/character-creator-integration-setclothesforchar-sethairforchar The structure required for each entry in the overlays table when using SetHairForChar. ```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, } ``` -------------------------------- ### Configure Job-Locked Categories Source: https://docs.murphy-workshop.com/murphy-s-clothing/getting-started/configuration Restrict specific clothing categories to certain jobs and job levels. ```lua Config.JobLocked = { ["jewelry_rings_right"] = { {"jeweler", 2}, {"jeweler2", 2} }, ["jewelry_rings_left"] = { {"jeweler", 2}, {"jeweler2", 2} } } ``` -------------------------------- ### murphy_clothes:TemperatureProtectionData Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Listener event that receives temperature protection data. ```APIDOC ## AddEventHandler('murphy_clothes:TemperatureProtectionData', function(protection)) ### Description Receives the temperature protection data object. ### Parameters - **protection** (object) - Contains warmItems, coldItems, coldProtection, heatProtection, and categories. ``` -------------------------------- ### exports.murphy_barber:ReloadAppearance Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/character-creator-integration-setclothesforchar-sethairforchar Re-applies the stored barber look on top of a freshly loaded skin. ```APIDOC ## Export: exports.murphy_barber:ReloadAppearance ### Description Re-applies the stored barber look on top of a freshly loaded skin (useful after revives or skin reloads). ### Parameters - **source** (int) - The player source ID. ``` -------------------------------- ### EquipMultipleClothes Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Equips multiple clothing items at once. ```APIDOC ## EquipMultipleClothes(clothesData, ped) ### Description Equips multiple clothing items at once with support for model, texture, and tint values. ### Parameters - **clothesData** (table) - Table of clothing categories with model/texture/tint data. - **ped** (number) - Optional: Ped entity to apply clothes to, defaults to PlayerPedId(). ### Returns - **boolean** - Success status of the operation. ``` -------------------------------- ### Callback murphy_clothing:IsBandanaEquipped Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Checks the bandana status for the player, returning a boolean value. ```lua Callback.triggerServer('murphy_clothing:IsBandanaEquipped', function(hasBandana) -- hasBandana: boolean end) ``` -------------------------------- ### SetNaked Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Sets the player's naked state explicitly. ```APIDOC ## SetNaked(naked, notify) ### Description Sets a specific naked state for the player. ### Parameters - **naked** (boolean) - true to undress, false to dress. - **notify** (boolean) - If true, displays a notification to the player. ### Returns - **boolean** - Success status of the operation. ``` -------------------------------- ### Murphy Clothing Event Handlers Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/murphy-clothing-temperature-protection-integration Listen for these events to trigger logic when clothing is updated or toggled. The TemperatureUpdate event includes a 500ms delay for cache synchronization. ```lua -- Fired every time clothing changes (with 500ms delay for cache sync) AddEventHandler('murphy_clothes:TemperatureUpdate', function(protection) -- protection = { warmItems, coldItems, coldProtection, heatProtection, categories } end) -- Fired immediately when a clothing category is toggled AddEventHandler('murphy_clothes:OnClothingChanged', function(category, equipped) -- category = "coats", "boots", etc. -- equipped = true/false end) ``` -------------------------------- ### GetClothingInfo Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves detailed info for a specific category. ```APIDOC ## GetClothingInfo(category) ### Description Returns detailed information about a specific clothing category if equipped. ### Parameters - **category** (string) - The clothing category to retrieve info for. ### Returns - **table|nil** - Clothing details if equipped, otherwise nil. ``` -------------------------------- ### GetTemperatureProtection Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves temperature protection data. ```APIDOC ## GetTemperatureProtection() ### Description Returns the player's temperature protection data based on equipped clothing. ### Returns - **table** - Contains warm/cold item counts, protection levels, and affected categories. ``` -------------------------------- ### SetHairForChar Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/character-creator-integration-setclothesforchar-sethairforchar Sets hair and facial hair items for a character. ```APIDOC ## SetHairForChar ### Description Sets hair and facial hair items for a character. This export handles categories such as hair, hair_bonnet, beard, beards_complete, beards_chin, beards_mustache, and beards_chops, as well as makeup and face overlays. ### Parameters - **charid** (int/string) - Required - The framework's character identifier. - **hairData** (table) - Required - A table where keys are categories and values are the model/texture index data. ### Data Format ```lua { [category] = { model = , -- 1-based index into MURPHY_ASSETS texture = -- variant index or table with palette/tint values } } ``` ``` -------------------------------- ### ResetClothesMenuCreator Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Resets the data used in creator mode. ```lua TriggerEvent('murphy_clothing:ResetClothesMenuCreator') ``` -------------------------------- ### IsClothingCategoryEquipped Client-Side Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Checks if a specific clothing category, such as "hats" or "coats", is currently equipped. ```lua local hasHat = exports.murphy_clothing:IsClothingCategoryEquipped("hats") -- Returns: boolean ``` -------------------------------- ### exports.murphy_barber:SetHairForChar(charid, hairstyle, overlays) Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/character-creator-integration-setclothesforchar-sethairforchar Updates the character's hair and overlay settings in the database and synchronizes the changes to the client if the player is online. ```APIDOC ## exports.murphy_barber:SetHairForChar(charid, hairstyle, overlays) ### Description Updates the character's hair and overlay records in the `murphy_barber` table. If overlays are provided, they are processed based on server configuration. ### 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. Pass nil to preserve existing overlays. ``` -------------------------------- ### SetClothesForChar Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/character-creator-integration-setclothesforchar-sethairforchar Sets clothing items for a character. Note that this export silently strips essential categories like skin and hair, so it should be used in conjunction with SetHairForChar. ```APIDOC ## SetClothesForChar ### Description Sets clothing items for a character. This export handles categories such as hats, coats, shirts, vests, pants, boots, masks, and accessories. It silently strips essential categories like skin and hair, so it is recommended to call both SetClothesForChar and SetHairForChar. ### Parameters - **charid** (int/string) - Required - The framework's character identifier. - **clothingData** (table) - Required - A table where keys are categories and values are the model/texture index data. ### Data Format ```lua { [category] = { model = , -- 1-based index into MURPHY_ASSETS texture = -- variant index or table with palette/tint values } } ``` ``` -------------------------------- ### IsPlayerNaked Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Checks if the player is currently in a naked state. ```APIDOC ## IsPlayerNaked() ### Description Checks if the player is currently naked (no clothes equipped, only MP body visible). ### Returns - **boolean** - True if the player is naked, false otherwise. ``` -------------------------------- ### Callback murphy_clothing:GetCurrentClothesCharid Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves clothes data and outfit ID for a specific character ID. ```lua Callback.triggerServer('murphy_clothing:GetCurrentClothesCharid', function(datatable, outfitId) -- datatable: table of clothes data -- outfitId: outfit ID end, characterId) ``` -------------------------------- ### murphy_clothes:clotheitem Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Applies a complete outfit to a ped. ```APIDOC ## murphy_clothes:clotheitem ### Description Applies a complete outfit to a ped. ### Parameters - **clothesTable** (table) - Required - Table containing clothing data for each category - **outfitId** (string/number) - Required - The outfit ID - **targetPed** (number) - Optional - Target ped entity - **charId** (string/number) - Optional - Character ID ``` -------------------------------- ### murphy_clothing:IsBandanaEquipped Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Server-side callback to check bandana status. ```APIDOC ## murphy_clothing:IsBandanaEquipped ### Description Server-side callback to check bandana status. ### Usage Callback.triggerServer('murphy_clothing:IsBandanaEquipped', function(hasBandana) ... ) ``` -------------------------------- ### Separate Coat and Vest Buttons Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/f1-menu-customization-guide Configures separate buttons for coats and vests, updating the torso category and adding labels. ```lua Config.Removecategories = { -- Coat only coat = { "coats", "coats_heavy", "coats_closed", "cloaks", "ponchos" }, -- Vest only vest = { "vests" }, -- Rest of torso items torso = { "suspenders", "overalls_full", "shirts_full_overpants", "unionsuits_full", "overalls_modular_uppers" }, -- ... rest of config } ``` ```lua ["Remove_coat"] = "Remove Coat", ["Remove_vest"] = "Remove Vest", ``` -------------------------------- ### Add a Mask Only Button Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/f1-menu-customization-guide Configures a dedicated button for masks and adds the corresponding label to the language file. ```lua Config.Removecategories = { -- ... existing config mask = { "masks", "masks_large" }, } ``` ```lua ["Remove_mask"] = "Remove Mask", ``` -------------------------------- ### exports.murphy_clothing:SetClothesForChar(charid, clothes, outfitId) Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/character-creator-integration-setclothesforchar-sethairforchar Updates the character's clothing records in the database and synchronizes the changes to the client if the player is online. ```APIDOC ## exports.murphy_clothing:SetClothesForChar(charid, clothes, outfitId) ### Description Updates the character's clothing in the `murphy_clothes` table. If the player is online, it triggers an immediate client-side update. ### 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. ``` -------------------------------- ### IsBandanaEquipped Server Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Checks if a player has a bandana or mask equipped using their server ID. ```lua local hasBandana = exports.murphy_clothing:IsBandanaEquipped(source) -- Returns: boolean ``` -------------------------------- ### Configure Single Item Categories Source: https://docs.murphy-workshop.com/murphy-s-clothing/features/clothing-menu Defines which clothing categories can be equipped independently, such as hats and glasses. ```lua Config.SingleItemCategory = { ["hat"] = { "hats", "hat_accessories" }, ["glasses"] = { "eyewear" } } ``` -------------------------------- ### Configure Config.Removecategories in shared/config.lua Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/f1-menu-customization-guide Defines the button groups and their associated clothing categories for the F1 menu. Buttons only appear in the menu if the player is currently wearing at least one item from the specified categories. ```lua Config.Removecategories = { head = { "hats", "masks", "eyewear", "headwear", "face_props", "hat_accessories", "masks_large" }, neck = { "neckties", "neckwear", "neckerchiefs" }, torso = { "coats", "coats_heavy", "coats_closed", "cloaks", "ponchos", "vests", "suspenders", "overalls_full", "shirts_full_overpants", "unionsuits_full", "overalls_modular_uppers" }, shirts = { "shirts_full", "lduvmjua_0x2b388a05" }, legs = { "pants", "pants_accessories", "spats", "belts", "skirts" }, feet = { "boot_accessories", "chaps", "boots", "aprons" }, hands = { "gloves" }, weapons = { "gunbelts", "holsters_right", "holsters_knife", "loadouts", "holsters_left", "holsters_crossdraw", "holsters_center", "gunbelt_accs", "holsters_quivers", "ammo_pistols" }, accessories = { "jewelry_necklaces", "gloves", "belts", "neckwear", "neckerchiefs", "neckties", "accessories", "jewelry_earrings", "jewelry_bracelets", "aprons", "gauntlets", "chaps", "satchels", "jewelry_rings_left", "wrist_bindings", "belt_buckles", "badges", "jewelry_rings_right", "ankle_bindings", "mbbwboia_0x42e8f927", "pants_accessories", "coat_accessories", "armor" } } ``` -------------------------------- ### SetNaked Client-Side Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Sets a specific naked state for the player. The naked parameter determines if the player is undressed (true) or dressed (false). ```lua local success = exports.murphy_clothing:SetNaked(true, true) -- Returns: boolean (success) ``` -------------------------------- ### Trigger murphy_clothes:GetTemperatureProtection Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Requests temperature protection data, which triggers the murphy_clothes:TemperatureProtectionData event with the result. ```lua TriggerEvent('murphy_clothes:GetTemperatureProtection') -- Triggers 'murphy_clothes:TemperatureProtectionData' with result ``` -------------------------------- ### GetTemperatureProtection Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Retrieves the current temperature protection values for the player based on their clothing. ```APIDOC ## exports.murphy_clothing:GetTemperatureProtection() ### Description Returns an object containing temperature protection statistics for survival script integration. ### Returns - **table** - An object containing `coldProtection` and potentially other protection values. ``` -------------------------------- ### IsBandanaEquipped Client-Side Export Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Checks if the player has a bandana or mask currently equipped. ```lua local hasBandana = exports.murphy_clothing:IsBandanaEquipped() -- Returns: boolean ``` -------------------------------- ### itemclothes Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Equips or unequips a single clothing category. ```lua TriggerEvent('murphy_clothes:itemclothes', category, model, texture) ``` -------------------------------- ### murphy_clothes:updateclothes Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Updates the player's clothes in the database. ```APIDOC ## murphy_clothes:updateclothes ### Description Updates the player's clothes in the database. ### Usage TriggerServerEvent('murphy_clothes:updateclothes', clothesTable, outfitId) ``` -------------------------------- ### RemoveAllClothes Client Event Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Removes all clothes from the ped, excluding essential categories. ```lua TriggerEvent('murphy:clothing:RemoveAllClothes', PlayerPedId()) ``` -------------------------------- ### ToggleNaked Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Toggles the player's naked state. ```APIDOC ## exports.murphy_clothing:ToggleNaked(state) ### Description Toggles the naked state of the player. ### Parameters - **state** (boolean) - Required - The target state. ``` -------------------------------- ### ToggleNaked Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/api-documentation Toggles the player's naked state. ```APIDOC ## ToggleNaked(notify) ### Description Toggles between naked state and clothed state. ### Parameters - **notify** (boolean) - If true, displays a notification to the player. ### Returns - **boolean** - Success status of the operation. ``` -------------------------------- ### Modify temperature damage function Source: https://docs.murphy-workshop.com/murphy-s-clothing/advanced/murphy-clothing-temperature-protection-integration Integrate the protection threshold into the damage calculation logic to prevent damage when the player is sufficiently protected. ```lua local function applySimpleTemperatureDamage(ped, temperature) local damage = C.tempDamagePerTick or 0.0 if damage <= 0.0 or ped == 0 or IsEntityDead(ped) then stopTemperatureFx() return false, false end local below = C.minTempDamage and temperature < C.minTempDamage local above = C.maxTempDamage and temperature > C.maxTempDamage -- Apply cold protection from clothing if below then local threshold = ColdResistance[currentProtection.cold] or 5.0 if temperature > threshold then below = false -- Clothing protects the player end end -- Apply heat protection from clothing (optional, same logic) -- if above then -- ... -- end if not below and not above then stopTemperatureFx() return false, false end -- ... rest of your damage logic end ```