Return modules folder
-- Was a git prefrences thing and needed cleaned up
This commit is contained in:
1 parent
48f5c70039
commit
8f6fa1e291
95 files changed
+4254
No files matched your search
@@ -0,0 +1,148 @@
|
||||
if GetResourceState('esx_skin') ~= 'started' then return end
|
||||
|
||||
Clothing = {}
|
||||
|
||||
StoredOldClothing = {}
|
||||
|
||||
RegisterNetEvent('community_bridge:client:updateStoredClothing', function(skindata)
|
||||
StoredOldClothing = skindata
|
||||
end)
|
||||
|
||||
local clothingData = {
|
||||
male = {
|
||||
components = {
|
||||
face = {component_id = 0, texture = 0, drawable = 2},
|
||||
mask = {component_id = 1, texture = 0, drawable = 2},
|
||||
hair = {component_id = 2, texture = 0, drawable = 2},
|
||||
arms = {component_id = 3, texture = 0, drawable = 2},
|
||||
pants = {component_id = 4, texture = 0, drawable = 22},
|
||||
bag = {component_id = 5, texture = 1, drawable = 33},
|
||||
shoes = {component_id = 6, texture = 1, drawable = 33},
|
||||
accessory = {component_id = 7, texture = 1, drawable = 33},
|
||||
shirt = {component_id = 8, texture = 1, drawable = 11},
|
||||
bodyarmor = {component_id = 9, texture = 1, drawable = 33},
|
||||
decals = {component_id = 10, texture = 1, drawable = 33},
|
||||
jacket = {component_id = 11, texture = 2, drawable = 4},
|
||||
},
|
||||
props = {
|
||||
hats = {prop_id = 0, texture = 2, drawable = 4},
|
||||
glasses = {prop_id = 1, texture = 2, drawable = 4},
|
||||
ears = {prop_id = 2, texture = 2, drawable = 4},
|
||||
watches = {prop_id = 6, texture = 2, drawable = 4},
|
||||
bracelets = {prop_id = 7, texture = 2, drawable = 4},
|
||||
}
|
||||
},
|
||||
female = {
|
||||
components = {
|
||||
face = {component_id = 0, texture = 0, drawable = 2},
|
||||
mask = {component_id = 1, texture = 0, drawable = 2},
|
||||
hair = {component_id = 2, texture = 0, drawable = 2},
|
||||
arms = {component_id = 3, texture = 0, drawable = 2},
|
||||
pants = {component_id = 4, texture = 0, drawable = 22},
|
||||
bag = {component_id = 5, texture = 1, drawable = 33},
|
||||
shoes = {component_id = 6, texture = 1, drawable = 33},
|
||||
accessory = {component_id = 7, texture = 1, drawable = 33},
|
||||
shirt = {component_id = 8, texture = 1, drawable = 11},
|
||||
bodyarmor = {component_id = 9, texture = 1, drawable = 33},
|
||||
decals = {component_id = 10, texture = 1, drawable = 33},
|
||||
jacket = {component_id = 11, texture = 2, drawable = 4},
|
||||
},
|
||||
props = {
|
||||
hats = {prop_id = 0, texture = 2, drawable = 4},
|
||||
glasses = {prop_id = 1, texture = 2, drawable = 4},
|
||||
ears = {prop_id = 2, texture = 2, drawable = 4},
|
||||
watches = {prop_id = 6, texture = 2, drawable = 4},
|
||||
bracelets = {prop_id = 7, texture = 2, drawable = 4},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
local function convertDataToFormat(characterData)
|
||||
local gender = characterData.sex
|
||||
|
||||
local repackedClothingData = {
|
||||
[gender] = {
|
||||
components = {},
|
||||
props = {}
|
||||
}
|
||||
}
|
||||
|
||||
local componentMap = {
|
||||
tshirt_1 = 8, -- shirt
|
||||
torso_1 = 11, -- jacket
|
||||
decals_1 = 10, -- decals
|
||||
arms = 3, -- arms
|
||||
pants_1 = 4, -- pants
|
||||
shoes_1 = 6, -- shoes
|
||||
mask_1 = 1, -- mask
|
||||
bproof_1 = 9, -- body armor
|
||||
chain_1 = 7, -- accessory (could be a necklace)
|
||||
bags_1 = 5, -- bag
|
||||
}
|
||||
|
||||
for componentName, componentId in pairs(componentMap) do
|
||||
if characterData[componentName] then
|
||||
repackedClothingData[gender].components[componentName] = {
|
||||
component_id = componentId,
|
||||
texture = characterData[componentName.."_2"],
|
||||
drawable = characterData[componentName.."_1"],
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local propMap = {
|
||||
{"helmet_1", 0}, -- helmet
|
||||
{"glasses_1", 1}, -- glasses
|
||||
{"ears_1", 2}, -- ears
|
||||
{"watches_1", 6}, -- watches
|
||||
{"bracelets_1", 7} -- bracelets
|
||||
}
|
||||
|
||||
for _, prop in ipairs(propMap) do
|
||||
local propName = prop[1]
|
||||
local propId = prop[2]
|
||||
|
||||
if characterData[propName] then
|
||||
repackedClothingData[gender].props[propName] = {
|
||||
prop_id = propId,
|
||||
texture = characterData[propName.."_2"],
|
||||
drawable = characterData[propName.."_1"],
|
||||
}
|
||||
end
|
||||
end
|
||||
return repackedClothingData
|
||||
end
|
||||
|
||||
Clothing.SetAppearance = function(clothingData)
|
||||
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
||||
clothingData = clothingData.male
|
||||
clothingData.sex = 0
|
||||
else
|
||||
clothingData = clothingData.female
|
||||
clothingData.sex = 1
|
||||
end
|
||||
local repackedClothingData = convertDataToFormat(clothingData)
|
||||
StoredOldClothing = Clothing.GetAppearance
|
||||
TriggerEvent('skinchanger:loadSkin', repackedClothingData)
|
||||
return true
|
||||
end
|
||||
|
||||
Clothing.GetAppearance = function()
|
||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
|
||||
StoredOldClothing = skin
|
||||
end)
|
||||
return true
|
||||
end
|
||||
|
||||
Clothing.RestoreAppearance = function()
|
||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
|
||||
TriggerEvent('skinchanger:loadSkin', skin)
|
||||
end)
|
||||
return true
|
||||
end
|
||||
|
||||
Clothing.ReloadSkin = function()
|
||||
local tableCheck = Table.TableContains(StoredOldClothing, "sex")
|
||||
if not tableCheck then return Clothing.RestoreAppearance() end
|
||||
return TriggerEvent('skinchanger:loadSkin', StoredOldClothing)
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
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)
|
||||
@@ -0,0 +1,28 @@
|
||||
if GetResourceState('fivem-appearance') ~= 'started' then return end
|
||||
|
||||
Clothing = {}
|
||||
|
||||
StoredOldClothing = {}
|
||||
|
||||
Clothing.SetAppearance = function(clothingData)
|
||||
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
||||
clothingData = clothingData.male
|
||||
else
|
||||
clothingData = clothingData.female
|
||||
end
|
||||
StoredOldClothing = exports['fivem-appearance']:getPedAppearance(cache.ped)
|
||||
exports['fivem-appearance']:setPedAppearance(cache.ped, clothingData)
|
||||
return true
|
||||
end
|
||||
|
||||
Clothing.GetAppearance = function()
|
||||
return exports['fivem-appearance']:getPedAppearance(cache.ped)
|
||||
end
|
||||
|
||||
Clothing.RestoreAppearance = function()
|
||||
return exports['fivem-appearance']:setPedAppearance(cache.ped, StoredOldClothing)
|
||||
end
|
||||
|
||||
Clothing.ReloadSkin = function()
|
||||
TriggerEvent("fivem-appearance:client:reloadSkin", true)
|
||||
end
|
||||
@@ -0,0 +1,45 @@
|
||||
if GetResourceState('illenium-appearance') ~= 'started' then return end
|
||||
|
||||
Clothing = {}
|
||||
|
||||
StoredOldClothing = {}
|
||||
|
||||
Clothing.SetAppearance = function(clothingData)
|
||||
local clothing = {}
|
||||
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
||||
clothingData = clothingData.male
|
||||
else
|
||||
clothingData = clothingData.female
|
||||
end
|
||||
clothing.components = exports['illenium-appearance']:getPedComponents(cache.ped)
|
||||
clothing.props = exports['illenium-appearance']:getPedProps(cache.ped)
|
||||
|
||||
Prints.Debug(json.encode(clothingData, {indent = true}))
|
||||
StoredOldClothing = clothing
|
||||
exports['illenium-appearance']:setPedComponents(cache.ped, clothingData.components)
|
||||
exports['illenium-appearance']:setPedProp(cache.ped, clothingData.props)
|
||||
return true
|
||||
end
|
||||
|
||||
Clothing.GetAppearance = function()
|
||||
local clothing = {}
|
||||
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
|
||||
clothing = clothing.male
|
||||
else
|
||||
clothing = clothing.female
|
||||
end
|
||||
clothing.components = exports['illenium-appearance']:getPedComponents(cache.ped)
|
||||
clothing.props = exports['illenium-appearance']:getPedProps(cache.ped)
|
||||
|
||||
return clothing
|
||||
end
|
||||
|
||||
Clothing.RestoreAppearance = function()
|
||||
exports['illenium-appearance']:setPedComponents(cache.ped, StoredOldClothing.components)
|
||||
exports['illenium-appearance']:setPedProp(cache.ped, StoredOldClothing.props)
|
||||
return true
|
||||
end
|
||||
|
||||
Clothing.ReloadSkin = function()
|
||||
TriggerEvent("illenium-appearance:client:reloadSkin", true)
|
||||
end
|
||||
@@ -0,0 +1,80 @@
|
||||
if GetResourceState('qb-clothing') ~= 'started' then return end
|
||||
|
||||
Clothing = {}
|
||||
|
||||
StoredOldClothing = {}
|
||||
|
||||
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 = {}
|
||||
StoredOldClothing = Clothing.GetAppearance
|
||||
local componentMap = {
|
||||
[1] = 'mask',
|
||||
[3] = 'arms',
|
||||
[4] = 'pants',
|
||||
[5] = 'bag',
|
||||
[6] = 'shoes',
|
||||
[7] = 'accessory',
|
||||
[8] = 't-shirt',
|
||||
[9] = 'vest',
|
||||
[10] = 'decals',
|
||||
[11] = 'torso2'
|
||||
}
|
||||
|
||||
local propMap = {
|
||||
[0] = 'hat',
|
||||
[1] = 'glass',
|
||||
[2] = 'ear',
|
||||
[6] = 'watch',
|
||||
[7] = 'bracelet'
|
||||
}
|
||||
|
||||
local specialMap = {
|
||||
eye_color_id = 'eye_color',
|
||||
moles_id = 'moles',
|
||||
ageing_id = 'ageing',
|
||||
hair_id = 'hair',
|
||||
face_id = 'face'
|
||||
}
|
||||
|
||||
for _, data in pairs(clothingData) do
|
||||
if componentMap[data.component_id] then
|
||||
repackedTable[componentMap[data.component_id]] = {drawable = data.drawable, texture = data.texture}
|
||||
elseif propMap[data.prop_id] then
|
||||
repackedTable[propMap[data.prop_id]] = {drawable = data.drawable, texture = data.texture}
|
||||
elseif specialMap[data.eye_color_id] then
|
||||
repackedTable[specialMap[data.eye_color_id]] = {drawable = data.drawable, texture = data.texture}
|
||||
elseif specialMap[data.moles_id] then
|
||||
repackedTable[specialMap[data.moles_id]] = {drawable = data.drawable, texture = data.texture}
|
||||
elseif specialMap[data.ageing_id] then
|
||||
repackedTable[specialMap[data.ageing_id]] = {drawable = data.drawable, texture = data.texture}
|
||||
elseif specialMap[data.hair_id] then
|
||||
repackedTable[specialMap[data.hair_id]] = {drawable = data.drawable, texture = data.texture}
|
||||
elseif specialMap[data.face_id] then
|
||||
repackedTable[specialMap[data.face_id]] = {drawable = data.drawable, texture = data.texture}
|
||||
end
|
||||
end
|
||||
TriggerEvent('qb-clothing:client:loadOutfit', repackedTable)
|
||||
return true
|
||||
end
|
||||
|
||||
Clothing.GetAppearance = function()
|
||||
StoredOldClothing = Utility.GetEntitySkinData(cache.ped)
|
||||
return Utility.GetEntitySkinData(cache.ped)
|
||||
end
|
||||
|
||||
Clothing.RestoreAppearance = function()
|
||||
return Utility.SetEntitySkinData(cache.ped, StoredOldClothing)
|
||||
end
|
||||
|
||||
Clothing.ReloadSkin = function()
|
||||
return exports['qb-clothing']:reloadSkin(GetEntityHealth(cache.ped))
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
if GetResourceState('qb-clothing') ~= 'started' then return end
|
||||
|
||||
RegisterServerEvent('qb-clothing:saveSkin', function(model, skin)
|
||||
local src = source
|
||||
if model ~= nil and skin ~= nil then
|
||||
TriggerClientEvent('community_bridge:client:updateStoredClothing', src, skin)
|
||||
end
|
||||
end)
|
||||
Reference in new issue
Block a user