– Documentation:
Models: mp_f_freemode_01 / mp_m_freemode_01
- SetPedHeadBlendData - FiveM Natives @ Cfx.re Docs – This is for heritage.
- SetPedHeadOverlay - FiveM Natives @ Cfx.re Docs – Still related to the “head” (more like…base character.) You can use this to change the hair, chest hair, makeup, complexions, etc.
- SetPedHeadOverlayColor - FiveM Natives @ Cfx.re Docs --Change color for eyebrows, hair, chest hair…almost anything that can be added using HeadOverlay.
- SetPedHairColor - FiveM Natives @ Cfx.re Docs – Hair color. I think this works better for hair than OverlayColor, but I haven’t used it.
- SetPedFaceFeature - FiveM Natives @ Cfx.re Docs – Haven’t used it yet. It’s most likely used for the for the nose length, eye “gap” and things like that.
- SetPedComponentVariation - FiveM Natives @ Cfx.re Docs – This is what you will use for the clothes. Keep in mind that, at least the vanilla GTA clothes, the ID is NOT THE SAME FOR PED_MALE AND PED_FEMALE.
- SetPedPropIndex - FiveM Natives @ Cfx.re Docs – Second part for the clothes. Hats, glasses, things like that. Again, the IDs are NOT the same for male and female peds.
Ped components: https://wiki.■■■■■■■■■■■/index.php?title=Character_Components (FiveM docs doesn’t have a ped components page…yet!)
– Implementation:
For my server, I used warmenu as the menu framework for the character creation. Not the best choice but it does the job really well. Although Rage:UI is more appropriate for this job.
I use an array to store all the players variables, something like this:
clientPlayerChar = {
['model'] = "mp_m_freemode_01",
['sex'] = "M", --sometimes
['blend'] = {motherID = 21, fatherID = 0, shapeMix = 1.0, skinMix = 1.0}, --PedHeadBlendData
['blend2'] = {blemishes = 255, age = 255, makeup = 255, blush = 255, lipstick = 255, freckles = 255}, --PedHeadOverlay
['hair'] = {name = "default_hair", hair = 1, facialHair = 255, eyeHair = 1, chestHair = 255, hairCol = 0},
['top'] = {name = "default_top", dr1 = 0,tx1 = 0,dr2 = 0,tx2 = 0,dr3 = 0,tx3 = 1},
['pant'] = {name = "default_pant", dr1 = 4, tx1 = 2},
['shoe'] = {name = "default_shoe", dr1 = 4, tx1 = 0},
['mask'] = {name = "default_mask", dr1 = 0, tx1 = 0},
['hat'] = {name = "default_hat", dr1 = 0, tx1 = 0},
['glasses'] = {name = "default_glasses", dr1 = 0, tx1 = 0},
['ears'] = {name = "default_earpiece", dr1 = 0, tx1 = 0},
['watch'] = {name = "default_watch", dr1 = 0, tx1 = 0},
['bracelet'] = {name = "default_bracelet", dr1 = 0, tx1 = 0},
}
And whenever I have to generate the players character, I use this monstrosity of a function: (Note: don’t try this at home)
function providePlayerCharacter()
RequestModel(clientPlayerChar['model'])
while not HasModelLoaded(clientPlayerChar['model']) do
RequestModel(clientPlayerChar['model'])
Wait(0)
end
SetPlayerModel(PlayerId(), clientPlayerChar['model'])
SetModelAsNoLongerNeeded(clientPlayerChar['model'])
local ped = PlayerPedId()
SetPedHeadBlendData(PlayerPedId(), clientPlayerChar['blend'].motherID, clientPlayerChar['blend'].fatherID, 0, clientPlayerChar['blend'].motherID, clientPlayerChar['blend'].fatherID, 0, clientPlayerChar['blend'].shapeMix, clientPlayerChar['blend'].skinMix, 0.0, false)
SetPedHeadOverlay(ped, 1, clientPlayerChar['hair'].facialHair, 1.0) --facHair
SetPedHeadOverlay(ped, 2, clientPlayerChar['hair'].eyeHair, 1.0) --eyeHair
SetPedHeadOverlay(ped, 3, clientPlayerChar['blend2'].age, 1.0) --age
SetPedHeadOverlay(ped, 4, clientPlayerChar['blend2'].makeup, 1.0) --makeup
SetPedHeadOverlay(ped, 5, clientPlayerChar['blend2'].blush, 1.0) --blush
SetPedHeadOverlay(ped, 8, clientPlayerChar['blend2'].lipstick, 1.0) --lipstick
SetPedHeadOverlay(ped, 9, clientPlayerChar['blend2'].freckles, 1.0) --freckles
SetPedHeadOverlay(ped, 10, clientPlayerChar['hair'].chestHair, 1.0) --chestHair
SetPedHeadOverlayColor(ped, 1, 1, clientPlayerChar['hair'].hairCol, clientPlayerChar['hair'].hairCol)
SetPedHeadOverlayColor(ped, 2, 1, clientPlayerChar['hair'].hairCol, clientPlayerChar['hair'].hairCol)
SetPedHeadOverlayColor(ped, 10, 1, clientPlayerChar['hair'].hairCol, clientPlayerChar['hair'].hairCol)
SetPedHairColor(ped, clientPlayerChar['hair'].hairCol, clientPlayerChar['hair'].hairCol)
SetPedComponentVariation(ped, 1, clientPlayerChar['mask'].dr1, clientPlayerChar['mask'].tx1, 1)
SetPedComponentVariation(ped, 2, clientPlayerChar['hair'].hair, 0, 1)
SetPedComponentVariation(ped, 3, clientPlayerChar['top'].dr1, clientPlayerChar['top'].tx1, 1)
SetPedComponentVariation(ped, 4, clientPlayerChar['pant'].dr1, clientPlayerChar['pant'].tx1, 1)
SetPedComponentVariation(ped, 6, clientPlayerChar['shoe'].dr1, clientPlayerChar['shoe'].tx1, 1)
if clientPlayerStats.rank >= 2 then
SetPedComponentVariation(ped, 7, clientClothesIndex[clientPlayerChar['sex']]['admin'][1].dr1, 0, 1) --IAA badge
end
SetPedComponentVariation(ped, 8, clientPlayerChar['top'].dr2, clientPlayerChar['top'].tx2, 1)
if clientPlayerStats.factionID == 1 and clientPlayerStats.rank < 2 then
SetPedComponentVariation(ped, 9, 53, 0, 1) --FIB badge
end
SetPedComponentVariation(ped, 11, clientPlayerChar['top'].dr3, clientPlayerChar['top'].tx3, 1)
if clientPlayerClothes.hatid > 1 then
SetPedPropIndex(ped, 0, clientPlayerChar['hat'].dr1, clientPlayerChar['hat'].tx1, 1)
else
ClearPedProp(ped, 0)
end
if clientPlayerClothes.glassesid > 1 then
SetPedPropIndex(ped, 1, clientPlayerChar['glasses'].dr1, clientPlayerChar['glasses'].tx1, 1)
else
ClearPedProp(ped, 1)
end
if clientPlayerClothes.earsid > 1 then
SetPedPropIndex(ped, 2, clientPlayerChar['ears'].dr1, clientPlayerChar['ears'].tx1, 1)
else
ClearPedProp(ped, 2)
end
if clientPlayerClothes.watchid > 1 then
SetPedPropIndex(ped, 3, clientPlayerChar['watch'].dr1, clientPlayerChar['watch'].tx1, 1)
else
ClearPedProp(ped, 3)
end
if clientPlayerClothes.braceletid > 1 then
SetPedPropIndex(ped, 4, clientPlayerChar['bracelet'].dr1, clientPlayerChar['bracelet'].tx1, 1)
else
ClearPedProp(ped, 4)
end
end
function setPlayerClothes()
local ped = PlayerPedId()
SetPedComponentVariation(ped, 3, clientPlayerChar['top'].dr1, clientPlayerChar['top'].tx1, 1)
SetPedComponentVariation(ped, 4, clientPlayerChar['pant'].dr1, clientPlayerChar['pant'].tx1, 1)
SetPedComponentVariation(ped, 6, clientPlayerChar['shoe'].dr1, clientPlayerChar['shoe'].tx1, 1)
SetPedComponentVariation(ped, 8, clientPlayerChar['top'].dr2, clientPlayerChar['top'].tx2, 1)
SetPedComponentVariation(ped, 11, clientPlayerChar['top'].dr3, clientPlayerChar['top'].tx3, 1)
SetPedComponentVariation(ped, 1, clientPlayerChar['mask'].dr1, clientPlayerChar['mask'].tx1, 1)
SetPedComponentVariation(ped, 2, clientPlayerChar['hair'].hair, 0, 1)
SetPedHeadOverlay(ped, 1, clientPlayerChar['hair'].facialHair, 1.0) --facHair
SetPedHeadOverlay(ped, 2, clientPlayerChar['hair'].eyeHair, 1.0) --eyeHair
SetPedHeadOverlay(ped, 10, clientPlayerChar['hair'].chestHair, 1.0) --eyeHair
SetPedHeadOverlayColor(ped, 1, 1, clientPlayerChar['hair'].hairCol, clientPlayerChar['hair'].hairCol)
SetPedHeadOverlayColor(ped, 2, 1, clientPlayerChar['hair'].hairCol, clientPlayerChar['hair'].hairCol)
SetPedHeadOverlayColor(ped, 10, 1, clientPlayerChar['hair'].hairCol, clientPlayerChar['hair'].hairCol)
if clientPlayerClothes.hatid > 1 then
SetPedPropIndex(ped, 0, clientPlayerChar['hat'].dr1, clientPlayerChar['hat'].tx1, 1)
else
ClearPedProp(PlayerPedId(), 0)
end
if clientPlayerClothes.glassesid > 1 then
SetPedPropIndex(ped, 1, clientPlayerChar['glasses'].dr1, clientPlayerChar['glasses'].tx1, 1)
else
ClearPedProp(PlayerPedId(), 1)
end
if clientPlayerClothes.earsid > 1 then
SetPedPropIndex(ped, 2, clientPlayerChar['ears'].dr1, clientPlayerChar['ears'].tx1, 1)
else
ClearPedProp(PlayerPedId(), 2)
end
if clientPlayerClothes.watchid > 1 then
SetPedPropIndex(ped, 3, clientPlayerChar['watch'].dr1, clientPlayerChar['watch'].tx1, 1)
else
ClearPedProp(PlayerPedId(), 3)
end
if clientPlayerClothes.braceletid > 1 then
SetPedPropIndex(ped, 4, clientPlayerChar['bracelet'].dr1, clientPlayerChar['bracelet'].tx1, 1)
else
ClearPedProp(PlayerPedId(), 4)
end
end
Note: On my implementation: The “top” part is used as one piece, but the ped hands, shirt and “undershirt” are 3 different and independent components. You kinda have to make sure that they match, or you will have different pieces of clothing clipping through each other, or invisible hands / clipping hands.
– Final thought:
Good luck.