You are on page 1of 3

function ApplySkinForPed(ped ,skin)

for k,v in pairs(skin) do


Character[k] = v
end

if clothes ~= nil then


for k,v in pairs(clothes) do
if
k ~= 'sex' and
k ~= 'face' and
k ~= 'skin' and
k ~= 'age_1' and
k ~= 'age_2' and
k ~= 'eye_color' and
k ~= 'beard_1' and
k ~= 'beard_2' and
k ~= 'beard_3' and
k ~= 'beard_4' and
k ~= 'hair_1' and
k ~= 'hair_2' and
k ~= 'hair_color_1' and
k ~= 'hair_color_2' and
k ~= 'eyebrows_1' and
k ~= 'eyebrows_2' and
k ~= 'eyebrows_3' and
k ~= 'eyebrows_4' and
k ~= 'makeup_1' and
k ~= 'makeup_2' and
k ~= 'makeup_3' and
k ~= 'makeup_4' and
k ~= 'lipstick_1' and
k ~= 'lipstick_2' and
k ~= 'lipstick_3' and
k ~= 'lipstick_4' and
k ~= 'blemishes_1' and
k ~= 'blemishes_2' and
k ~= 'blush_1' and
k ~= 'blush_2' and
k ~= 'blush_3' and
k ~= 'complexion_1' and
k ~= 'complexion_2' and
k ~= 'sun_1' and
k ~= 'sun_2' and
k ~= 'moles_1' and
k ~= 'moles_2' and
k ~= 'chest_1' and
k ~= 'chest_2' and
k ~= 'chest_3' and
k ~= 'bodyb_1' and
k ~= 'bodyb_2'
then
Character[k] = v
end
end
end

SetPedHeadBlendData (ped, Character['face'], Character['face'],


Character['face'], Character['skin'], Character['skin'], Character['skin'], 1.0,
1.0, 1.0, true)
SetPedHairColor (ped, Character['hair_color_1'],
Character['hair_color_2']) -- Hair Color
SetPedHeadOverlay (ped, 3, Character['age_1'],
(Character['age_2'] / 10) + 0.0) -- Age + opacity
SetPedHeadOverlay (ped, 1, Character['beard_1'],
(Character['beard_2'] / 10) + 0.0) -- Beard + opacity
SetPedEyeColor (ped, Character['eye_color'], 0, 1)
-- Eyes color
SetPedHeadOverlay (ped, 2, Character['eyebrows_1'],
(Character['eyebrows_2'] / 10) + 0.0) -- Eyebrows + opacity
SetPedHeadOverlay (ped, 4, Character['makeup_1'],
(Character['makeup_2'] / 10) + 0.0) -- Makeup + opacity
SetPedHeadOverlay (ped, 8, Character['lipstick_1'],
(Character['lipstick_2'] / 10) + 0.0) -- Lipstick + opacity
SetPedComponentVariation (ped, 2, Character['hair_1'],
Character['hair_2'], 2) -- Hair
SetPedHeadOverlayColor (ped, 1, 1, Character['beard_3'],
Character['beard_4']) -- Beard Color
SetPedHeadOverlayColor (ped, 2, 1, Character['eyebrows_3'],
Character['eyebrows_4']) -- Eyebrows Color
SetPedHeadOverlayColor (ped, 4, 1, Character['makeup_3'],
Character['makeup_4']) -- Makeup Color
SetPedHeadOverlayColor (ped, 8, 1, Character['lipstick_3'],
Character['lipstick_4']) -- Lipstick Color
SetPedHeadOverlay (ped, 5, Character['blush_1'],
(Character['blush_2'] / 10) + 0.0) -- Blush + opacity
SetPedHeadOverlayColor (ped, 5, 2, Character['blush_3'])
-- Blush Color
SetPedHeadOverlay (ped, 6, Character['complexion_1'],
(Character['complexion_2'] / 10) + 0.0) -- Complexion + opacity
SetPedHeadOverlay (ped, 7, Character['sun_1'],
(Character['sun_2'] / 10) + 0.0) -- Sun Damage + opacity
SetPedHeadOverlay (ped, 9, Character['moles_1'],
(Character['moles_2'] / 10) + 0.0) -- Moles/Freckles + opacity
SetPedHeadOverlay (ped, 10, Character['chest_1'],
(Character['chest_2'] / 10) + 0.0) -- Chest Hair + opacity
SetPedHeadOverlayColor (ped, 10, 1, Character['chest_3'])
-- Torso Color
SetPedHeadOverlay (ped, 11, Character['bodyb_1'],
(Character['bodyb_2'] / 10) + 0.0) -- Body Blemishes + opacity

if Character['ears_1'] == -1 then
ClearPedProp(ped, 2)
else
SetPedPropIndex (ped, 2, Character['ears_1'],
Character['ears_2'], 2) -- Ears Accessories
end

SetPedComponentVariation (ped, 8, Character['tshirt_1'],


Character['tshirt_2'], 2) -- Tshirt
SetPedComponentVariation (ped, 11, Character['torso_1'],
Character['torso_2'], 2) -- torso parts
SetPedComponentVariation (ped, 3, Character['arms'],
Character['arms_2'], 2) -- Amrs
SetPedComponentVariation (ped, 10, Character['decals_1'],
Character['decals_2'], 2) -- decals
SetPedComponentVariation (ped, 4, Character['pants_1'],
Character['pants_2'], 2) -- pants
SetPedComponentVariation (ped, 6, Character['shoes_1'],
Character['shoes_2'], 2) -- shoes
SetPedComponentVariation (ped, 1, Character['mask_1'],
Character['mask_2'], 2) -- mask
SetPedComponentVariation (ped, 9, Character['bproof_1'],
Character['bproof_2'], 2) -- bulletproof
SetPedComponentVariation (ped, 7, Character['chain_1'],
Character['chain_2'], 2) -- chain
SetPedComponentVariation (ped, 5, Character['bags_1'],
Character['bags_2'], 2) -- Bag

if Character['helmet_1'] == -1 then
ClearPedProp(ped, 0)
else
SetPedPropIndex (ped, 0, Character['helmet_1'],
Character['helmet_2'], 2) -- Helmet
end

if Character['glasses_1'] == -1 then
ClearPedProp(ped, 1)
else
SetPedPropIndex (ped, 1, Character['glasses_1'],
Character['glasses_2'], 2) -- Glasses
end

if Character['watches_1'] == -1 then
ClearPedProp(ped, 6)
else
SetPedPropIndex (ped, 6, Character['watches_1'],
Character['watches_2'], 2) -- Watches
end

if Character['bracelets_1'] == -1 then
ClearPedProp(ped, 7)
else
SetPedPropIndex (ped, 7, Character['bracelets_1'],
Character['bracelets_2'], 2) -- Bracelets
end
end

RegisterNetEvent('skinchanger:loadSkinToPed')
AddEventHandler('skinchanger:loadSkinToPed', function(ped, skin)
ApplySkinForPed(ped, skin)
end)

You might also like