diff --git a/README.md b/README.md index fb83222..a99ed0d 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,12 @@ This is a development resource, if you don't use the exports the resource itself Since this is a client script, you will need to use **setr** to set these convars. - **fivem-appearance:locale**: the name of one file inside `locales/`, default **en**, choose the locale file for the customization interface. - +- **fivem-appearance:automaticFade**: If set to 0, hair fade could be selected by the player, otherwise it will be automatic. default **1**. config.cfg example: ```cfg setr fivem-appearance:locale "en" +setr fivem-appearance:automaticFade 1 ensure fivem-appearance ``` @@ -99,6 +100,7 @@ RegisterCommand('customization', function() headOverlays = true, components = true, props = true, + tattoos = true } exports['fivem-appearance']:startPlayerCustomization(function (appearance) diff --git a/fxmanifest.lua b/fxmanifest.lua index a5afcf0..ad85ba4 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ game { "gta5" } author 'snakewiz' description 'A flexible player customization script for FiveM.' repository 'https://github.com/pedr0fontoura/fivem-appearance' -version '1.2.2' +version '1.3.0' client_script 'game/dist/index.js' diff --git a/game/src/client/index.ts b/game/src/client/index.ts index 578361b..6ee36b9 100644 --- a/game/src/client/index.ts +++ b/game/src/client/index.ts @@ -14,6 +14,7 @@ import Customization, { getPedTattoos, setPedTattoos } from './modules/customiza const exp = (global as any).exports; const GET_PED_HEAD_BLEND_DATA = '0x2746bd9d88c5c5d0'; +const AUTOMATIC_FADE = Boolean(Number(GetConvar('fivem-appearance:automaticFade', '1'))); export const totalTattoos: TattooList = JSON.parse( LoadResourceFile(GetCurrentResourceName(), 'tattoos.json'), @@ -264,14 +265,16 @@ export function setPedHair(ped: number, hair: PedHair): void { SetPedHairColor(ped, color, highlight); - const hairDecoration = getPedHairDecoration(ped, style); + if (AUTOMATIC_FADE) { + const hairDecoration = getPedHairDecoration(ped, style); - ClearPedDecorations(ped); + ClearPedDecorations(ped); - if (hairDecoration) { - const { collection, overlay } = hairDecoration; + if (hairDecoration) { + const { collection, overlay } = hairDecoration; - AddPedDecorationFromHashes(ped, GetHashKey(collection), GetHashKey(overlay)); + AddPedDecorationFromHashes(ped, GetHashKey(collection), GetHashKey(overlay)); + } } } @@ -405,7 +408,7 @@ function setPedAppearance(ped: number, appearance: Omit) } } -function init(): void { +(() => { Customization.loadModule(); exp('getPedModel', getPedModel); @@ -431,6 +434,4 @@ function init(): void { exp('setPedTattoos', setPedTattoos); exp('setPlayerAppearance', setPlayerAppearance); exp('setPedAppearance', setPedAppearance); -} - -init(); +})(); diff --git a/game/src/client/modules/customization/index.ts b/game/src/client/modules/customization/index.ts index 105b0ac..46fe7aa 100644 --- a/game/src/client/modules/customization/index.ts +++ b/game/src/client/modules/customization/index.ts @@ -536,6 +536,7 @@ function startPlayerCustomization( playerAppearance = getPedAppearance(playerPed); callback = cb; + _config.automaticFade = Boolean(Number(GetConvar('fivem-appearance:automaticFade', '1'))); config = _config; playerCoords = arrayToVector3(GetEntityCoords(playerPed, true)); diff --git a/game/src/client/types/index.d.ts b/game/src/client/types/index.d.ts index d182a18..a736de4 100644 --- a/game/src/client/types/index.d.ts +++ b/game/src/client/types/index.d.ts @@ -220,6 +220,7 @@ interface CustomizationConfig { components: boolean; props: boolean; tattoos: boolean; + automaticFade: boolean; } interface CameraState { diff --git a/locales/en.json b/locales/en.json index e1108ec..81507b1 100644 --- a/locales/en.json +++ b/locales/en.json @@ -80,7 +80,8 @@ "title": "Hair", "style": "Style", "color": "Color", - "highlight": "Highlight" + "highlight": "Highlight", + "fade": "Fade" }, "opacity": "Opacity", "style": "Style", diff --git a/locales/pt-BR.json b/locales/pt-BR.json index 76f0f35..fa28e0d 100644 --- a/locales/pt-BR.json +++ b/locales/pt-BR.json @@ -80,7 +80,8 @@ "title": "Cabelo", "style": "Estilo", "color": "Cor", - "highlight": "Reflexo" + "highlight": "Reflexo", + "fade": "Desvaneça" }, "opacity": "Opacidade", "style": "Estilo", diff --git a/tattoos.json b/tattoos.json index 314e249..2b54d16 100644 --- a/tattoos.json +++ b/tattoos.json @@ -5034,5 +5034,1015 @@ "zone": "ZONE_RIGHT_ARM", "collection": "multiplayer_overlays" } + ], + "ZONE_HAIR": [ + { + "name": "hair-0-186", + "label": "hair-0-186", + "hashMale": "FM_M_Hair_003_a", + "hashFemale": "FM_F_Hair_003_a", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-187", + "label": "hair-0-187", + "hashMale": "FM_M_Hair_003_b", + "hashFemale": "FM_F_Hair_003_b", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-188", + "label": "hair-0-188", + "hashMale": "FM_M_Hair_003_c", + "hashFemale": "FM_F_Hair_003_c", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-189", + "label": "hair-0-189", + "hashMale": "FM_M_Hair_003_d", + "hashFemale": "FM_F_Hair_003_d", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-190", + "label": "hair-0-190", + "hashMale": "FM_M_Hair_003_e", + "hashFemale": "FM_F_Hair_003_e", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-156", + "label": "hair-0-156", + "hashMale": "FM_M_Hair_005_a", + "hashFemale": "FM_F_Hair_005_a", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-157", + "label": "hair-0-157", + "hashMale": "FM_M_Hair_005_b", + "hashFemale": "FM_F_Hair_005_b", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-158", + "label": "hair-0-158", + "hashMale": "FM_M_Hair_005_c", + "hashFemale": "FM_F_Hair_005_c", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-159", + "label": "hair-0-159", + "hashMale": "FM_M_Hair_005_d", + "hashFemale": "FM_F_Hair_005_d", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-160", + "label": "hair-0-160", + "hashMale": "FM_M_Hair_005_e", + "hashFemale": "FM_F_Hair_005_e", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-191", + "label": "hair-0-191", + "hashMale": "FM_M_Hair_006_a", + "hashFemale": "FM_F_Hair_006_a", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-192", + "label": "hair-0-192", + "hashMale": "FM_M_Hair_006_b", + "hashFemale": "FM_F_Hair_006_b", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-193", + "label": "hair-0-193", + "hashMale": "FM_M_Hair_006_c", + "hashFemale": "FM_F_Hair_006_c", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-194", + "label": "hair-0-194", + "hashMale": "FM_M_Hair_006_d", + "hashFemale": "FM_F_Hair_006_d", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-195", + "label": "hair-0-195", + "hashMale": "FM_M_Hair_006_e", + "hashFemale": "FM_F_Hair_006_e", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-166", + "label": "hair-0-166", + "hashMale": "FM_M_Hair_013_a", + "hashFemale": "FM_F_Hair_013_a", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-167", + "label": "hair-0-167", + "hashMale": "FM_M_Hair_013_b", + "hashFemale": "FM_F_Hair_013_b", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-168", + "label": "hair-0-168", + "hashMale": "FM_M_Hair_013_c", + "hashFemale": "FM_F_Hair_013_c", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-169", + "label": "hair-0-169", + "hashMale": "FM_M_Hair_013_d", + "hashFemale": "FM_F_Hair_013_d", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-170", + "label": "hair-0-170", + "hashMale": "FM_M_Hair_013_e", + "hashFemale": "FM_F_Hair_013_e", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-171", + "label": "hair-0-171", + "hashMale": "FM_M_Hair_014_a", + "hashFemale": "FM_F_Hair_014_a", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-172", + "label": "hair-0-172", + "hashMale": "FM_M_Hair_014_b", + "hashFemale": "FM_F_Hair_014_b", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-173", + "label": "hair-0-173", + "hashMale": "FM_M_Hair_014_c", + "hashFemale": "FM_F_Hair_014_c", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-174", + "label": "hair-0-174", + "hashMale": "FM_M_Hair_014_d", + "hashFemale": "FM_F_Hair_014_d", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-175", + "label": "hair-0-175", + "hashMale": "FM_M_Hair_014_e", + "hashFemale": "FM_F_Hair_014_e", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-201", + "label": "hair-0-201", + "hashMale": "FM_M_Hair_long_a", + "hashFemale": "FM_F_Hair_long_a", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-202", + "label": "hair-0-202", + "hashMale": "FM_M_Hair_long_b", + "hashFemale": "FM_F_Hair_long_b", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-203", + "label": "hair-0-203", + "hashMale": "FM_M_Hair_long_c", + "hashFemale": "FM_F_Hair_long_c", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-204", + "label": "hair-0-204", + "hashMale": "FM_M_Hair_long_d", + "hashFemale": "FM_F_Hair_long_d", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-205", + "label": "hair-0-205", + "hashMale": "FM_M_Hair_long_e", + "hashFemale": "FM_F_Hair_long_e", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-181", + "label": "hair-0-181", + "hashMale": "FM_M_Hair_001_a", + "hashFemale": "FM_F_Hair_001_a", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-182", + "label": "hair-0-182", + "hashMale": "FM_M_Hair_001_b", + "hashFemale": "FM_F_Hair_001_b", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-183", + "label": "hair-0-183", + "hashMale": "FM_M_Hair_001_c", + "hashFemale": "FM_F_Hair_001_c", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-184", + "label": "hair-0-184", + "hashMale": "FM_M_Hair_001_d", + "hashFemale": "FM_F_Hair_001_d", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-185", + "label": "hair-0-185", + "hashMale": "FM_M_Hair_001_e", + "hashFemale": "FM_F_Hair_001_e", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-196", + "label": "hair-0-196", + "hashMale": "FM_M_Hair_008_a", + "hashFemale": "FM_F_Hair_008_a", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-197", + "label": "hair-0-197", + "hashMale": "FM_M_Hair_008_b", + "hashFemale": "FM_F_Hair_008_b", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-198", + "label": "hair-0-198", + "hashMale": "FM_M_Hair_008_c", + "hashFemale": "FM_F_Hair_008_c", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-199", + "label": "hair-0-199", + "hashMale": "FM_M_Hair_008_d", + "hashFemale": "FM_F_Hair_008_d", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-200", + "label": "hair-0-200", + "hashMale": "FM_M_Hair_008_e", + "hashFemale": "FM_F_Hair_008_e", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-304", + "label": "hair-0-304", + "hashMale": "NG_M_Hair_001", + "hashFemale": "NG_F_Hair_001", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-305", + "label": "hair-0-305", + "hashMale": "NG_M_Hair_002", + "hashFemale": "NG_F_Hair_002", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-306", + "label": "hair-0-306", + "hashMale": "NG_M_Hair_003", + "hashFemale": "NG_F_Hair_003", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-307", + "label": "hair-0-307", + "hashMale": "NG_M_Hair_004", + "hashFemale": "NG_F_Hair_004", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-308", + "label": "hair-0-308", + "hashMale": "NG_M_Hair_005", + "hashFemale": "NG_F_Hair_005", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-309", + "label": "hair-0-309", + "hashMale": "NG_M_Hair_006", + "hashFemale": "NG_F_Hair_006", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-310", + "label": "hair-0-310", + "hashMale": "NG_M_Hair_007", + "hashFemale": "NG_F_Hair_007", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-311", + "label": "hair-0-311", + "hashMale": "NG_M_Hair_008", + "hashFemale": "NG_F_Hair_008", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-312", + "label": "hair-0-312", + "hashMale": "NG_M_Hair_009", + "hashFemale": "NG_F_Hair_009", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-313", + "label": "hair-0-313", + "hashMale": "NG_M_Hair_010", + "hashFemale": "NG_F_Hair_010", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-314", + "label": "hair-0-314", + "hashMale": "NG_M_Hair_011", + "hashFemale": "NG_F_Hair_011", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-315", + "label": "hair-0-315", + "hashMale": "NG_M_Hair_012", + "hashFemale": "NG_F_Hair_012", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-316", + "label": "hair-0-316", + "hashMale": "NG_M_Hair_013", + "hashFemale": "NG_F_Hair_013", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-317", + "label": "hair-0-317", + "hashMale": "NG_M_Hair_014", + "hashFemale": "NG_F_Hair_014", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-318", + "label": "hair-0-318", + "hashMale": "NG_M_Hair_015", + "hashFemale": "NG_F_Hair_015", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-319", + "label": "hair-0-319", + "hashMale": "NGBea_M_Hair_000", + "hashFemale": "NGBea_F_Hair_000", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-320", + "label": "hair-0-320", + "hashMale": "NGBea_M_Hair_001", + "hashFemale": "NGBea_F_Hair_001", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-321", + "label": "hair-0-321", + "hashMale": "NGBus_M_Hair_000", + "hashFemale": "NGBus_F_Hair_000", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-322", + "label": "hair-0-322", + "hashMale": "NGBus_M_Hair_001", + "hashFemale": "NGBus_F_Hair_001", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-323", + "label": "hair-0-323", + "hashMale": "NGHip_M_Hair_000", + "hashFemale": "NGHip_F_Hair_000", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-324", + "label": "hair-0-324", + "hashMale": "NGHip_M_Hair_001", + "hashFemale": "NGHip_F_Hair_001", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-0-325", + "label": "hair-0-325", + "hashMale": "NGInd_M_Hair_000", + "hashFemale": "NGInd_F_Hair_000", + "zone": "ZONE_HAIR", + "collection": "multiplayer_overlays" + }, + { + "name": "hair-3-33", + "label": "hair-3-33", + "hashMale": "FM_Hair_Muzz", + "hashFemale": "FM_Hair_Fuzz", + "zone": "ZONE_HAIR", + "collection": "mpBeach_overlays" + }, + { + "name": "hair-4-30", + "label": "hair-4-30", + "hashMale": "FM_Bus_M_Hair_a", + "hashFemale": "FM_Bus_F_Hair_a", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-31", + "label": "hair-4-31", + "hashMale": "FM_Bus_M_Hair_b", + "hashFemale": "FM_Bus_F_Hair_b", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-32", + "label": "hair-4-32", + "hashMale": "FM_Bus_M_Hair_c", + "hashFemale": "FM_Bus_F_Hair_c", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-33", + "label": "hair-4-33", + "hashMale": "FM_Bus_M_Hair_d", + "hashFemale": "FM_Bus_F_Hair_d", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-34", + "label": "hair-4-34", + "hashMale": "FM_Bus_M_Hair_e", + "hashFemale": "FM_Bus_F_Hair_e", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-35", + "label": "hair-4-35", + "hashMale": "FM_Bus_M_Hair_000_a", + "hashFemale": "FM_Bus_F_Hair_000_a", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-36", + "label": "hair-4-36", + "hashMale": "FM_Bus_M_Hair_000_b", + "hashFemale": "FM_Bus_F_Hair_000_b", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-37", + "label": "hair-4-37", + "hashMale": "FM_Bus_M_Hair_000_c", + "hashFemale": "FM_Bus_F_Hair_000_c", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-38", + "label": "hair-4-38", + "hashMale": "FM_Bus_M_Hair_000_d", + "hashFemale": "FM_Bus_F_Hair_000_d", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-39", + "label": "hair-4-39", + "hashMale": "FM_Bus_M_Hair_000_e", + "hashFemale": "FM_Bus_F_Hair_000_e", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-40", + "label": "hair-4-40", + "hashMale": "FM_Bus_M_Hair_001_a", + "hashFemale": "FM_Bus_F_Hair_001_a", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-41", + "label": "hair-4-41", + "hashMale": "FM_Bus_M_Hair_001_b", + "hashFemale": "FM_Bus_F_Hair_001_b", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-42", + "label": "hair-4-42", + "hashMale": "FM_Bus_M_Hair_001_c", + "hashFemale": "FM_Bus_F_Hair_001_c", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-43", + "label": "hair-4-43", + "hashMale": "FM_Bus_M_Hair_001_d", + "hashFemale": "FM_Bus_F_Hair_001_d", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-4-44", + "label": "hair-4-44", + "hashMale": "FM_Bus_M_Hair_001_e", + "hashFemale": "FM_Bus_F_Hair_001_e", + "zone": "ZONE_HAIR", + "collection": "mpBusiness_overlays" + }, + { + "name": "hair-9-10", + "label": "hair-9-10", + "hashMale": "FM_Hip_M_Hair_000_a", + "hashFemale": "FM_Hip_F_Hair_000_a", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-11", + "label": "hair-9-11", + "hashMale": "FM_Hip_M_Hair_000_b", + "hashFemale": "FM_Hip_F_Hair_000_b", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-12", + "label": "hair-9-12", + "hashMale": "FM_Hip_M_Hair_000_c", + "hashFemale": "FM_Hip_F_Hair_000_c", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-13", + "label": "hair-9-13", + "hashMale": "FM_Hip_M_Hair_000_d", + "hashFemale": "FM_Hip_F_Hair_000_d", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-14", + "label": "hair-9-14", + "hashMale": "FM_Hip_M_Hair_000_e", + "hashFemale": "FM_Hip_F_Hair_000_e", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-5", + "label": "hair-9-5", + "hashMale": "FM_Hip_M_Hair_001_a", + "hashFemale": "FM_Hip_F_Hair_001_a", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-6", + "label": "hair-9-6", + "hashMale": "FM_Hip_M_Hair_001_b", + "hashFemale": "FM_Hip_F_Hair_001_b", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-7", + "label": "hair-9-7", + "hashMale": "FM_Hip_M_Hair_001_c", + "hashFemale": "FM_Hip_F_Hair_001_c", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-8", + "label": "hair-9-8", + "hashMale": "FM_Hip_M_Hair_001_d", + "hashFemale": "FM_Hip_F_Hair_001_d", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-9", + "label": "hair-9-9", + "hashMale": "FM_Hip_M_Hair_001_e", + "hashFemale": "FM_Hip_F_Hair_001_e", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-187", + "label": "hair-9-187", + "hashMale": "FM_M_Hair_017_a", + "hashFemale": "FM_F_Hair_017_a", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-188", + "label": "hair-9-188", + "hashMale": "FM_M_Hair_017_b", + "hashFemale": "FM_F_Hair_017_b", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-189", + "label": "hair-9-189", + "hashMale": "FM_M_Hair_017_c", + "hashFemale": "FM_F_Hair_017_c", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-190", + "label": "hair-9-190", + "hashMale": "FM_M_Hair_017_d", + "hashFemale": "FM_F_Hair_017_d", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-191", + "label": "hair-9-191", + "hashMale": "FM_M_Hair_017_e", + "hashFemale": "FM_F_Hair_017_e", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-192", + "label": "hair-9-192", + "hashMale": "FM_M_Hair_020_a", + "hashFemale": "FM_F_Hair_020_a", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-193", + "label": "hair-9-193", + "hashMale": "FM_M_Hair_020_b", + "hashFemale": "FM_F_Hair_020_b", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-194", + "label": "hair-9-194", + "hashMale": "FM_M_Hair_020_c", + "hashFemale": "FM_F_Hair_020_c", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-195", + "label": "hair-9-195", + "hashMale": "FM_M_Hair_020_d", + "hashFemale": "FM_F_Hair_020_d", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-196", + "label": "hair-9-196", + "hashMale": "FM_M_Hair_020_e", + "hashFemale": "FM_F_Hair_020_e", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-197", + "label": "hair-9-197", + "hashMale": "FM_Disc_M_Hair_001_a", + "hashFemale": "FM_Disc_F_Hair_001_a", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-198", + "label": "hair-9-198", + "hashMale": "FM_Disc_M_Hair_001_b", + "hashFemale": "FM_Disc_F_Hair_001_b", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-199", + "label": "hair-9-199", + "hashMale": "FM_Disc_M_Hair_001_c", + "hashFemale": "FM_Disc_F_Hair_001_c", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-200", + "label": "hair-9-200", + "hashMale": "FM_Disc_M_Hair_001_d", + "hashFemale": "FM_Disc_F_Hair_001_d", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-9-201", + "label": "hair-9-201", + "hashMale": "FM_Disc_M_Hair_001_e", + "hashFemale": "FM_Disc_F_Hair_001_e", + "zone": "ZONE_HAIR", + "collection": "mpHipster_overlays" + }, + { + "name": "hair-18-81", + "label": "hair-18-81", + "hashMale": "LR_M_Hair_000", + "hashFemale": "LR_F_Hair_000", + "zone": "ZONE_HAIR", + "collection": "mpLowrider_overlays" + }, + { + "name": "hair-18-82", + "label": "hair-18-82", + "hashMale": "LR_M_Hair_001", + "hashFemale": "LR_F_Hair_001", + "zone": "ZONE_HAIR", + "collection": "mpLowrider_overlays" + }, + { + "name": "hair-18-83", + "label": "hair-18-83", + "hashMale": "LR_M_Hair_002", + "hashFemale": "LR_F_Hair_002", + "zone": "ZONE_HAIR", + "collection": "mpLowrider_overlays" + }, + { + "name": "hair-19-88", + "label": "hair-19-88", + "hashMale": "LR_M_Hair_003", + "hashFemale": "LR_F_Hair_003", + "zone": "ZONE_HAIR", + "collection": "mpLowrider2_overlays" + }, + { + "name": "hair-19-91", + "label": "hair-19-91", + "hashMale": "LR_M_Hair_004", + "hashFemale": "LR_F_Hair_004", + "zone": "ZONE_HAIR", + "collection": "mpLowrider2_overlays" + }, + { + "name": "hair-19-93", + "label": "hair-19-93", + "hashMale": "LR_M_Hair_006", + "hashFemale": "LR_F_Hair_006", + "zone": "ZONE_HAIR", + "collection": "mpLowrider2_overlays" + }, + { + "name": "hair-19-92", + "label": "hair-19-92", + "hashMale": "LR_M_Hair_005", + "hashFemale": "LR_F_Hair_005", + "zone": "ZONE_HAIR", + "collection": "mpLowrider2_overlays" + }, + { + "name": "hair-24-5", + "label": "hair-24-5", + "hashMale": "MP_Biker_Hair_000_M", + "hashFemale": "MP_Biker_Hair_000_F", + "zone": "ZONE_HAIR", + "collection": "mpBiker_overlays" + }, + { + "name": "hair-24-7", + "label": "hair-24-7", + "hashMale": "MP_Biker_Hair_001_M", + "hashFemale": "MP_Biker_Hair_001_F", + "zone": "ZONE_HAIR", + "collection": "mpBiker_overlays" + }, + { + "name": "hair-24-9", + "label": "hair-24-9", + "hashMale": "MP_Biker_Hair_002_M", + "hashFemale": "MP_Biker_Hair_002_F", + "zone": "ZONE_HAIR", + "collection": "mpBiker_overlays" + }, + { + "name": "hair-24-11", + "label": "hair-24-11", + "hashMale": "MP_Biker_Hair_003_M", + "hashFemale": "MP_Biker_Hair_003_F", + "zone": "ZONE_HAIR", + "collection": "mpBiker_overlays" + }, + { + "name": "hair-24-13", + "label": "hair-24-13", + "hashMale": "MP_Biker_Hair_004_M", + "hashFemale": "MP_Biker_Hair_004_F", + "zone": "ZONE_HAIR", + "collection": "mpBiker_overlays" + }, + { + "name": "hair-24-15", + "label": "hair-24-15", + "hashMale": "MP_Biker_Hair_005_M", + "hashFemale": "MP_Biker_Hair_005_F", + "zone": "ZONE_HAIR", + "collection": "mpBiker_overlays" + }, + { + "name": "hair-24-17", + "label": "hair-24-17", + "hashMale": "MP_Biker_Hair_006_M", + "hashFemale": "MP_Biker_Hair_006_F", + "zone": "ZONE_HAIR", + "collection": "mpBiker_overlays" + }, + { + "name": "hair-25-52", + "label": "hair-25-52", + "hashMale": "MP_Gunrunning_Hair_M_000_M", + "hashFemale": "MP_Gunrunning_Hair_F_000_M", + "zone": "ZONE_HAIR", + "collection": "mpGunrunning_overlays" + }, + { + "name": "hair-25-53", + "label": "hair-25-53", + "hashMale": "MP_Gunrunning_Hair_M_001_M", + "hashFemale": "MP_Gunrunning_Hair_F_001_M", + "zone": "ZONE_HAIR", + "collection": "mpGunrunning_overlays" + }, + { + "name": "hair-25-54", + "label": "hair-25-54", + "hashMale": "MP_Gunrunning_Hair_M_000_F", + "hashFemale": "MP_Gunrunning_Hair_F_000_F", + "zone": "ZONE_HAIR", + "collection": "mpGunrunning_overlays" + }, + { + "name": "hair-25-55", + "label": "hair-25-55", + "hashMale": "MP_Gunrunning_Hair_M_001_F", + "hashFemale": "MP_Gunrunning_Hair_F_001_F", + "zone": "ZONE_HAIR", + "collection": "mpGunrunning_overlays" + }, + { + "name": "hair-29-0", + "label": "hair-29-0", + "hashMale": "MP_Vinewood_Hair_M_000_M", + "hashFemale": "MP_Vinewood_Hair_F_000_M", + "zone": "ZONE_HAIR", + "collection": "mpVinewood_overlays" + }, + { + "name": "hair-29-1", + "label": "hair-29-1", + "hashMale": "MP_Vinewood_Hair_M_000_F", + "hashFemale": "MP_Vinewood_Hair_F_000_F", + "zone": "ZONE_HAIR", + "collection": "mpVinewood_overlays" + }, + { + "name": "hair-31-0", + "label": "hair-31-0", + "hashMale": "MP_Tuner_Hair_000_M", + "hashFemale": "MP_Tuner_Hair_000_F", + "zone": "ZONE_HAIR", + "collection": "mpTuner_overlays" + }, + { + "name": "hair-31-1", + "label": "hair-31-1", + "hashMale": "MP_Tuner_Hair_001_M", + "hashFemale": "MP_Tuner_Hair_001_F", + "zone": "ZONE_HAIR", + "collection": "mpTuner_overlays" + }, + { + "name": "hair-32-4", + "label": "hair-32-4", + "hashMale": "MP_Security_Hair_000_M", + "hashFemale": "MP_Security_Hair_000_F", + "zone": "ZONE_HAIR", + "collection": "mpSecurity_overlays" + } ] } \ No newline at end of file diff --git a/web/src/components/Appearance/HeadOverlays.tsx b/web/src/components/Appearance/HeadOverlays.tsx index 2b922f0..d6e3928 100644 --- a/web/src/components/Appearance/HeadOverlays.tsx +++ b/web/src/components/Appearance/HeadOverlays.tsx @@ -13,27 +13,34 @@ import { PedHair, PedHeadOverlays, PedHeadOverlayValue, + Tattoo } from './interfaces'; +import { useCallback } from 'react'; interface HeadOverlaysProps { settings: { hair: HairSettings; headOverlays: HeadOverlaysSettings; eyeColor: EyeColorSettings; + fade: Tattoo[]; }; storedData: { hair: PedHair; headOverlays: PedHeadOverlays; eyeColor: number; + fade: Tattoo | null; }; data: { hair: PedHair; headOverlays: PedHeadOverlays; eyeColor: number; + fade: Tattoo | null; }; handleHairChange: (key: keyof PedHair, value: number) => void; handleHeadOverlayChange: (key: keyof PedHeadOverlays, option: keyof PedHeadOverlayValue, value: number) => void; handleEyeColorChange: (value: number) => void; + handleChangeFade: (value: number) => void; + automaticFade: boolean; } const HeadOverlays = ({ @@ -42,7 +49,9 @@ const HeadOverlays = ({ data, handleHairChange, handleHeadOverlayChange, - handleEyeColorChange, + handleEyeColorChange, + handleChangeFade, + automaticFade }: HeadOverlaysProps) => { const { locales } = useNuiState(); @@ -50,6 +59,18 @@ const HeadOverlays = ({ return null; } + const fadeValue = useCallback(() => { + const indexFade = settings?.fade?.findIndex(tattoo => tattoo.name === data.fade?.name) + + return indexFade >= 0 ? indexFade : 0 + }, [data.fade?.name])() + + const storedFadeValue = useCallback(() => { + const indexFade = settings?.fade?.findIndex(tattoo => tattoo.name === storedData.fade?.name) + + return indexFade >= 0 ? indexFade : 0 + }, [storedData.fade?.name])() + return (
@@ -61,6 +82,14 @@ const HeadOverlays = ({ clientValue={storedData.hair.style} onChange={value => handleHairChange('style', value)} /> + {!automaticFade && handleChangeFade(value)} + />} {keys.map(key => ( + key !== 'ZONE_HAIR' + && { [data, setData], ); + const handleChangeFade = useCallback(async (value: number) => { + if (!data || !appearanceSettings) return; + const { tattoos } = data; + const updatedTattoos = { ...tattoos }; + const tattoo = appearanceSettings.tattoos.items['ZONE_HAIR'][value] + if (!updatedTattoos[tattoo.zone]) updatedTattoos[tattoo.zone] = []; + updatedTattoos[tattoo.zone] = [tattoo]; + await Nui.post('appearance_apply_tattoo', updatedTattoos); + setData({ ...data, tattoos: updatedTattoos }); + }, [appearanceSettings, data, setData]) + const handleHeadOverlayChange = useCallback( (key: keyof PedHeadOverlays, option: keyof PedHeadOverlayValue, value: number) => { if (!data) return; @@ -510,20 +521,25 @@ const Appearance = () => { hair: appearanceSettings.hair, headOverlays: appearanceSettings.headOverlays, eyeColor: appearanceSettings.eyeColor, + fade: appearanceSettings.tattoos.items['ZONE_HAIR'] }} storedData={{ hair: storedData.hair, headOverlays: storedData.headOverlays, eyeColor: storedData.eyeColor, + fade: storedData.tattoos?.ZONE_HAIR?.length > 0 ? storedData.tattoos.ZONE_HAIR[0] : null }} data={{ hair: data.hair, headOverlays: data.headOverlays, eyeColor: data.eyeColor, + fade: data.tattoos?.ZONE_HAIR?.length > 0 ? data.tattoos.ZONE_HAIR[0] : null }} handleHairChange={handleHairChange} handleHeadOverlayChange={handleHeadOverlayChange} handleEyeColorChange={handleEyeColorChange} + handleChangeFade={handleChangeFade} + automaticFade={config.automaticFade} /> )} diff --git a/web/src/components/Appearance/interfaces.ts b/web/src/components/Appearance/interfaces.ts index 907f2ec..5a8a945 100644 --- a/web/src/components/Appearance/interfaces.ts +++ b/web/src/components/Appearance/interfaces.ts @@ -203,6 +203,7 @@ export interface CustomizationConfig { components: boolean; props: boolean; tattoos: boolean; + automaticFade: boolean; } export interface CameraState { diff --git a/web/src/shared/interfaces/locales.ts b/web/src/shared/interfaces/locales.ts index 45c70f9..bfc5935 100644 --- a/web/src/shared/interfaces/locales.ts +++ b/web/src/shared/interfaces/locales.ts @@ -81,6 +81,7 @@ export default interface Locales { style: string; color: string; highlight: string; + fade: string; }; opacity: string; style: string;