attempt to clean up clothing start
This commit is contained in:
1 parent
d230cf1242
commit
78ad6c2932
11 files changed
+104
-153
No files matched your search
@@ -133,10 +133,12 @@ end
|
|||||||
|
|
||||||
Utility.GetEntitySkinData = function(entity)
|
Utility.GetEntitySkinData = function(entity)
|
||||||
local skinData = {}
|
local skinData = {}
|
||||||
skinData.clothing = {}
|
|
||||||
for i = 0, 11 do
|
for i = 0, 11 do
|
||||||
skinData.clothing[i] = {GetPedDrawableVariation(entity, i), GetPedTextureVariation(entity, i)}
|
skinData.clothing[i] = {GetPedDrawableVariation(entity, i), GetPedTextureVariation(entity, i)}
|
||||||
end
|
end
|
||||||
|
for i = 0, 13 do
|
||||||
|
skinData.props[i] = {GetPedPropIndex(entity, i), GetPedPropTextureIndex(entity, i)}
|
||||||
|
end
|
||||||
return skinData
|
return skinData
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -144,6 +146,9 @@ Utility.SetEntitySkinData = function(entity, skinData)
|
|||||||
for i = 0, 11 do
|
for i = 0, 11 do
|
||||||
SetPedComponentVariation(entity, i, skinData.clothing[i][1], skinData.clothing[i][2], 0)
|
SetPedComponentVariation(entity, i, skinData.clothing[i][1], skinData.clothing[i][2], 0)
|
||||||
end
|
end
|
||||||
|
for i = 0, 13 do
|
||||||
|
SetPedPropIndex(entity, i, skinData.props[i][1], skinData.props[i][2], 0)
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -160,10 +165,6 @@ Utility.ReloadSkin = function()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
Utility.RestoreAppearance = function(data)
|
|
||||||
return Utility.SetEntitySkinData(cache.ped, data)
|
|
||||||
end
|
|
||||||
|
|
||||||
Utility.HelpText = function(text, duration)
|
Utility.HelpText = function(text, duration)
|
||||||
AddTextEntry(text, text)
|
AddTextEntry(text, text)
|
||||||
BeginTextCommandDisplayHelp(text)
|
BeginTextCommandDisplayHelp(text)
|
||||||
|
|||||||
@@ -1,23 +1,49 @@
|
|||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
StoredOldClothing = {}
|
ClothingBackup = {}
|
||||||
|
|
||||||
Clothing.SetAppearance = function(clothingData)
|
|
||||||
|
|
||||||
|
Clothing.SetAppearance = function(data)
|
||||||
|
ClothingBackup = Clothing.GetAppearance()
|
||||||
|
Utility.SetEntitySkinData(cache.ped, data)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
Clothing.GetAppearance = function()
|
Clothing.GetAppearance = function()
|
||||||
local clothing = {}
|
return Utility.GetEntitySkinData(cache.ped)
|
||||||
|
|
||||||
return clothing
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Clothing.RestoreAppearance = function()
|
Clothing.RestoreAppearance = function()
|
||||||
|
Utility.SetEntitySkinData(cache.ped, ClothingBackup)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
Clothing.ReloadSkin = function()
|
Clothing.ReloadSkin = function()
|
||||||
|
Utility.SetEntitySkinData(cache.ped, ClothingBackup)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Clothing.UpdateAppearanceBackup = function(data)
|
||||||
|
ClothingBackup = data
|
||||||
|
end
|
||||||
|
|
||||||
|
RegisterNetEvent('community_bridge:client:updateClothingBackup', function(skindata)
|
||||||
|
ClothingBackup = skindata
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent('community_bridge:client:SetAppearance', function(data)
|
||||||
|
Clothing.SetAppearance(data)
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent('community_bridge:client:GetAppearance', function()
|
||||||
|
Clothing.GetAppearance()
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent('community_bridge:client:RestoreAppearance', function()
|
||||||
|
Clothing.RestoreAppearance()
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent('community_bridge:client:ReloadSkin', function()
|
||||||
|
Clothing.ReloadSkin()
|
||||||
|
end)
|
||||||
@@ -1,17 +1,32 @@
|
|||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
Clothing.SetAppearance = function(src, data)
|
Clothing.SetAppearance = function(src, data)
|
||||||
--wip
|
TriggerClientEvent('community_bridge:client:SetAppearance', src, data)
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.GetAppearance = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Clothing.RestoreAppearance = function(src)
|
Clothing.RestoreAppearance = function(src)
|
||||||
--wip
|
TriggerClientEvent('community_bridge:client:RestoreAppearance', src)
|
||||||
end
|
end
|
||||||
|
|
||||||
Clothing.ReloadSkin = function(src)
|
Clothing.ReloadSkin = function(src)
|
||||||
--wip
|
TriggerClientEvent('community_bridge:client:ReloadSkin', src)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
RegisterNetEvent('community_bridge:client:SetAppearance', function(data)
|
||||||
|
Clothing.SetAppearance(data)
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent('community_bridge:client:GetAppearance', function()
|
||||||
|
Clothing.GetAppearance()
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent('community_bridge:client:RestoreAppearance', function()
|
||||||
|
Clothing.RestoreAppearance()
|
||||||
|
end)
|
||||||
|
|
||||||
|
RegisterNetEvent('community_bridge:client:ReloadSkin', function()
|
||||||
|
Clothing.ReloadSkin()
|
||||||
|
end)
|
||||||
@@ -2,12 +2,6 @@ if GetResourceState('esx_skin') ~= 'started' then return end
|
|||||||
|
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
StoredOldClothing = {}
|
|
||||||
|
|
||||||
RegisterNetEvent('community_bridge:client:updateStoredClothing', function(skindata)
|
|
||||||
StoredOldClothing = skindata
|
|
||||||
end)
|
|
||||||
|
|
||||||
local clothingData = {
|
local clothingData = {
|
||||||
male = {
|
male = {
|
||||||
components = {
|
components = {
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
if GetResourceState('esx_skin') ~= 'started' then return end
|
|
||||||
|
|
||||||
RegisterNetEvent("esx_skin:save", function(skin)
|
|
||||||
local src = source
|
|
||||||
TriggerClientEvent('community_bridge:client:updateStoredClothing', src, skin)
|
|
||||||
end)
|
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
|
||||||
|
|
||||||
Clothing.SetAppearance = function(src, data)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.GetAppearance = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.RestoreAppearance = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.ReloadSkin = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
@@ -1,17 +1,15 @@
|
|||||||
if GetResourceState('fivem-appearance') ~= 'started' then return end
|
if GetResourceState('fivem-appearance') ~= 'started' then return end
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
StoredOldClothing = {}
|
Clothing.SetAppearance = function(data)
|
||||||
|
local clothing = {}
|
||||||
Clothing.SetAppearance = function(clothingData)
|
|
||||||
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
||||||
clothingData = clothingData.male
|
clothing = data.male
|
||||||
else
|
else
|
||||||
clothingData = clothingData.female
|
clothing = data.female
|
||||||
end
|
end
|
||||||
StoredOldClothing = exports['fivem-appearance']:getPedAppearance(cache.ped)
|
ClothingBackup = exports['fivem-appearance']:getPedAppearance(cache.ped)
|
||||||
exports['fivem-appearance']:setPedAppearance(cache.ped, clothingData)
|
exports['fivem-appearance']:setPedAppearance(cache.ped, clothing)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -20,9 +18,14 @@ Clothing.GetAppearance = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
Clothing.RestoreAppearance = function()
|
Clothing.RestoreAppearance = function()
|
||||||
return exports['fivem-appearance']:setPedAppearance(cache.ped, StoredOldClothing)
|
if not next(ClothingBackup) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
exports['fivem-appearance']:setPedAppearance(cache.ped, ClothingBackup)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
Clothing.ReloadSkin = function()
|
Clothing.ReloadSkin = function()
|
||||||
TriggerEvent("fivem-appearance:client:reloadSkin", true)
|
TriggerEvent("fivem-appearance:client:reloadSkin", true)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
if GetResourceState('fivem-appearance') ~= 'started' then return end
|
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
|
||||||
|
|
||||||
Clothing.SetAppearance = function(src, data)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.GetAppearance = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.RestoreAppearance = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.ReloadSkin = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
if GetResourceState('illenium-appearance') ~= 'started' then return end
|
if GetResourceState('illenium-appearance') ~= 'started' then return end
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
StoredOldClothing = {}
|
|
||||||
|
|
||||||
Clothing.SetAppearance = function(clothingData)
|
Clothing.SetAppearance = function(clothingData)
|
||||||
local clothing = {}
|
local clothing = {}
|
||||||
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
||||||
@@ -15,7 +12,7 @@ Clothing.SetAppearance = function(clothingData)
|
|||||||
clothing.props = exports['illenium-appearance']:getPedProps(cache.ped)
|
clothing.props = exports['illenium-appearance']:getPedProps(cache.ped)
|
||||||
|
|
||||||
Prints.Debug(json.encode(clothingData, {indent = true}))
|
Prints.Debug(json.encode(clothingData, {indent = true}))
|
||||||
StoredOldClothing = clothing
|
ClothingBackup = clothing
|
||||||
exports['illenium-appearance']:setPedComponents(cache.ped, clothingData.components)
|
exports['illenium-appearance']:setPedComponents(cache.ped, clothingData.components)
|
||||||
exports['illenium-appearance']:setPedProp(cache.ped, clothingData.props)
|
exports['illenium-appearance']:setPedProp(cache.ped, clothingData.props)
|
||||||
return true
|
return true
|
||||||
@@ -35,8 +32,8 @@ Clothing.GetAppearance = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
Clothing.RestoreAppearance = function()
|
Clothing.RestoreAppearance = function()
|
||||||
exports['illenium-appearance']:setPedComponents(cache.ped, StoredOldClothing.components)
|
exports['illenium-appearance']:setPedComponents(cache.ped, ClothingBackup.components)
|
||||||
exports['illenium-appearance']:setPedProp(cache.ped, StoredOldClothing.props)
|
exports['illenium-appearance']:setPedProp(cache.ped, ClothingBackup.props)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
if GetResourceState('illenium-appearance') ~= 'started' then return end
|
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
|
||||||
|
|
||||||
Clothing.SetAppearance = function(src, data)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.GetAppearance = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.RestoreAppearance = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.ReloadSkin = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
@@ -2,20 +2,15 @@ if GetResourceState('qb-clothing') ~= 'started' then return end
|
|||||||
|
|
||||||
Clothing = Clothing or {}
|
Clothing = Clothing or {}
|
||||||
|
|
||||||
StoredOldClothing = {}
|
Clothing.SetAppearance = function(data)
|
||||||
|
local clothingData = {}
|
||||||
RegisterNetEvent('community_bridge:client:updateStoredClothing', function(skindata)
|
|
||||||
StoredOldClothing = skindata
|
|
||||||
end)
|
|
||||||
|
|
||||||
Clothing.SetAppearance = function(clothingData)
|
|
||||||
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
|
||||||
clothingData = clothingData.male
|
|
||||||
else
|
|
||||||
clothingData = clothingData.female
|
|
||||||
end
|
|
||||||
local repackedTable = {}
|
local repackedTable = {}
|
||||||
StoredOldClothing = Clothing.GetAppearance
|
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
||||||
|
clothingData = data.male
|
||||||
|
else
|
||||||
|
clothingData = data.female
|
||||||
|
end
|
||||||
|
ClothingBackup = Clothing.GetAppearance
|
||||||
local componentMap = {
|
local componentMap = {
|
||||||
[1] = 'mask',
|
[1] = 'mask',
|
||||||
[3] = 'arms',
|
[3] = 'arms',
|
||||||
@@ -45,21 +40,21 @@ Clothing.SetAppearance = function(clothingData)
|
|||||||
face_id = 'face'
|
face_id = 'face'
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, data in pairs(clothingData) do
|
for _, v in pairs(clothingData) do
|
||||||
if componentMap[data.component_id] then
|
if componentMap[v.component_id] then
|
||||||
repackedTable[componentMap[data.component_id]] = {drawable = data.drawable, texture = data.texture}
|
repackedTable[componentMap[v.component_id]] = {drawable = v.drawable, texture = v.texture}
|
||||||
elseif propMap[data.prop_id] then
|
elseif propMap[v.prop_id] then
|
||||||
repackedTable[propMap[data.prop_id]] = {drawable = data.drawable, texture = data.texture}
|
repackedTable[propMap[v.prop_id]] = {drawable = v.drawable, texture = v.texture}
|
||||||
elseif specialMap[data.eye_color_id] then
|
elseif specialMap[v.eye_color_id] then
|
||||||
repackedTable[specialMap[data.eye_color_id]] = {drawable = data.drawable, texture = data.texture}
|
repackedTable[specialMap[v.eye_color_id]] = {drawable = v.drawable, texture = v.texture}
|
||||||
elseif specialMap[data.moles_id] then
|
elseif specialMap[v.moles_id] then
|
||||||
repackedTable[specialMap[data.moles_id]] = {drawable = data.drawable, texture = data.texture}
|
repackedTable[specialMap[v.moles_id]] = {drawable = v.drawable, texture = v.texture}
|
||||||
elseif specialMap[data.ageing_id] then
|
elseif specialMap[v.ageing_id] then
|
||||||
repackedTable[specialMap[data.ageing_id]] = {drawable = data.drawable, texture = data.texture}
|
repackedTable[specialMap[v.ageing_id]] = {drawable = v.drawable, texture = v.texture}
|
||||||
elseif specialMap[data.hair_id] then
|
elseif specialMap[v.hair_id] then
|
||||||
repackedTable[specialMap[data.hair_id]] = {drawable = data.drawable, texture = data.texture}
|
repackedTable[specialMap[v.hair_id]] = {drawable = v.drawable, texture = v.texture}
|
||||||
elseif specialMap[data.face_id] then
|
elseif specialMap[v.face_id] then
|
||||||
repackedTable[specialMap[data.face_id]] = {drawable = data.drawable, texture = data.texture}
|
repackedTable[specialMap[v.face_id]] = {drawable = v.drawable, texture = v.texture}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
TriggerEvent('qb-clothing:client:loadOutfit', repackedTable)
|
TriggerEvent('qb-clothing:client:loadOutfit', repackedTable)
|
||||||
@@ -67,12 +62,12 @@ Clothing.SetAppearance = function(clothingData)
|
|||||||
end
|
end
|
||||||
|
|
||||||
Clothing.GetAppearance = function()
|
Clothing.GetAppearance = function()
|
||||||
StoredOldClothing = Utility.GetEntitySkinData(cache.ped)
|
ClothingBackup = Utility.GetEntitySkinData(cache.ped)
|
||||||
return Utility.GetEntitySkinData(cache.ped)
|
return Utility.GetEntitySkinData(cache.ped)
|
||||||
end
|
end
|
||||||
|
|
||||||
Clothing.RestoreAppearance = function()
|
Clothing.RestoreAppearance = function()
|
||||||
return Utility.SetEntitySkinData(cache.ped, StoredOldClothing)
|
return Utility.SetEntitySkinData(cache.ped, ClothingBackup)
|
||||||
end
|
end
|
||||||
|
|
||||||
Clothing.ReloadSkin = function()
|
Clothing.ReloadSkin = function()
|
||||||
|
|||||||
@@ -2,25 +2,7 @@ if GetResourceState('qb-clothing') ~= 'started' then return end
|
|||||||
|
|
||||||
RegisterNetEvent('qb-clothing:saveSkin', function(model, skin)
|
RegisterNetEvent('qb-clothing:saveSkin', function(model, skin)
|
||||||
local src = source
|
local src = source
|
||||||
if model ~= nil and skin ~= nil then
|
if model and skin then
|
||||||
TriggerClientEvent('community_bridge:client:updateStoredClothing', src, skin)
|
TriggerClientEvent('community_bridge:client:updateClothingBackup', src, skin)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Clothing = Clothing or {}
|
|
||||||
|
|
||||||
Clothing.SetAppearance = function(src, data)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.GetAppearance = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.RestoreAppearance = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
|
|
||||||
Clothing.ReloadSkin = function(src)
|
|
||||||
--wip
|
|
||||||
end
|
|
||||||
Reference in new issue
Block a user