rcore_clothing partial support

This relys on the default server file to handle most, but we have opening menus and when rcore_clothing provides as qb/esx_skin this should resolve the errors if the framework didnt match the bridged option. Formatting fixed, debug commands disabled as this is for production.
This commit is contained in:
MrNewb committed 2025-07-11 15:23:24 -04:00
1 parent a280606c3d
commit c7d638cbfb
13 files changed
+124 -174

No files matched your search

+19 -56
View File
@@ -1,5 +1,4 @@
--[[This module is incomplete]]--
---@diagnostic disable: duplicate-set-field
Clothing = Clothing or {}
ClothingBackup = {}
@@ -25,10 +24,12 @@ function Clothing.GetAppearance(entity)
local model = GetEntityModel(entity)
local skinData = { model = model, components = {}, props = {} }
for i = 0, 11 do
table.insert(skinData.components, { component_id = i, drawable = GetPedDrawableVariation(entity, i), texture = GetPedTextureVariation(entity, i) })
table.insert(skinData.components,
{ component_id = i, drawable = GetPedDrawableVariation(entity, i), texture = GetPedTextureVariation(entity, i) })
end
for i = 0, 13 do
table.insert(skinData.props, { prop_id = i, drawable = GetPedPropIndex(entity, i), texture = GetPedPropTextureIndex(entity, i) })
table.insert(skinData.props,
{ prop_id = i, drawable = GetPedPropIndex(entity, i), texture = GetPedPropTextureIndex(entity, i) })
end
return skinData
end
@@ -91,11 +92,10 @@ end, 1000)
local onChange = nil
Clothing.ToggleDebugging = function()
if Clothing.RunningDebug then
Clothing.RunningDebug = false
print("Clothing Debugging Disabled")
return Cache.RemoveOnChange('Clothing', onChange)
return Cache.RemoveOnChange('Clothing', onChange)
end
Clothing.RunningDebug = true
print("Clothing Debugging Enabled")
@@ -109,63 +109,23 @@ Clothing.ToggleDebugging = function()
for k, v in pairs(old.components) do
if v.component_id then
if new.components[k].drawable ~= v.drawable or new.components[k].texture ~= v.texture then
print("Component ID: " .. v.component_id .. " Drawable: " .. new.components[k].drawable .. " Texture: " .. new.components[k].texture)
print("Component ID: " ..
v.component_id ..
" Drawable: " .. new.components[k].drawable .. " Texture: " .. new.components[k].texture)
end
end
end
for k, v in pairs(old.props) do
if v.prop_id then
if new.props[k].drawable ~= v.drawable or new.props[k].texture ~= v.texture then
print("Prop ID: " .. v.prop_id .. " Drawable: " .. new.props[k].drawable .. " Texture: " .. new.props[k].texture)
print("Prop ID: " ..
v.prop_id .. " Drawable: " .. new.props[k].drawable .. " Texture: " .. new.props[k].texture)
end
end
end
end)
-- CreateThread(function()
-- while Clothing.RunningDebug do
-- Wait(3)
-- local ped = PlayerPedId()
-- if ped then
-- if not Clothing.Cache then
-- Clothing.Cache = Clothing.GetAppearance(ped)
-- end
-- for k, v in pairs(Clothing.Cache.components) do
-- if v.component_id then
-- local drawable = GetPedDrawableVariation(ped, v.component_id)
-- local texture = GetPedTextureVariation(ped, v.component_id)
-- if drawable ~= v.drawable or texture ~= v.texture then
-- print("Component ID: " .. v.component_id .. " Drawable: " .. drawable .. " Texture: " .. texture)
-- Clothing.Cache.components[k].drawable = drawable
-- Clothing.Cache.components[k].texture = texture
-- end
-- end
-- end
-- for k, v in pairs(Clothing.Cache.props) do
-- if v.prop_id then
-- local drawable = GetPedPropIndex(ped, v.prop_id)
-- local texture = GetPedPropTextureIndex(ped, v.prop_id)
-- if drawable ~= v.drawable or texture ~= v.texture then
-- print("Prop ID: " .. v.prop_id .. " Drawable: " .. drawable .. " Texture: " .. texture)
-- Clothing.Cache.props[k].drawable = drawable
-- Clothing.Cache.props[k].texture = texture
-- end
-- end
-- end
-- end
-- -- esc key to exit
-- if IsControlJustPressed(0, 177) then
-- Clothing.RunningDebug = false
-- print("Clothing Debugging Disabled")
-- end
-- end
-- Clothing.Cache = nil
-- end)
end
RegisterCommand("clothing:enabledebug", function(source, args, rawCommand)
Clothing.ToggleDebugging()
end)
RegisterNetEvent('community_bridge:client:SetAppearance', function(data)
Clothing.SetAppearance(PlayerPedId(), data)
end)
@@ -178,10 +138,13 @@ RegisterNetEvent('community_bridge:client:RestoreAppearance', function()
Clothing.RestoreAppearance(PlayerPedId())
end)
RegisterCommand("clothing:copy", function(source, args, rawCommand)
Clothing.CopyAppearanceToClipboard()
end)
-- RegisterCommand("clothing:enabledebug", function(source, args, rawCommand)
-- Clothing.ToggleDebugging()
-- end)
-- RegisterCommand("clothing:copy", function(source, args, rawCommand)
-- Clothing.CopyAppearanceToClipboard()
-- end)
return Clothing
return Clothing
+2 -4
View File
@@ -1,5 +1,4 @@
--[[This module is incomplete]]--
---@diagnostic disable: duplicate-set-field
Clothing = Clothing or {}
Clothing.LastAppearance = Clothing.LastAppearance or {}
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
@@ -10,7 +9,6 @@ function Clothing.IsMale(src)
return GetEntityModel(ped) == `mp_m_freemode_01`
end
function Clothing.GetAppearance(src)
return Callback.Trigger('community_bridge:cb:GetAppearance', src)
end
@@ -55,4 +53,4 @@ end
-- Clothing.ReloadSkin(src)
-- end)
return Clothing
return Clothing
+3 -2
View File
@@ -1,7 +1,8 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
TriggerEvent('esx_skin:openMenu', function()end, function()end, true)
end
TriggerEvent('esx_skin:openMenu', function() end, function() end, true)
end
+4 -2
View File
@@ -1,5 +1,6 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
@@ -17,7 +18,7 @@ function Clothing.GetFullAppearanceData(src)
if Clothing.Players[citId] then return Clothing.Players[citId] end
local result = MySQL.query.await('SELECT skin FROM users WHERE identifier = ?', { citId})
local result = MySQL.query.await('SELECT skin FROM users WHERE identifier = ?', { citId })
if result[1] == nil then return end
local model = GetEntityModel(GetPlayerPed(src))
@@ -63,6 +64,7 @@ function Clothing.Save(src)
citId
})
end
---Sets a player's appearance based on the provided data
---@param src number The server ID of the player
---@param data table The appearance data to apply
@@ -172,4 +174,4 @@ end)
Callback.Register('community_bridge:cb:GetAppearance', function(source)
local src = source
return Clothing.GetAppearance(src)
end)
end)
+7 -19
View File
@@ -1,5 +1,6 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_skin') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
@@ -58,19 +59,19 @@ Props.InverseMap = {
-- Converts from illinium format to esx format
function Components.ConvertFromDefault(defaultComponents)
local returnComponents = {}
for index, componentData in pairs(defaultComponents or {}) do
for index, componentData in pairs(defaultComponents or {}) do
local componentId = Components.Map[componentData.component_id]
if componentId then
returnComponents[componentId .. '_1'] = componentData.drawable
returnComponents[componentId .. '_2'] = componentData.texture
end
end
return returnComponents
end
return returnComponents
end
function Components.ConvertToDefault(esxComponents)
local returnComponents = {}
for componentIndex, componentData in pairs(esxComponents or {}) do
for componentIndex, componentData in pairs(esxComponents or {}) do
local isTexture = componentIndex:find('_2')
componentIndex = componentIndex:gsub('_1', ''):gsub('_2', '')
local componentId = Components.InverseMap[componentIndex]
@@ -103,7 +104,7 @@ end
function Props.ConvertToDefault(esxProps)
local returnProps = {}
for propIndex, propData in pairs(esxProps or {}) do
for propIndex, propData in pairs(esxProps or {}) do
local isTexture = propIndex:find('_2')
propIndex = propIndex:gsub('_1', ''):gsub('_2', '')
local propId = Props.InverseMap[propIndex]
@@ -142,19 +143,6 @@ function Clothing.ConvertToDefault(esxClothing)
return { components = components, props = props }
end
-- Clothing = {}
-- StoredOldClothing = {}
@@ -213,4 +201,4 @@ end
-- end
-- end
-- TriggerEvent('esx-clothing:client:loadOutfit', repackedTable)
-- end
-- end
+1 -1
View File
@@ -1,8 +1,8 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('fivem-appearance') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
TriggerEvent('qb-clothing:client:openMenu')
end
+13 -12
View File
@@ -1,5 +1,6 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('fivem-appearance') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
@@ -159,20 +160,20 @@ end)
RegisterCommand('clothing:debug', function(source, args, rawCommand)
local src = source
Clothing.SetAppearance(src, {
components ={
{component_id = 1, drawable = math.random(0, 50), texture = 0},
{component_id = 2, drawable = math.random(0, 50), texture = 0},
{component_id = 3, drawable = math.random(0, 50), texture = 0},
{component_id = 4, drawable = math.random(0, 50), texture = 0},
{component_id = 5, drawable = math.random(0, 50), texture = 0},
{component_id = 6, drawable = math.random(0, 50), texture = 0},
{component_id = 7, drawable = math.random(0, 50), texture = 0},
{component_id = 8, drawable = math.random(0, 50), texture = 0},
components = {
{ component_id = 1, drawable = math.random(0, 50), texture = 0 },
{ component_id = 2, drawable = math.random(0, 50), texture = 0 },
{ component_id = 3, drawable = math.random(0, 50), texture = 0 },
{ component_id = 4, drawable = math.random(0, 50), texture = 0 },
{ component_id = 5, drawable = math.random(0, 50), texture = 0 },
{ component_id = 6, drawable = math.random(0, 50), texture = 0 },
{ component_id = 7, drawable = math.random(0, 50), texture = 0 },
{ component_id = 8, drawable = math.random(0, 50), texture = 0 },
},
props = {
{prop_id = 3, drawable = 0, texture = 0},
{prop_id = 1, drawable = 0, texture = 0},
{prop_id = 2, drawable = 0, texture = 0},
{ prop_id = 3, drawable = 0, texture = 0 },
{ prop_id = 1, drawable = 0, texture = 0 },
{ prop_id = 2, drawable = 0, texture = 0 },
}
}, false, true)
end, false)
@@ -1,8 +1,8 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('illenium-appearance') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
TriggerEvent('qb-clothing:client:openMenu')
end
+54 -53
View File
@@ -1,5 +1,6 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('illenium-appearance') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
@@ -161,35 +162,35 @@ end)
RegisterCommand('clothing:debug', function(source, args, rawCommand)
local src = source
Clothing.SetAppearance(src, {
components ={
{component_id = 0, drawable = math.random(0, 50), texture = 0},
{component_id = 1, drawable = math.random(0, 50), texture = 0},
{component_id = 2, drawable = math.random(0, 50), texture = 0},
{component_id = 3, drawable = math.random(0, 50), texture = 0},
{component_id = 4, drawable = math.random(0, 50), texture = 0},
{component_id = 5, drawable = math.random(0, 50), texture = 0},
{component_id = 6, drawable = math.random(0, 50), texture = 0},
{component_id = 7, drawable = math.random(0, 50), texture = 0},
{component_id = 8, drawable = math.random(0, 50), texture = 0},
{component_id = 9, drawable = math.random(0, 50), texture = 0},
{component_id = 10, drawable = math.random(0, 50), texture = 0},
{component_id = 11, drawable = math.random(0, 50), texture = 0},
components = {
{ component_id = 0, drawable = math.random(0, 50), texture = 0 },
{ component_id = 1, drawable = math.random(0, 50), texture = 0 },
{ component_id = 2, drawable = math.random(0, 50), texture = 0 },
{ component_id = 3, drawable = math.random(0, 50), texture = 0 },
{ component_id = 4, drawable = math.random(0, 50), texture = 0 },
{ component_id = 5, drawable = math.random(0, 50), texture = 0 },
{ component_id = 6, drawable = math.random(0, 50), texture = 0 },
{ component_id = 7, drawable = math.random(0, 50), texture = 0 },
{ component_id = 8, drawable = math.random(0, 50), texture = 0 },
{ component_id = 9, drawable = math.random(0, 50), texture = 0 },
{ component_id = 10, drawable = math.random(0, 50), texture = 0 },
{ component_id = 11, drawable = math.random(0, 50), texture = 0 },
},
props = {
{prop_id = 0, drawable = math.random(0, 50), texture = 0},
{prop_id = 1, drawable = math.random(0, 50), texture = 0},
{prop_id = 2, drawable = math.random(0, 50), texture = 0},
{prop_id = 3, drawable = math.random(0, 50), texture = 0},
{prop_id = 4, drawable = math.random(0, 50), texture = 0},
{prop_id = 5, drawable = math.random(0, 50), texture = 0},
{prop_id = 6, drawable = math.random(0, 50), texture = 0},
{prop_id = 7, drawable = math.random(0, 50), texture = 0},
{prop_id = 8, drawable = math.random(0, 50), texture = 0},
{prop_id = 9, drawable = math.random(0, 50), texture = 0},
{prop_id = 10, drawable = math.random(0, 50), texture = 0},
{prop_id = 11, drawable = math.random(0, 50), texture = 0},
{prop_id = 12, drawable = math.random(0, 50), texture = 0},
{prop_id = 13, drawable = math.random(0, 50), texture = 0},
{ prop_id = 0, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 1, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 2, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 3, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 4, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 5, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 6, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 7, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 8, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 9, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 10, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 11, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 12, drawable = math.random(0, 50), texture = 0 },
{ prop_id = 13, drawable = math.random(0, 50), texture = 0 },
}
}, false, true)
end, false)
@@ -218,34 +219,34 @@ RegisterCommand('clothing:crowley', function(source, args, rawCommand)
local src = source
Clothing.SetAppearance(src, {
components = {
{drawable = 0, texture = 0, component_id = 0},
{drawable = 0, texture = 0, component_id = 1},
{drawable = 19, texture = 0, component_id = 2},
{drawable = 6, texture = 0, component_id = 3},
{drawable = 0, texture = 0, component_id = 4},
{drawable = 0, texture = 0, component_id = 5},
{drawable = 0, texture = 0, component_id = 6},
{drawable = 0, texture = 0, component_id = 7},
{drawable = 23, texture = 0, component_id = 8},
{drawable = 0, texture = 0, component_id = 9},
{drawable = 0, texture = 0, component_id = 10},
{drawable = 4, texture = 2, component_id = 11}
{ drawable = 0, texture = 0, component_id = 0 },
{ drawable = 0, texture = 0, component_id = 1 },
{ drawable = 19, texture = 0, component_id = 2 },
{ drawable = 6, texture = 0, component_id = 3 },
{ drawable = 0, texture = 0, component_id = 4 },
{ drawable = 0, texture = 0, component_id = 5 },
{ drawable = 0, texture = 0, component_id = 6 },
{ drawable = 0, texture = 0, component_id = 7 },
{ drawable = 23, texture = 0, component_id = 8 },
{ drawable = 0, texture = 0, component_id = 9 },
{ drawable = 0, texture = 0, component_id = 10 },
{ drawable = 4, texture = 2, component_id = 11 }
},
props = {
{drawable = 27, prop_id = 0, texture = 0},
{drawable = 0, prop_id = 1, texture = 0},
{drawable = 0, prop_id = 2, texture = 0},
{drawable = 0, prop_id = 3, texture = 0},
{drawable = 0, prop_id = 4, texture = 0},
{drawable = 0, prop_id = 5, texture = 0},
{drawable = 0, prop_id = 6, texture = 0},
{drawable = 0, prop_id = 7, texture = 0},
{drawable = 0, prop_id = 8, texture = 0},
{drawable = 0, prop_id = 9, texture = 0},
{drawable = 0, prop_id = 10, texture = 0},
{drawable = 0, prop_id = 11, texture = 0},
{drawable = 0, prop_id = 12, texture = 0},
{drawable = 0, prop_id = 13, texture = 0}
{ drawable = 27, prop_id = 0, texture = 0 },
{ drawable = 0, prop_id = 1, texture = 0 },
{ drawable = 0, prop_id = 2, texture = 0 },
{ drawable = 0, prop_id = 3, texture = 0 },
{ drawable = 0, prop_id = 4, texture = 0 },
{ drawable = 0, prop_id = 5, texture = 0 },
{ drawable = 0, prop_id = 6, texture = 0 },
{ drawable = 0, prop_id = 7, texture = 0 },
{ drawable = 0, prop_id = 8, texture = 0 },
{ drawable = 0, prop_id = 9, texture = 0 },
{ drawable = 0, prop_id = 10, texture = 0 },
{ drawable = 0, prop_id = 11, texture = 0 },
{ drawable = 0, prop_id = 12, texture = 0 },
{ drawable = 0, prop_id = 13, texture = 0 }
}
}, false, true)
+2 -1
View File
@@ -1,7 +1,8 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-clothing') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
TriggerEvent('qb-clothing:client:openMenu')
end
end
+2 -1
View File
@@ -1,5 +1,6 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-clothing') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
Clothing.Players = {}
@@ -235,4 +236,4 @@ end, false)
-- -- {drawable = 0, prop_id = 7, texture = 0},
-- }
-- }, false, true)
-- end, false)
-- end, false)
+9 -22
View File
@@ -1,5 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-clothing') == 'missing' then return end
if GetResourceState('rcore_clothing') ~= 'missing' then return end
Clothing = Clothing or {}
@@ -49,7 +51,7 @@ Props.InverseMap = {
function Components.ConvertFromDefault(defaultComponents)
local returnComponents = {}
for index, componentData in pairs(defaultComponents or {}) do
for index, componentData in pairs(defaultComponents or {}) do
local componentId = Components.Map[componentData.component_id]
if componentId then
returnComponents[componentId] = {
@@ -58,12 +60,12 @@ function Components.ConvertFromDefault(defaultComponents)
}
end
end
return returnComponents
end
return returnComponents
end
function Components.ConvertToDefault(qbComponents)
local returnComponents = {}
for componentIndex, componentData in pairs(qbComponents or {}) do
for componentIndex, componentData in pairs(qbComponents or {}) do
local componentId = Components.InverseMap[componentIndex]
if componentId then
returnComponents[componentId] = {
@@ -78,7 +80,7 @@ end
function Props.ConvertFromDefault(defaultProps)
local returnProps = {}
for index, propData in pairs(defaultProps or {}) do
for index, propData in pairs(defaultProps or {}) do
local propId = Props.Map[propData.prop_id]
if propId then
returnProps[propId] = {
@@ -87,7 +89,7 @@ function Props.ConvertFromDefault(defaultProps)
}
end
end
return returnProps
return returnProps
end
function Props.ConvertToDefault(qbProps)
@@ -125,21 +127,6 @@ function Clothing.ConvertToDefault(qbClothing)
return { components = components, props = props }
end
-- Clothing = {}
-- StoredOldClothing = {}
@@ -198,4 +185,4 @@ end
-- end
-- end
-- TriggerEvent('qb-clothing:client:loadOutfit', repackedTable)
-- end
-- end
@@ -0,0 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('rcore_clothing') == 'missing' then return end
Clothing = Clothing or {}
function Clothing.OpenMenu()
TriggerEvent('qb-clothing:client:openMenu')
end