From d5de346e4390a065eeeb8149015a3e2b6e9f0763 Mon Sep 17 00:00:00 2001 From: LikeManTV <56754106+LikeManTV@users.noreply.github.com> Date: Tue, 14 May 2024 22:11:42 +0200 Subject: [PATCH] fix: Shoes not appearing in outfit --- client/cl_class.lua | 29 ++++++++++++++-------------- client/cl_clothing.lua | 43 +++++++++++++++++++----------------------- server/sv_clothing.lua | 38 ++++++++++++++++++------------------- 3 files changed, 53 insertions(+), 57 deletions(-) diff --git a/client/cl_class.lua b/client/cl_class.lua index d8f9cfd..7e8b1ec 100644 --- a/client/cl_class.lua +++ b/client/cl_class.lua @@ -67,12 +67,11 @@ clothing = { local isNaked = utils.isNaked() if not isNaked then clothing.handleUndress('outfit', true) end - for k, v in pairs(data) do - if v.type == 'comp' then - SetPedComponentVariation(cache.ped, v.index, v.drawable, v.texture, v.palette) - elseif v.type == 'prop' then - SetPedPropIndex(cache.ped, v.index, v.drawable, v.texture) - end + for _, v in pairs(data.comps) do + SetPedComponentVariation(cache.ped, v.index, v.drawable, v.texture, v.palette) + end + for _, v in pairs(data.props) do + SetPedPropIndex(cache.ped, v.index, v.drawable, v.texture) end SetPedComponentVariation(cache.ped, 2, hair, hairTexture, 0) appearance.saveSkin() @@ -88,7 +87,7 @@ clothing = { SetPedComponentVariation(cache.ped, 3, lastArms.d, lastArms.t, 2) end - for k,v in pairs(data) do + for _,v in pairs(data) do SetPedComponentVariation(cache.ped, v.index, v.drawable, v.texture, v.palette) appearance.saveSkin() TriggerServerEvent("clothing:sv:removeItem", data, slot) @@ -123,14 +122,16 @@ clothing = { } } - for i = 1, 11 do + for i = 0, 11 do if i ~= 2 then - outfitData.outfit.comps[i] = { - index = i, - drawable = GetPedDrawableVariation(cache.ped, i), - texture = GetPedTextureVariation(cache.ped, i), - pallete = GetPedPaletteVariation(cache.ped, drawable) - } + if i == 5 and Config.AutomaticBackpack == false then + outfitData.outfit.comps[i] = { + index = i, + drawable = GetPedDrawableVariation(cache.ped, i), + texture = GetPedTextureVariation(cache.ped, i), + pallete = GetPedPaletteVariation(cache.ped, drawable) + } + end end end diff --git a/client/cl_clothing.lua b/client/cl_clothing.lua index 14ec735..39461e7 100644 --- a/client/cl_clothing.lua +++ b/client/cl_clothing.lua @@ -77,29 +77,26 @@ local clothesData = Config.Menu.clothes.options for i = 1, 10 do local data = clothesData[i] if data and i ~= 2 then - if i == 5 and Config.AutomaticBackpack then - goto continue - end - - if Config.UseRadial then - cOptions[#cOptions+1] = { - label = _L(data.title), - icon = data.icon, - onSelect = function() - TriggerEvent('clothing:cl:handleClothes', {index = i}) - end - } - else - cOptions[#cOptions+1] = { - title = _L(data.title), - icon = data.icon, - onSelect = function() - TriggerEvent('clothing:cl:handleClothes', {index = i}) - end - } + if i == 5 and Config.AutomaticBackpack == false then + if Config.UseRadial then + cOptions[#cOptions+1] = { + label = _L(data.title), + icon = data.icon, + onSelect = function() + TriggerEvent('clothing:cl:handleClothes', {index = i}) + end + } + else + cOptions[#cOptions+1] = { + title = _L(data.title), + icon = data.icon, + onSelect = function() + TriggerEvent('clothing:cl:handleClothes', {index = i}) + end + } + end end end - ::continue:: end local pOptions = {} @@ -495,9 +492,7 @@ AddEventHandler('playerDropped', function() end) AddEventHandler('onResourceStop', function(resourceName) - if (GetCurrentResourceName() ~= resourceName) then - return - end + if (GetCurrentResourceName() ~= resourceName) then return end if hasMask then Config.MaskFix = false diff --git a/server/sv_clothing.lua b/server/sv_clothing.lua index a4f2ef1..7e7b872 100644 --- a/server/sv_clothing.lua +++ b/server/sv_clothing.lua @@ -19,20 +19,20 @@ RegisterServerEvent('clothing:sv:giveOutfit', function(data, outfit) metadata['type'] = Config.MarkText end - for k,v in pairs(data.outfit.comps) do - metadata[tostring(k)] = {} - metadata[tostring(k)]['type'] = 'comp' - metadata[tostring(k)]['index'] = v.index - metadata[tostring(k)]['drawable'] = v.drawable - metadata[tostring(k)]['texture'] = v.texture - metadata[tostring(k)]['palette'] = v.palette + metadata.comps = {} + metadata.props = {} + for _,v in pairs(data.outfit.comps) do + metadata.comps[v.index] = {} + metadata.comps[v.index]['index'] = v.index + metadata.comps[v.index]['drawable'] = v.drawable + metadata.comps[v.index]['texture'] = v.texture + metadata.comps[v.index]['palette'] = v.palette end - for k,v in pairs(data.outfit.props) do - metadata[tostring(k)] = {} - metadata[tostring(k)]['type'] = 'prop' - metadata[tostring(k)]['index'] = v.index - metadata[tostring(k)]['drawable'] = v.drawable - metadata[tostring(k)]['texture'] = v.texture + for _,v in pairs(data.outfit.props) do + metadata.props[v.index] = {} + metadata.props[v.index]['index'] = v.index + metadata.props[v.index]['drawable'] = v.drawable + metadata.props[v.index]['texture'] = v.texture end Wait(100) @@ -49,12 +49,12 @@ RegisterServerEvent('clothing:sv:giveTorso', function(data) metadata['description'] = string.format('%s \n%s', gender, _L('created_by')..' '..name) end - for k,v in pairs(data.torso) do - metadata[tostring(k)] = {} - metadata[tostring(k)]['index'] = v.index - metadata[tostring(k)]['drawable'] = v.drawable - metadata[tostring(k)]['texture'] = v.texture - metadata[tostring(k)]['palette'] = v.palette + for _,v in pairs(data.torso) do + metadata[v.index] = {} + metadata[v.index]['index'] = v.index + metadata[v.index]['drawable'] = v.drawable + metadata[v.index]['texture'] = v.texture + metadata[v.index]['palette'] = v.palette end Wait(100)