diff --git a/[core]/esx_multicharacter/config.lua b/[core]/esx_multicharacter/config.lua index 9f6e0577..9c80d374 100644 --- a/[core]/esx_multicharacter/config.lua +++ b/[core]/esx_multicharacter/config.lua @@ -30,8 +30,10 @@ else ["m"] = { mom = 43, dad = 29, + grandparents = 0, face_md_weight = 61, skin_md_weight = 27, + face_g_weight = 0, nose_1 = -5, nose_2 = 6, nose_3 = 5, @@ -127,8 +129,10 @@ else ["f"] = { mom = 28, dad = 6, + grandparents = 0, face_md_weight = 63, skin_md_weight = 60, + face_g_weight = 0, nose_1 = -10, nose_2 = 4, nose_3 = 5, diff --git a/[core]/skinchanger/client/main.lua b/[core]/skinchanger/client/main.lua index 8b84ec0c..08dc2a45 100644 --- a/[core]/skinchanger/client/main.lua +++ b/[core]/skinchanger/client/main.lua @@ -1,342 +1,299 @@ -local LastSex = -1 -local LoadSkin = nil -local LoadClothes = nil -local Character = {} -local Components = Config.Components -for i = 1, #Components, 1 do - Character[Components[i].name] = Components[i].value -end +SkinChanger = {} +SkinChanger._index = SkinChanger -function LoadDefaultModel(malePed, cb) - local playerPed = PlayerPedId() - local characterModel +SkinChanger.lastSex = -1 +SkinChanger.character = {} +SkinChanger.components = Config.Components - if malePed then - characterModel = `mp_m_freemode_01` - else - characterModel = `mp_f_freemode_01` +function SkinChanger:RequestModel(model) + if type(model) == "string" then + model = joaat(model) end - RequestModel(characterModel) + RequestModel(model) - CreateThread(function() - while not HasModelLoaded(characterModel) do - RequestModel(characterModel) - Wait(0) - end + while not HasModelLoaded(model) do + Wait(200) + end - if IsModelInCdimage(characterModel) and IsModelValid(characterModel) then - SetPlayerModel(PlayerId(), characterModel) - SetPedDefaultComponentVariation(playerPed) - end - - SetModelAsNoLongerNeeded(characterModel) - - if cb ~= nil then - cb() - end - - TriggerEvent("skinchanger:modelLoaded") - end) + return model end -function GetMaxVals() - local playerPed = PlayerPedId() +function SkinChanger:ModelLoaded() + ClearPedProp(PlayerPedId(), 0) - local data = { - sex = 1, - mom = 45, -- numbers 21-41 and 45 are female (22 total) - dad = 44, -- numbers 0-20 and 42-44 are male (24 total) - face_md_weight = 100, - skin_md_weight = 100, - nose_1 = 10, - nose_2 = 10, - nose_3 = 10, - nose_4 = 10, - nose_5 = 10, - nose_6 = 10, - cheeks_1 = 10, - cheeks_2 = 10, - cheeks_3 = 10, - lip_thickness = 10, - jaw_1 = 10, - jaw_2 = 10, - chin_1 = 10, - chin_2 = 10, - chin_3 = 10, - chin_4 = 10, - neck_thickness = 10, - age_1 = GetPedHeadOverlayNum(3) - 1, - age_2 = 10, - beard_1 = GetPedHeadOverlayNum(1) - 1, - beard_2 = 10, - beard_3 = GetNumHairColors() - 1, - beard_4 = GetNumHairColors() - 1, - hair_1 = GetNumberOfPedDrawableVariations(playerPed, 2) - 1, - hair_2 = GetNumberOfPedTextureVariations(playerPed, 2, Character["hair_1"]) - 1, - hair_color_1 = GetNumHairColors() - 1, - hair_color_2 = GetNumHairColors() - 1, - eye_color = 31, - eye_squint = 10, - eyebrows_1 = GetPedHeadOverlayNum(2) - 1, - eyebrows_2 = 10, - eyebrows_3 = GetNumHairColors() - 1, - eyebrows_4 = GetNumHairColors() - 1, - eyebrows_5 = 10, - eyebrows_6 = 10, - makeup_1 = GetPedHeadOverlayNum(4) - 1, - makeup_2 = 10, - makeup_3 = GetNumHairColors() - 1, - makeup_4 = GetNumHairColors() - 1, - lipstick_1 = GetPedHeadOverlayNum(8) - 1, - lipstick_2 = 10, - lipstick_3 = GetNumHairColors() - 1, - lipstick_4 = GetNumHairColors() - 1, - blemishes_1 = GetPedHeadOverlayNum(0) - 1, - blemishes_2 = 10, - blush_1 = GetPedHeadOverlayNum(5) - 1, - blush_2 = 10, - blush_3 = GetNumHairColors() - 1, - complexion_1 = GetPedHeadOverlayNum(6) - 1, - complexion_2 = 10, - sun_1 = GetPedHeadOverlayNum(7) - 1, - sun_2 = 10, - moles_1 = GetPedHeadOverlayNum(9) - 1, - moles_2 = 10, - chest_1 = GetPedHeadOverlayNum(10) - 1, - chest_2 = 10, - chest_3 = GetNumHairColors() - 1, - bodyb_1 = GetPedHeadOverlayNum(11) - 1, - bodyb_2 = 10, - bodyb_3 = GetPedHeadOverlayNum(12) - 1, - bodyb_4 = 10, - ears_1 = GetNumberOfPedPropDrawableVariations(playerPed, 2) - 1, - ears_2 = GetNumberOfPedPropTextureVariations(playerPed, 2, Character["ears_1"] - 1), - tshirt_1 = GetNumberOfPedDrawableVariations(playerPed, 8) - 1, - tshirt_2 = GetNumberOfPedTextureVariations(playerPed, 8, Character["tshirt_1"]) - 1, - torso_1 = GetNumberOfPedDrawableVariations(playerPed, 11) - 1, - torso_2 = GetNumberOfPedTextureVariations(playerPed, 11, Character["torso_1"]) - 1, - decals_1 = GetNumberOfPedDrawableVariations(playerPed, 10) - 1, - decals_2 = GetNumberOfPedTextureVariations(playerPed, 10, Character["decals_1"]) - 1, - arms = GetNumberOfPedDrawableVariations(playerPed, 3) - 1, - arms_2 = 10, - pants_1 = GetNumberOfPedDrawableVariations(playerPed, 4) - 1, - pants_2 = GetNumberOfPedTextureVariations(playerPed, 4, Character["pants_1"]) - 1, - shoes_1 = GetNumberOfPedDrawableVariations(playerPed, 6) - 1, - shoes_2 = GetNumberOfPedTextureVariations(playerPed, 6, Character["shoes_1"]) - 1, - mask_1 = GetNumberOfPedDrawableVariations(playerPed, 1) - 1, - mask_2 = GetNumberOfPedTextureVariations(playerPed, 1, Character["mask_1"]) - 1, - bproof_1 = GetNumberOfPedDrawableVariations(playerPed, 9) - 1, - bproof_2 = GetNumberOfPedTextureVariations(playerPed, 9, Character["bproof_1"]) - 1, - chain_1 = GetNumberOfPedDrawableVariations(playerPed, 7) - 1, - chain_2 = GetNumberOfPedTextureVariations(playerPed, 7, Character["chain_1"]) - 1, - bags_1 = GetNumberOfPedDrawableVariations(playerPed, 5) - 1, - bags_2 = GetNumberOfPedTextureVariations(playerPed, 5, Character["bags_1"]) - 1, - helmet_1 = GetNumberOfPedPropDrawableVariations(playerPed, 0) - 1, - helmet_2 = GetNumberOfPedPropTextureVariations(playerPed, 0, Character["helmet_1"]) - 1, - glasses_1 = GetNumberOfPedPropDrawableVariations(playerPed, 1) - 1, - glasses_2 = GetNumberOfPedPropTextureVariations(playerPed, 1, Character["glasses_1"] - 1), - watches_1 = GetNumberOfPedPropDrawableVariations(playerPed, 6) - 1, - watches_2 = GetNumberOfPedPropTextureVariations(playerPed, 6, Character["watches_1"]) - 1, - bracelets_1 = GetNumberOfPedPropDrawableVariations(playerPed, 7) - 1, - bracelets_2 = GetNumberOfPedPropTextureVariations(playerPed, 7, Character["bracelets_1"] - 1), - } + if self.loadSkin ~= nil then + self:ApplySkin(self.loadSkin) + self.loadSkin = nil + end + + if self.loadClothes ~= nil then + self:ApplySkin(self.loadClothes.playerSkin, self.loadClothes.clothesSkin) + self.loadClothes = nil + end +end + +function SkinChanger:DefaultModel(male, cb) + local playerPed = PlayerPedId() + local characterModel = male and `mp_m_freemode_01` or `mp_f_freemode_01` + + if not IsModelInCdimage(characterModel) or not IsModelValid(characterModel) then + return + end + local model = self:RequestModel(characterModel) + + SetPlayerModel(PlayerId(), model) + SetPedDefaultComponentVariation(playerPed) + + SetModelAsNoLongerNeeded(model) + + if cb then + cb() + end + + self:ModelLoaded() +end + +function SkinChanger:MaxValues() + local playerPed = PlayerPedId() + local data = {} + + for i = 1, #self.components, 1 do + local component = self.components[i] + local max = type(component.max) == "function" and component.max(playerPed, self.character) or component.max + data[component.name] = max + end return data end -function ApplySkin(skin, clothes) - local playerPed = PlayerPedId() +function SkinChanger:DefaultFromSex(sex, cb) + if sex == 0 then + self:DefaultModel(true, cb) + else + self:DefaultModel(false, cb) + end +end + +function SkinChanger:LoadSkin(skin, cb) + local sex = skin["sex"] + if sex ~= self.lastSex then + self.loadSkin = skin + self:DefaultFromSex(sex, cb) + + self.lastSex = sex + else + self:ApplySkin(skin) + + if cb ~= nil then + cb() + else + return + end + end +end + +function SkinChanger:ValidClothes(key) + local keys = {["sex"] = true, ["mom"] = true, ["dad"] = true, ["face_md_weight"] = true, ["skin_md_weight"] = true, ["nose_1"] = true, ["nose_2"] = true, ["nose_3"] = true, ["nose_4"] = true, ["nose_5"] = true, ["nose_6"] = true, ["cheeks_1"] = true, ["cheeks_2"] = true, ["cheeks_3"] = true, ["lip_thickness"] = true, ["jaw_1"] = true, ["jaw_2"] = true, ["chin_1"] = true, ["chin_2"] = true, ["chin_3"] = true, ["chin_4"] = true, ["neck_thickness"] = true, ["age_1"] = true, ["age_2"] = true, ["eye_color"] = true, ["eye_squint"] = true, ["beard_1"] = true, ["beard_2"] = true, ["beard_3"] = true, ["beard_4"] = true, ["hair_1"] = true, ["hair_2"] = true, ["hair_color_1"] = true, ["hair_color_2"] = true, ["eyebrows_1"] = true, ["eyebrows_2"] = true, ["eyebrows_3"] = true, ["eyebrows_4"] = true, ["eyebrows_5"] = true, ["eyebrows_6"] = true, ["makeup_1"] = true, ["makeup_2"] = true, ["makeup_3"] = true, ["makeup_4"] = true, ["lipstick_1"] = true, ["lipstick_2"] = true, ["lipstick_3"] = true, ["lipstick_4"] = true, ["blemishes_1"] = true, ["blemishes_2"] = true, ["blemishes_3"] = true, ["blush_1"] = true, ["blush_2"] = true, ["blush_3"] = true, ["complexion_1"] = true, ["complexion_2"] = true, ["sun_1"] = true, ["sun_2"] = true, ["moles_1"] = true, ["moles_2"] = true, ["chest_1"] = true, ["chest_2"] = true, ["chest_3"] = true, ["bodyb_1"] = true, ["bodyb_2"] = true, ["bodyb_3"] = true, ["bodyb_4"] = true} + return keys[key] ~= nil +end + +local function Normalise(weight, divison) + return (weight / divison) + 0.0 +end + +function SkinChanger:SetHead() + local face_weight = Normalise(self.character["face_md_weight"], 100) + local skin_weight = Normalise(self.character["skin_md_weight"], 100) + + if not self.character["face_g_weight"] then + self.character["face_g_weight"] = 0 + end + + local third_weight = Normalise(self.character["face_g_weight"], 100) + + if not self.character["grandparents"] then + self.character["grandparents"] = 0 + end + + SetPedHeadBlendData(self.playerPed, + self.character["mom"], self.character["dad"], self.character["grandparents"] , self.character["mom"], + self.character["dad"], self.character["grandparents"], face_weight, skin_weight, third_weight, false) +end + +function SkinChanger:SetFace() + local features = {"nose_1", "nose_2", "nose_3", "nose_4", "nose_5", "nose_6", "eyebrows_5", "eyebrows_6", "cheeks_1", "cheeks_2", "cheeks_3", "eye_squint", "lip_thickness", "jaw_1", "jaw_2", "chin_1", "chin_2", "chin_3", "chin_4", "neck_thickness"} + for i = 1, #features, 1 do + local feature = features[i] + SetPedFaceFeature(self.playerPed, i - 1, Normalise(self.character[feature], 10)) + end + SetPedEyeColor(self.playerPed, self.character["eye_color"]) -- Eyes color +end + +function SkinChanger:SetHeadOverlay() + local features = {{"age_1", "age_2"}, {"blemishes_1", "blemishes_2"}, {"beard_1", "beard_2"}, {"eyebrows_1", "eyebrows_2"}, {"makeup_1", "makeup_2"}, {"lipstick_1", "lipstick_2"}, {"blush_1", "blush_2"}, {"complexion_1", "complexion_2"}, {"sun_1", "sun_2"}, {"moles_1", "moles_2"}, {"chest_1", "chest_2"}} + for i = 1, #features, 1 do + local feature = features[i] + SetPedHeadOverlay(self.playerPed, i - 1, self.character[feature[1]], Normalise(self.character[feature[2]], 10)) + end +end + +function SkinChanger:SetHeadOverlayColour() + local features = {{"beard_3", "beard_4"}, {"eyebrows_3", "eyebrows_4"}, {"makeup_3", "makeup_4"}, {"lipstick_3", "lipstick_4"}, {"blush_3", 0}, {"chest_3", 0}} + for i = 1, #features, 1 do + local feature = features[i] + SetPedHeadOverlayColor(self.playerPed, i - 1, 1, self.character[feature[1]], self.character[feature[2]]) + end + if self.character["bodyb_1"] == -1 then + SetPedHeadOverlay(self.playerPed, 11, 255, (self.character["bodyb_2"] / 10) + 0.0) -- Body Blemishes + opacity + else + SetPedHeadOverlay(self.playerPed, 11, self.character["bodyb_1"], (self.character["bodyb_2"] / 10) + 0.0) + end + + if self.character["bodyb_3"] == -1 then + SetPedHeadOverlay(self.playerPed, 12, 255, (self.character["bodyb_4"] / 10) + 0.0) + else + SetPedHeadOverlay(self.playerPed, 12, self.character["bodyb_3"], (self.character["bodyb_4"] / 10) + 0.0) -- Blemishes 'added body effect' + opacity + end +end + +function SkinChanger:SetHair() + SetPedComponentVariation(self.playerPed, 2, self.character["hair_1"], self.character["hair_2"], 2) -- Hair + SetPedHairColor(self.playerPed, self.character["hair_color_1"], self.character["hair_color_2"]) -- Hair Color +end + +function SkinChanger:SetComponents() + local components = {{"tshirt_1", "tshirt_2", 8}, {"torso_1", "torso_2", 11}, {"decals_1", "decals_2", 10}, {"arms", "arms_2", 3}, {"pants_1", "pants_2", 4}, {"shoes_1", "shoes_2", 6}, {"mask_1", "mask_2", 1}, {"bproof_1", "bproof_2", 9}, {"chain_1", "chain_2", 7}, {"bags_1", "bags_2", 5}} + for i = 1, #components, 1 do + local component = components[i] + SetPedComponentVariation(self.playerPed, component[3], self.character[component[1]], self.character[component[2]], 2) + end +end + +function SkinChanger:SetProps() + local props = {{"helmet_1", "helmet_2", 0}, {"glasses_1", "glasses_2", 1}, {"ears_1", "ears_2", 2}, {"watches_1", "watches_2", 6}, {"bracelets_1", "bracelets_2", 7}} + for i = 1, #props, 1 do + local prop = props[i] + local propVal = self.character[prop[1]] + if propVal == -1 then + ClearPedProp(self.playerPed, prop[3]) + else + SetPedPropIndex(self.playerPed, prop[3], propVal, self.character[prop[2]], true) + end + end +end + +function SkinChanger:ApplySkin(skin, clothes) + self.playerPed = PlayerPedId() for k, v in pairs(skin) do - Character[k] = v + self.character[k] = v end if clothes ~= nil then for k, v in pairs(clothes) do - if - k ~= "sex" - and k ~= "mom" - and k ~= "dad" - and k ~= "face_md_weight" - and k ~= "skin_md_weight" - and k ~= "nose_1" - and k ~= "nose_2" - and k ~= "nose_3" - and k ~= "nose_4" - and k ~= "nose_5" - and k ~= "nose_6" - and k ~= "cheeks_1" - and k ~= "cheeks_2" - and k ~= "cheeks_3" - and k ~= "lip_thickness" - and k ~= "jaw_1" - and k ~= "jaw_2" - and k ~= "chin_1" - and k ~= "chin_2" - and k ~= "chin_3" - and k ~= "chin_4" - and k ~= "neck_thickness" - and k ~= "age_1" - and k ~= "age_2" - and k ~= "eye_color" - and k ~= "eye_squint" - 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 ~= "eyebrows_5" - and k ~= "eyebrows_6" - 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 ~= "blemishes_3" - 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" - and k ~= "bodyb_3" - and k ~= "bodyb_4" - then - Character[k] = v + if self:ValidClothes(k) then + self.character[k] = v end end end - local face_weight = (Character["face_md_weight"] / 100) + 0.0 - local skin_weight = (Character["skin_md_weight"] / 100) + 0.0 - SetPedHeadBlendData(playerPed, Character["mom"], Character["dad"], 0, Character["mom"], Character["dad"], 0, face_weight, skin_weight, 0.0, false) + self:SetHead() + self:SetHair() + self:SetFace() + self:SetHeadOverlay() + self:SetHeadOverlayColour() + self:SetComponents() + self:SetProps() + return true +end - SetPedFaceFeature(playerPed, 0, (Character["nose_1"] / 10) + 0.0) -- Nose Width - SetPedFaceFeature(playerPed, 1, (Character["nose_2"] / 10) + 0.0) -- Nose Peak Height - SetPedFaceFeature(playerPed, 2, (Character["nose_3"] / 10) + 0.0) -- Nose Peak Length - SetPedFaceFeature(playerPed, 3, (Character["nose_4"] / 10) + 0.0) -- Nose Bone Height - SetPedFaceFeature(playerPed, 4, (Character["nose_5"] / 10) + 0.0) -- Nose Peak Lowering - SetPedFaceFeature(playerPed, 5, (Character["nose_6"] / 10) + 0.0) -- Nose Bone Twist - SetPedFaceFeature(playerPed, 6, (Character["eyebrows_5"] / 10) + 0.0) -- Eyebrow height - SetPedFaceFeature(playerPed, 7, (Character["eyebrows_6"] / 10) + 0.0) -- Eyebrow depth - SetPedFaceFeature(playerPed, 8, (Character["cheeks_1"] / 10) + 0.0) -- Cheekbones Height - SetPedFaceFeature(playerPed, 9, (Character["cheeks_2"] / 10) + 0.0) -- Cheekbones Width - SetPedFaceFeature(playerPed, 10, (Character["cheeks_3"] / 10) + 0.0) -- Cheeks Width - SetPedFaceFeature(playerPed, 11, (Character["eye_squint"] / 10) + 0.0) -- Eyes squint - SetPedFaceFeature(playerPed, 12, (Character["lip_thickness"] / 10) + 0.0) -- Lip Fullness - SetPedFaceFeature(playerPed, 13, (Character["jaw_1"] / 10) + 0.0) -- Jaw Bone Width - SetPedFaceFeature(playerPed, 14, (Character["jaw_2"] / 10) + 0.0) -- Jaw Bone Length - SetPedFaceFeature(playerPed, 15, (Character["chin_1"] / 10) + 0.0) -- Chin Height - SetPedFaceFeature(playerPed, 16, (Character["chin_2"] / 10) + 0.0) -- Chin Length - SetPedFaceFeature(playerPed, 17, (Character["chin_3"] / 10) + 0.0) -- Chin Width - SetPedFaceFeature(playerPed, 18, (Character["chin_4"] / 10) + 0.0) -- Chin Hole Size - SetPedFaceFeature(playerPed, 19, (Character["neck_thickness"] / 10) + 0.0) -- Neck Thickness +function SkinChanger:LoadClothes(playerSkin, clothesSkin) + local sex = playerSkin["sex"] + if sex ~= self.lastSex then + self.loadClothes = { + playerSkin = playerSkin, + clothesSkin = clothesSkin, + } - SetPedHairColor(playerPed, Character["hair_color_1"], Character["hair_color_2"]) -- Hair Color - SetPedHeadOverlay(playerPed, 3, Character["age_1"], (Character["age_2"] / 10) + 0.0) -- Age + opacity - SetPedHeadOverlay(playerPed, 0, Character["blemishes_1"], (Character["blemishes_2"] / 10) + 0.0) -- Blemishes + opacity - SetPedHeadOverlay(playerPed, 1, Character["beard_1"], (Character["beard_2"] / 10) + 0.0) -- Beard + opacity - SetPedEyeColor(playerPed, Character["eye_color"]) -- Eyes color - SetPedHeadOverlay(playerPed, 2, Character["eyebrows_1"], (Character["eyebrows_2"] / 10) + 0.0) -- Eyebrows + opacity - SetPedHeadOverlay(playerPed, 4, Character["makeup_1"], (Character["makeup_2"] / 10) + 0.0) -- Makeup + opacity - SetPedHeadOverlay(playerPed, 8, Character["lipstick_1"], (Character["lipstick_2"] / 10) + 0.0) -- Lipstick + opacity - SetPedComponentVariation(playerPed, 2, Character["hair_1"], Character["hair_2"], 2) -- Hair - SetPedHeadOverlayColor(playerPed, 1, 1, Character["beard_3"], Character["beard_4"]) -- Beard Color - SetPedHeadOverlayColor(playerPed, 2, 1, Character["eyebrows_3"], Character["eyebrows_4"]) -- Eyebrows Color - SetPedHeadOverlayColor(playerPed, 4, 2, Character["makeup_3"], Character["makeup_4"]) -- Makeup Color - SetPedHeadOverlayColor(playerPed, 8, 1, Character["lipstick_3"], Character["lipstick_4"]) -- Lipstick Color - SetPedHeadOverlay(playerPed, 5, Character["blush_1"], (Character["blush_2"] / 10) + 0.0) -- Blush + opacity - SetPedHeadOverlayColor(playerPed, 5, 2, Character["blush_3"], 0) -- Blush Color - SetPedHeadOverlay(playerPed, 6, Character["complexion_1"], (Character["complexion_2"] / 10) + 0.0) -- Complexion + opacity - SetPedHeadOverlay(playerPed, 7, Character["sun_1"], (Character["sun_2"] / 10) + 0.0) -- Sun Damage + opacity - SetPedHeadOverlay(playerPed, 9, Character["moles_1"], (Character["moles_2"] / 10) + 0.0) -- Moles/Freckles + opacity - SetPedHeadOverlay(playerPed, 10, Character["chest_1"], (Character["chest_2"] / 10) + 0.0) -- Chest Hair + opacity - SetPedHeadOverlayColor(playerPed, 10, 1, Character["chest_3"], 0) -- Torso Color + self:DefaultFromSex(sex) - if Character["bodyb_1"] == -1 then - SetPedHeadOverlay(playerPed, 11, 255, (Character["bodyb_2"] / 10) + 0.0) -- Body Blemishes + opacity + self.lastSex = sex + return true else - SetPedHeadOverlay(playerPed, 11, Character["bodyb_1"], (Character["bodyb_2"] / 10) + 0.0) - end - - if Character["bodyb_3"] == -1 then - SetPedHeadOverlay(playerPed, 12, 255, (Character["bodyb_4"] / 10) + 0.0) - else - SetPedHeadOverlay(playerPed, 12, Character["bodyb_3"], (Character["bodyb_4"] / 10) + 0.0) -- Blemishes 'added body effect' + opacity - end - - if Character["ears_1"] == -1 then - ClearPedProp(playerPed, 2) - else - SetPedPropIndex(playerPed, 2, Character["ears_1"], Character["ears_2"], true) -- Ears Accessories - end - - SetPedComponentVariation(playerPed, 8, Character["tshirt_1"], Character["tshirt_2"], 2) -- Tshirt - SetPedComponentVariation(playerPed, 11, Character["torso_1"], Character["torso_2"], 2) -- torso parts - SetPedComponentVariation(playerPed, 3, Character["arms"], Character["arms_2"], 2) -- Arms - SetPedComponentVariation(playerPed, 10, Character["decals_1"], Character["decals_2"], 2) -- decals - SetPedComponentVariation(playerPed, 4, Character["pants_1"], Character["pants_2"], 2) -- pants - SetPedComponentVariation(playerPed, 6, Character["shoes_1"], Character["shoes_2"], 2) -- shoes - SetPedComponentVariation(playerPed, 1, Character["mask_1"], Character["mask_2"], 2) -- mask - SetPedComponentVariation(playerPed, 9, Character["bproof_1"], Character["bproof_2"], 2) -- bulletproof - SetPedComponentVariation(playerPed, 7, Character["chain_1"], Character["chain_2"], 2) -- chain - SetPedComponentVariation(playerPed, 5, Character["bags_1"], Character["bags_2"], 2) -- Bag - - if Character["helmet_1"] == -1 then - ClearPedProp(playerPed, 0) - else - SetPedPropIndex(playerPed, 0, Character["helmet_1"], Character["helmet_2"], true) -- Helmet - end - - if Character["glasses_1"] == -1 then - ClearPedProp(playerPed, 1) - else - SetPedPropIndex(playerPed, 1, Character["glasses_1"], Character["glasses_2"], true) -- Glasses - end - - if Character["watches_1"] == -1 then - ClearPedProp(playerPed, 6) - else - SetPedPropIndex(playerPed, 6, Character["watches_1"], Character["watches_2"], true) -- Watches - end - - if Character["bracelets_1"] == -1 then - ClearPedProp(playerPed, 7) - else - SetPedPropIndex(playerPed, 7, Character["bracelets_1"], Character["bracelets_2"], true) -- Bracelets + return self:ApplySkin(playerSkin, clothesSkin) end end +function SkinChanger:Change(key, val) + self.character[key] = val + + if key == "sex" then + self:LoadSkin(self.character) + else + self:ApplySkin(self.character) + end +end + +function SkinChanger:Init() + for i = 1, #self.components, 1 do + local component = self.components[i] + self.character[component.name] = component.value + end +end + +--- exports + +exports("GetSkin", function() + return SkinChanger.character +end) + +exports("GetMaxVals", function() + return SkinChanger:MaxValues() +end) + +exports("LoadSkin", function(skin) + return SkinChanger:LoadSkin(skin) +end) + +exports("LoadClothes", function(playerSkin, clothesSkin) + return SkinChanger:LoadClothes(playerSkin, clothesSkin) +end) + +exports("Change", function(key, val) + return SkinChanger:Change(key, val) +end) + +--- Events + +RegisterNetEvent("skinchanger:loadSkin", function(skin, cb) + SkinChanger:LoadSkin(skin, cb) +end) + +RegisterNetEvent("skinchanger:loadClothes", function(playerSkin, clothesSkin) + SkinChanger:LoadClothes(playerSkin, clothesSkin) +end) + +AddEventHandler("skinchanger:getSkin", function(cb) + cb(SkinChanger.character) +end) + AddEventHandler("skinchanger:loadDefaultModel", function(loadMale, cb) - LoadDefaultModel(loadMale, cb) + SkinChanger:DefaultModel(loadMale, cb) +end) + +AddEventHandler("skinchanger:change", function(key, val) + SkinChanger:Change(key, val) +end) + +AddEventHandler("skinchanger:modelLoaded", function() + SkinChanger:ModelLoaded() end) AddEventHandler("skinchanger:getData", function(cb) - local components = json.decode(json.encode(Components)) - - for k, v in pairs(Character) do + local components = SkinChanger.components + for k, v in pairs(SkinChanger.character) do for i = 1, #components, 1 do if k == components[i].name then components[i].value = v @@ -344,74 +301,7 @@ AddEventHandler("skinchanger:getData", function(cb) end end - cb(components, GetMaxVals()) + cb(components, SkinChanger:MaxValues()) end) -AddEventHandler("skinchanger:change", function(key, val) - Character[key] = val - - if key == "sex" then - TriggerEvent("skinchanger:loadSkin", Character) - else - ApplySkin(Character) - end -end) - -AddEventHandler("skinchanger:getSkin", function(cb) - cb(Character) -end) - -AddEventHandler("skinchanger:modelLoaded", function() - ClearPedProp(PlayerPedId(), 0) - - if LoadSkin ~= nil then - ApplySkin(LoadSkin) - LoadSkin = nil - end - - if LoadClothes ~= nil then - ApplySkin(LoadClothes.playerSkin, LoadClothes.clothesSkin) - LoadClothes = nil - end -end) - -RegisterNetEvent("skinchanger:loadSkin") -AddEventHandler("skinchanger:loadSkin", function(skin, cb) - if skin["sex"] ~= LastSex then - LoadSkin = skin - - if skin["sex"] == 0 then - TriggerEvent("skinchanger:loadDefaultModel", true, cb) - else - TriggerEvent("skinchanger:loadDefaultModel", false, cb) - end - else - ApplySkin(skin) - - if cb ~= nil then - cb() - end - end - - LastSex = skin["sex"] -end) - -RegisterNetEvent("skinchanger:loadClothes") -AddEventHandler("skinchanger:loadClothes", function(playerSkin, clothesSkin) - if playerSkin["sex"] ~= LastSex then - LoadClothes = { - playerSkin = playerSkin, - clothesSkin = clothesSkin, - } - - if playerSkin["sex"] == 0 then - TriggerEvent("skinchanger:loadDefaultModel", true) - else - TriggerEvent("skinchanger:loadDefaultModel", false) - end - else - ApplySkin(playerSkin, clothesSkin) - end - - LastSex = playerSkin["sex"] -end) +SkinChanger:Init() \ No newline at end of file diff --git a/[core]/skinchanger/config.lua b/[core]/skinchanger/config.lua index fa6eac7a..2401b9c7 100644 --- a/[core]/skinchanger/config.lua +++ b/[core]/skinchanger/config.lua @@ -10,14 +10,16 @@ Config.Components = { min = 0, zoomOffset = 0.6, camOffset = 0.65, + max = 1, }, { label = TranslateCap("mom"), name = "mom", - value = 21, - min = 21, + value = 0, + min = 0, zoomOffset = 0.6, camOffset = 0.65, + max = 45, }, { label = TranslateCap("dad"), @@ -26,6 +28,16 @@ Config.Components = { min = 0, zoomOffset = 0.6, camOffset = 0.65, + max = 44, + }, + { + label = TranslateCap("grandparents"), + name = "grandparents", + value = 0, + min = 0, + zoomOffset = 0.6, + camOffset = 0.65, + max = 45, }, { label = TranslateCap("resemblance"), @@ -34,6 +46,16 @@ Config.Components = { min = 0, zoomOffset = 0.6, camOffset = 0.65, + max = 100, + }, + { + label = TranslateCap("resemblance_g"), + name = "face_g_weight", + value = 0, + min = 0, + zoomOffset = 0.6, + camOffset = 0.65, + max = 100, }, { label = TranslateCap("skin_tone"), @@ -42,6 +64,7 @@ Config.Components = { min = 0, zoomOffset = 0.6, camOffset = 0.65, + max = 100, }, { label = TranslateCap("nose_1"), @@ -50,6 +73,7 @@ Config.Components = { min = -10, zoomOffset = 0.6, camOffset = 0.65, + max = 10, }, { label = TranslateCap("nose_2"), @@ -58,6 +82,7 @@ Config.Components = { min = -10, zoomOffset = 0.6, camOffset = 0.65, + max = 10, }, { label = TranslateCap("nose_3"), @@ -66,6 +91,7 @@ Config.Components = { min = -10, zoomOffset = 0.6, camOffset = 0.65, + max = 10, }, { label = TranslateCap("nose_4"), @@ -74,6 +100,7 @@ Config.Components = { min = -10, zoomOffset = 0.6, camOffset = 0.65, + max = 10, }, { label = TranslateCap("nose_5"), @@ -82,6 +109,7 @@ Config.Components = { min = -10, zoomOffset = 0.6, camOffset = 0.65, + max = 10, }, { label = TranslateCap("nose_6"), @@ -90,6 +118,7 @@ Config.Components = { min = -10, zoomOffset = 0.6, camOffset = 0.65, + max = 10, }, { label = TranslateCap("cheeks_1"), @@ -98,6 +127,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("cheeks_2"), @@ -106,6 +136,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("cheeks_3"), @@ -114,6 +145,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("lip_fullness"), @@ -122,6 +154,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("jaw_bone_width"), @@ -130,6 +163,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("jaw_bone_length"), @@ -138,6 +172,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("chin_height"), @@ -146,6 +181,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("chin_length"), @@ -154,6 +190,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("chin_width"), @@ -162,6 +199,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("chin_hole"), @@ -170,6 +208,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("neck_thickness"), @@ -178,6 +217,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("hair_1"), @@ -186,6 +226,9 @@ Config.Components = { min = 0, zoomOffset = 0.6, camOffset = 0.65, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 2) - 1 + end }, { label = TranslateCap("hair_2"), @@ -194,6 +237,9 @@ Config.Components = { min = 0, zoomOffset = 0.6, camOffset = 0.65, + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 2, Character["hair_1"]) - 1 + end }, { label = TranslateCap("hair_color_1"), @@ -202,6 +248,9 @@ Config.Components = { min = 0, zoomOffset = 0.6, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("hair_color_2"), @@ -210,6 +259,9 @@ Config.Components = { min = 0, zoomOffset = 0.6, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("tshirt_1"), @@ -219,6 +271,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, componentId = 8, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 8) - 1 + end }, { label = TranslateCap("tshirt_2"), @@ -228,6 +283,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, textureof = "tshirt_1", + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 8, Character["tshirt_1"]) - 1 + end }, { label = TranslateCap("torso_1"), @@ -237,6 +295,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, componentId = 11, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 11) - 1 + end }, { label = TranslateCap("torso_2"), @@ -246,6 +307,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, textureof = "torso_1", + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 11, Character["torso_1"]) - 1 + end }, { label = TranslateCap("decals_1"), @@ -255,6 +319,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, componentId = 10, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 10) - 1 + end }, { label = TranslateCap("decals_2"), @@ -264,6 +331,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, textureof = "decals_1", + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 10, Character["decals_1"]) - 1 + end }, { label = TranslateCap("arms"), @@ -272,6 +342,9 @@ Config.Components = { min = 0, zoomOffset = 0.75, camOffset = 0.15, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 3) - 1 + end }, { label = TranslateCap("arms_2"), @@ -280,6 +353,7 @@ Config.Components = { min = 0, zoomOffset = 0.75, camOffset = 0.15, + max = 10, }, { label = TranslateCap("pants_1"), @@ -289,6 +363,9 @@ Config.Components = { zoomOffset = 0.8, camOffset = -0.5, componentId = 4, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 4) - 1 + end }, { label = TranslateCap("pants_2"), @@ -298,6 +375,9 @@ Config.Components = { zoomOffset = 0.8, camOffset = -0.5, textureof = "pants_1", + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 4, Character["pants_1"]) - 1 + end }, { label = TranslateCap("shoes_1"), @@ -307,6 +387,9 @@ Config.Components = { zoomOffset = 0.8, camOffset = -0.8, componentId = 6, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 6) - 1 + end }, { label = TranslateCap("shoes_2"), @@ -316,6 +399,9 @@ Config.Components = { zoomOffset = 0.8, camOffset = -0.8, textureof = "shoes_1", + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 6, Character["shoes_1"]) - 1 + end }, { label = TranslateCap("mask_1"), @@ -325,6 +411,9 @@ Config.Components = { zoomOffset = 0.6, camOffset = 0.65, componentId = 1, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 1) - 1 + end }, { label = TranslateCap("mask_2"), @@ -334,6 +423,9 @@ Config.Components = { zoomOffset = 0.6, camOffset = 0.65, textureof = "mask_1", + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 1, Character["mask_1"]) - 1 + end }, { label = TranslateCap("bproof_1"), @@ -343,6 +435,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, componentId = 9, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 9) - 1 + end }, { label = TranslateCap("bproof_2"), @@ -352,6 +447,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, textureof = "bproof_1", + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 9, Character["bproof_1"]) - 1 + end }, { label = TranslateCap("chain_1"), @@ -361,6 +459,9 @@ Config.Components = { zoomOffset = 0.6, camOffset = 0.65, componentId = 7, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 7) - 1 + end }, { label = TranslateCap("chain_2"), @@ -370,6 +471,9 @@ Config.Components = { zoomOffset = 0.6, camOffset = 0.65, textureof = "chain_1", + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 7, Character["chain_1"]) - 1 + end }, { label = TranslateCap("helmet_1"), @@ -379,6 +483,9 @@ Config.Components = { zoomOffset = 0.6, camOffset = 0.65, componentId = 0, + max = function(playerPed) + return GetNumberOfPedPropDrawableVariations(playerPed, 0) - 1 + end }, { label = TranslateCap("helmet_2"), @@ -388,6 +495,9 @@ Config.Components = { zoomOffset = 0.6, camOffset = 0.65, textureof = "helmet_1", + max = function(playerPed, Character) + return GetNumberOfPedPropTextureVariations(playerPed, 0, Character["helmet_1"]) - 1 + end }, { label = TranslateCap("glasses_1"), @@ -397,6 +507,9 @@ Config.Components = { zoomOffset = 0.6, camOffset = 0.65, componentId = 1, + max = function(playerPed) + return GetNumberOfPedPropDrawableVariations(playerPed, 1) - 1 + end }, { label = TranslateCap("glasses_2"), @@ -406,6 +519,9 @@ Config.Components = { zoomOffset = 0.6, camOffset = 0.65, textureof = "glasses_1", + max = function(playerPed, Character) + return GetNumberOfPedPropTextureVariations(playerPed, 1, Character["glasses_1"]) - 1 + end }, { label = TranslateCap("watches_1"), @@ -415,6 +531,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, componentId = 6, + max = function(playerPed) + return GetNumberOfPedPropDrawableVariations(playerPed, 6) - 1 + end }, { label = TranslateCap("watches_2"), @@ -424,6 +543,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, textureof = "watches_1", + max = function(playerPed, Character) + return GetNumberOfPedPropTextureVariations(playerPed, 6, Character["watches_1"]) - 1 + end }, { label = TranslateCap("bracelets_1"), @@ -433,6 +555,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, componentId = 7, + max = function(playerPed) + return GetNumberOfPedPropDrawableVariations(playerPed, 7) - 1 + end }, { label = TranslateCap("bracelets_2"), @@ -442,6 +567,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, textureof = "bracelets_1", + max = function(playerPed, Character) + return GetNumberOfPedPropTextureVariations(playerPed, 7, Character["bracelets_1"]) - 1 + end }, { label = TranslateCap("bag"), @@ -451,6 +579,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, componentId = 5, + max = function(playerPed) + return GetNumberOfPedDrawableVariations(playerPed, 5) - 1 + end }, { label = TranslateCap("bag_color"), @@ -460,6 +591,9 @@ Config.Components = { zoomOffset = 0.75, camOffset = 0.15, textureof = "bags_1", + max = function(playerPed, Character) + return GetNumberOfPedTextureVariations(playerPed, 5, Character["bags_1"]) - 1 + end }, { label = TranslateCap("eye_color"), @@ -468,6 +602,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 31, }, { label = TranslateCap("eye_squint"), @@ -476,6 +611,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("eyebrow_size"), @@ -484,6 +620,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("eyebrow_type"), @@ -492,6 +629,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(2) - 1 + end }, { label = TranslateCap("eyebrow_color_1"), @@ -500,6 +640,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("eyebrow_color_2"), @@ -508,6 +651,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("eyebrow_height"), @@ -516,6 +662,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("eyebrow_depth"), @@ -524,6 +671,7 @@ Config.Components = { min = -10, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("makeup_type"), @@ -532,6 +680,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(4) - 1 + end }, { label = TranslateCap("makeup_thickness"), @@ -540,6 +691,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("makeup_color_1"), @@ -548,6 +700,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("makeup_color_2"), @@ -556,6 +711,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("lipstick_type"), @@ -564,6 +722,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(8) - 1 + end }, { label = TranslateCap("lipstick_thickness"), @@ -572,6 +733,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("lipstick_color_1"), @@ -580,6 +742,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("lipstick_color_2"), @@ -588,6 +753,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("ear_accessories"), @@ -597,6 +765,9 @@ Config.Components = { zoomOffset = 0.4, camOffset = 0.65, componentId = 2, + max = function(playerPed) + return GetNumberOfPedPropDrawableVariations(playerPed, 2) - 1 + end }, { label = TranslateCap("ear_accessories_color"), @@ -606,6 +777,9 @@ Config.Components = { zoomOffset = 0.4, camOffset = 0.65, textureof = "ears_1", + max = function(playerPed, Character) + return GetNumberOfPedPropTextureVariations(playerPed, 2, Character["ears_1"]) - 1 + end }, { label = TranslateCap("chest_hair"), @@ -614,6 +788,9 @@ Config.Components = { min = 0, zoomOffset = 0.75, camOffset = 0.15, + max = function() + return GetPedHeadOverlayNum(10) - 1 + end }, { label = TranslateCap("chest_hair_1"), @@ -622,6 +799,7 @@ Config.Components = { min = 0, zoomOffset = 0.75, camOffset = 0.15, + max = 10, }, { label = TranslateCap("chest_color"), @@ -630,6 +808,9 @@ Config.Components = { min = 0, zoomOffset = 0.75, camOffset = 0.15, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("bodyb"), @@ -638,6 +819,9 @@ Config.Components = { min = -1, zoomOffset = 0.75, camOffset = 0.15, + max = function() + return GetPedHeadOverlayNum(11) - 1 + end }, { label = TranslateCap("bodyb_size"), @@ -646,6 +830,7 @@ Config.Components = { min = 0, zoomOffset = 0.75, camOffset = 0.15, + max = 10, }, { label = TranslateCap("bodyb_extra"), @@ -654,6 +839,9 @@ Config.Components = { min = -1, zoomOffset = 0.4, camOffset = 0.15, + max = function() + return GetPedHeadOverlayNum(12) - 1 + end }, { label = TranslateCap("bodyb_extra_thickness"), @@ -662,6 +850,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.15, + max = 10, }, { label = TranslateCap("wrinkles"), @@ -670,6 +859,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(3) - 1 + end }, { label = TranslateCap("wrinkle_thickness"), @@ -678,6 +870,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("blemishes"), @@ -686,6 +879,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(0) - 1 + end }, { label = TranslateCap("blemishes_size"), @@ -694,6 +890,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("blush"), @@ -702,6 +899,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(5) - 1 + end }, { label = TranslateCap("blush_1"), @@ -710,6 +910,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("blush_color"), @@ -718,6 +919,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("complexion"), @@ -726,6 +930,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(6) - 1 + end }, { label = TranslateCap("complexion_1"), @@ -734,6 +941,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("sun"), @@ -742,6 +950,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(7) - 1 + end }, { label = TranslateCap("sun_1"), @@ -750,6 +961,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("freckles"), @@ -758,6 +970,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(9) - 1 + end }, { label = TranslateCap("freckles_1"), @@ -766,6 +981,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("beard_type"), @@ -774,6 +990,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetPedHeadOverlayNum(1) - 1 + end }, { label = TranslateCap("beard_size"), @@ -782,6 +1001,7 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = 10, }, { label = TranslateCap("beard_color_1"), @@ -790,6 +1010,9 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, { label = TranslateCap("beard_color_2"), @@ -798,5 +1021,8 @@ Config.Components = { min = 0, zoomOffset = 0.4, camOffset = 0.65, + max = function() + return GetNumHairColors() - 1 + end }, }