Auto-sync 2026-04-15 11:10
This commit is contained in:
parent
fd82ecf443
commit
bf9ce2b20d
@ -706,14 +706,17 @@ end)
|
||||
-- NUI: Outfit anziehen (JETZT ANZIEHEN Button)
|
||||
RegisterNUICallback('wearClothing', function(data, cb)
|
||||
if not data or not data.skin then cb({}); return end
|
||||
local skin = type(data.skin) == 'string' and json.decode(data.skin) or data.skin
|
||||
if skin then
|
||||
-- Skin auf den Charakter anwenden
|
||||
TriggerEvent('codem-appearance:setPlayerSkin', skin)
|
||||
-- Auch per Export falls verfügbar
|
||||
if GetResourceState('codem-appearance') == 'started' then
|
||||
exports['codem-appearance']:SetPlayerSkin(skin)
|
||||
|
||||
-- Skin kann als String oder Table ankommen
|
||||
local skin = data.skin
|
||||
if type(skin) == 'string' then
|
||||
local ok, decoded = pcall(json.decode, skin)
|
||||
if ok and decoded then skin = decoded end
|
||||
end
|
||||
|
||||
if skin and type(skin) == 'table' then
|
||||
-- skinchanger:loadSkin ist der Standard-ESX Skin-Loader
|
||||
TriggerEvent('skinchanger:loadSkin', skin)
|
||||
end
|
||||
cb({})
|
||||
end)
|
||||
@ -739,53 +742,9 @@ RegisterNUICallback('CreateClothingCategory', function(data, cb)
|
||||
cb({})
|
||||
end)
|
||||
|
||||
-- Skin anwenden (von wearClothing aufgerufen)
|
||||
-- Skin anwenden via skinchanger (kompatibler mit ESX)
|
||||
RegisterNetEvent('codem-appearance:setPlayerSkin')
|
||||
AddEventHandler('codem-appearance:setPlayerSkin', function(skin)
|
||||
local ped = PlayerPedId()
|
||||
if not skin then return end
|
||||
|
||||
-- Kleidung anwenden
|
||||
local components = {
|
||||
{ id = 1, key = 'mask_1', tex = 'mask_2' },
|
||||
{ id = 3, key = 'arms', tex = 'arms_2' },
|
||||
{ id = 4, key = 'pants_1', tex = 'pants_2' },
|
||||
{ id = 5, key = 'parachute_1', tex = 'parachute_2' },
|
||||
{ id = 6, key = 'shoes_1', tex = 'shoes_2' },
|
||||
{ id = 7, key = 'accessory_1', tex = 'accessory_2' },
|
||||
{ id = 8, key = 'undershirt_1', tex = 'undershirt_2' },
|
||||
{ id = 9, key = 'bproof_1', tex = 'bproof_2' },
|
||||
{ id = 10, key = 'torso_1', tex = 'torso_2' },
|
||||
{ id = 11, key = 'tshirt_1', tex = 'tshirt_2' },
|
||||
}
|
||||
|
||||
for _, comp in ipairs(components) do
|
||||
if skin[comp.key] ~= nil then
|
||||
SetPedComponentVariation(ped, comp.id,
|
||||
tonumber(skin[comp.key]) or 0,
|
||||
tonumber(skin[comp.tex] or 0) or 0,
|
||||
2)
|
||||
end
|
||||
end
|
||||
|
||||
-- Props anwenden
|
||||
local props = {
|
||||
{ id = 0, key = 'glasses_1', tex = 'glasses_2' },
|
||||
{ id = 1, key = 'helmet_1', tex = 'helmet_2' },
|
||||
{ id = 2, key = 'ears_1', tex = 'ears_2' },
|
||||
{ id = 6, key = 'watches_1', tex = 'watches_2' },
|
||||
{ id = 7, key = 'bracelets_1', tex = 'bracelets_2' },
|
||||
}
|
||||
|
||||
for _, prop in ipairs(props) do
|
||||
if skin[prop.key] ~= nil then
|
||||
local val = tonumber(skin[prop.key])
|
||||
if val and val >= 0 then
|
||||
SetPedPropIndex(ped, prop.id, val,
|
||||
tonumber(skin[prop.tex] or 0) or 0, true)
|
||||
else
|
||||
ClearPedProp(ped, prop.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
TriggerEvent('skinchanger:loadSkin', skin)
|
||||
end)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user