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:
1 parent
a280606c3d
commit
c7d638cbfb
13 files changed
+36
-86
No files matched your search
@@ -1,5 +1,4 @@
|
|||||||
--[[This module is incomplete]]--
|
---@diagnostic disable: duplicate-set-field
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
ClothingBackup = {}
|
ClothingBackup = {}
|
||||||
@@ -25,10 +24,12 @@ function Clothing.GetAppearance(entity)
|
|||||||
local model = GetEntityModel(entity)
|
local model = GetEntityModel(entity)
|
||||||
local skinData = { model = model, components = {}, props = {} }
|
local skinData = { model = model, components = {}, props = {} }
|
||||||
for i = 0, 11 do
|
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
|
end
|
||||||
for i = 0, 13 do
|
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
|
end
|
||||||
return skinData
|
return skinData
|
||||||
end
|
end
|
||||||
@@ -91,7 +92,6 @@ end, 1000)
|
|||||||
|
|
||||||
local onChange = nil
|
local onChange = nil
|
||||||
Clothing.ToggleDebugging = function()
|
Clothing.ToggleDebugging = function()
|
||||||
|
|
||||||
if Clothing.RunningDebug then
|
if Clothing.RunningDebug then
|
||||||
Clothing.RunningDebug = false
|
Clothing.RunningDebug = false
|
||||||
print("Clothing Debugging Disabled")
|
print("Clothing Debugging Disabled")
|
||||||
@@ -109,63 +109,23 @@ Clothing.ToggleDebugging = function()
|
|||||||
for k, v in pairs(old.components) do
|
for k, v in pairs(old.components) do
|
||||||
if v.component_id then
|
if v.component_id then
|
||||||
if new.components[k].drawable ~= v.drawable or new.components[k].texture ~= v.texture 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
|
end
|
||||||
end
|
end
|
||||||
for k, v in pairs(old.props) do
|
for k, v in pairs(old.props) do
|
||||||
if v.prop_id then
|
if v.prop_id then
|
||||||
if new.props[k].drawable ~= v.drawable or new.props[k].texture ~= v.texture 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
|
||||||
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
|
end
|
||||||
|
|
||||||
RegisterCommand("clothing:enabledebug", function(source, args, rawCommand)
|
|
||||||
Clothing.ToggleDebugging()
|
|
||||||
end)
|
|
||||||
|
|
||||||
RegisterNetEvent('community_bridge:client:SetAppearance', function(data)
|
RegisterNetEvent('community_bridge:client:SetAppearance', function(data)
|
||||||
Clothing.SetAppearance(PlayerPedId(), data)
|
Clothing.SetAppearance(PlayerPedId(), data)
|
||||||
end)
|
end)
|
||||||
@@ -178,10 +138,13 @@ RegisterNetEvent('community_bridge:client:RestoreAppearance', function()
|
|||||||
Clothing.RestoreAppearance(PlayerPedId())
|
Clothing.RestoreAppearance(PlayerPedId())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterCommand("clothing:copy", function(source, args, rawCommand)
|
-- RegisterCommand("clothing:enabledebug", function(source, args, rawCommand)
|
||||||
Clothing.CopyAppearanceToClipboard()
|
-- Clothing.ToggleDebugging()
|
||||||
end)
|
-- end)
|
||||||
|
|
||||||
|
-- RegisterCommand("clothing:copy", function(source, args, rawCommand)
|
||||||
|
-- Clothing.CopyAppearanceToClipboard()
|
||||||
|
-- end)
|
||||||
|
|
||||||
|
|
||||||
return Clothing
|
return Clothing
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
--[[This module is incomplete]]--
|
---@diagnostic disable: duplicate-set-field
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
Clothing.LastAppearance = Clothing.LastAppearance or {}
|
Clothing.LastAppearance = Clothing.LastAppearance or {}
|
||||||
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
|
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
|
||||||
@@ -10,7 +9,6 @@ function Clothing.IsMale(src)
|
|||||||
return GetEntityModel(ped) == `mp_m_freemode_01`
|
return GetEntityModel(ped) == `mp_m_freemode_01`
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function Clothing.GetAppearance(src)
|
function Clothing.GetAppearance(src)
|
||||||
return Callback.Trigger('community_bridge:cb:GetAppearance', src)
|
return Callback.Trigger('community_bridge:cb:GetAppearance', src)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('esx_skin') == 'missing' then return end
|
if GetResourceState('esx_skin') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
function Clothing.OpenMenu()
|
function Clothing.OpenMenu()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('esx_skin') == 'missing' then return end
|
if GetResourceState('esx_skin') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
Clothing.Players = {}
|
Clothing.Players = {}
|
||||||
|
|
||||||
@@ -63,6 +64,7 @@ function Clothing.Save(src)
|
|||||||
citId
|
citId
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
---Sets a player's appearance based on the provided data
|
---Sets a player's appearance based on the provided data
|
||||||
---@param src number The server ID of the player
|
---@param src number The server ID of the player
|
||||||
---@param data table The appearance data to apply
|
---@param data table The appearance data to apply
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('esx_skin') == 'missing' then return end
|
if GetResourceState('esx_skin') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
@@ -142,19 +143,6 @@ function Clothing.ConvertToDefault(esxClothing)
|
|||||||
return { components = components, props = props }
|
return { components = components, props = props }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Clothing = {}
|
-- Clothing = {}
|
||||||
|
|
||||||
-- StoredOldClothing = {}
|
-- StoredOldClothing = {}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('fivem-appearance') == 'missing' then return end
|
if GetResourceState('fivem-appearance') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
function Clothing.OpenMenu()
|
function Clothing.OpenMenu()
|
||||||
TriggerEvent('qb-clothing:client:openMenu')
|
TriggerEvent('qb-clothing:client:openMenu')
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('fivem-appearance') == 'missing' then return end
|
if GetResourceState('fivem-appearance') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
Clothing.Players = {}
|
Clothing.Players = {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('illenium-appearance') == 'missing' then return end
|
if GetResourceState('illenium-appearance') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
function Clothing.OpenMenu()
|
function Clothing.OpenMenu()
|
||||||
TriggerEvent('qb-clothing:client:openMenu')
|
TriggerEvent('qb-clothing:client:openMenu')
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('illenium-appearance') == 'missing' then return end
|
if GetResourceState('illenium-appearance') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
Clothing.Players = {}
|
Clothing.Players = {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('qb-clothing') == 'missing' then return end
|
if GetResourceState('qb-clothing') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
function Clothing.OpenMenu()
|
function Clothing.OpenMenu()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
if GetResourceState('qb-clothing') == 'missing' then return end
|
if GetResourceState('qb-clothing') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
Clothing.Players = {}
|
Clothing.Players = {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
---@diagnostic disable: duplicate-set-field
|
||||||
|
|
||||||
if GetResourceState('qb-clothing') == 'missing' then return end
|
if GetResourceState('qb-clothing') == 'missing' then return end
|
||||||
|
if GetResourceState('rcore_clothing') ~= 'missing' then return end
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
@@ -125,21 +127,6 @@ function Clothing.ConvertToDefault(qbClothing)
|
|||||||
return { components = components, props = props }
|
return { components = components, props = props }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Clothing = {}
|
-- Clothing = {}
|
||||||
|
|
||||||
-- StoredOldClothing = {}
|
-- StoredOldClothing = {}
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in new issue
Block a user