[release] fivem-appearance

The change of work clothes does not work for me, do I have to modify something?

1 Like

how to set clothe buy via money ?

Yeah same any fix for it?

how can I make the player pay for clothes in the clotheshop?

For you that still have errors in changing into work clothes, hereā€™s what Iā€™ve found.

Dependency
Notes
  1. I completely get rid of skinchanger and esx_skin
  2. Skin doesnā€™t work with work clothes that comes when you first import SQL from esx_jobs. You need to replace all the skins with fivem-appearance skin format. How do you do that? Easy, first, you save the clothes via Clothing Store or using export startPlayerCustomization. Second is easier using cd_devtools which you can easily copy the skin data, use the example given from the docs
  3. Tested with esx_jobs, esx_ambulancejob, and esx_mechanicjob working fine with changing citizen clothes and work clothes. It really doesnā€™t matter what job because most of them usually use the same method to change clothes (Step to Fix, step number 2)
Step to Fix
  1. Open ox_appearance/server/esx.lua and search for esx_skin:getPlayerSkin and replace with:
ESX.RegisterServerCallback('esx_skin:getPlayerSkin', function(source, cb)
    local xPlayer = ESX.GetPlayerFromId(source)

    local jobSkin = {
        skin_male   = xPlayer.job.skin_male,
        skin_female = xPlayer.job.skin_female
    }
    
    local identifier = Players[source]
    local appearance = MySQL.scalar.await('SELECT skin FROM users WHERE identifier = ?', { identifier })
    cb((appearance and json.decode(appearance)), jobSkin or {})
end)
  1. Here I will take an example on esx_jobs. Open esx_jobs/client/main.lua and search for:
if skin.sex == 0 then
    if ESX.Table.SizeOf(jobSkin.skin_male) >= 1 then
        TriggerEvent("skinchanger:loadClothes", skin, jobSkin.skin_male)
    else
        ESX.ShowNotification("Work", _U("no_male_clothing"), "error")
    end
else
    if ESX.Table.SizeOf(jobSkin.skin_female) >= 1 then
        TriggerEvent("skinchanger:loadClothes", skin, jobSkin.skin_female)
    else
        ESX.ShowNotification("Work", _U("no_female_clothing"), "error")
    end
end

and replace with

if skin.model == "mp_m_freemode_01" then
    if ESX.Table.SizeOf(jobSkin.skin_male) >= 1 then
        TriggerEvent("skinchanger:loadSkin", jobSkin.skin_male)
    else
        ESX.ShowNotification("Work", _U("no_male_clothing"), "error")
    end
else
    if ESX.Table.SizeOf(jobSkin.skin_female) >= 1 then
        TriggerEvent("skinchanger:loadSkin", jobSkin.skin_female)
    else
        ESX.ShowNotification("Work", _U("no_female_clothing"), "error")
    end
end
Skin Format

Here I give you a visualization to see the difference between the skin format fivem-appearance and with regular skin format:
fivem-appearance
unknown (2)
regular skin format

This is not a complicated task, read carefully and make sure you donā€™t miss anything. I hope this fixes your issue. Also, Iā€™d love to know otherā€™s solutions for this too!

2 Likes

is there anyone that can help me set this up as im more a visual learner

So using c# here and on the

Exports[ā€œfivem-appearanceā€].startPlayerCustomization(new Action(async (appearance) => ā€¦

I am not sure what ā€œappearanceā€ datatype is here. Object works but I canā€™t deserialize it. Is there a structure listed somewhere or something?

Actually, I was able to serialize it to a string and get the json structure. I had everything right on except tattoos has a different structure. I donā€™t know if it changed somewhere along the way or what.

I put them in and they do not show up, is there something else I need to do im trying to add the criminal enterprise tattoos as fivem does not update

Does anyone know how to make it so ped models that arent freemode can change hair options in fivem-appearance?

How add payment system when using the clotheshop?
Thanks

Is there any option to remove ā€œglassesā€ and ā€œhatsā€ from props and add them to components? Because I would like to add an Jewelry shop with only chains, watches and earrings.

1 Like

You can now find the fivem-appearance documentation at Fivepunchā€™s resource documentation. A rewrite is planned to match the docs format.

3 Likes

canā€™t save outfits

use QB: SaveSkin() - not work

use example:

TriggerServerEvent(ā€˜saveCharacterCustomizationā€™, JSON.encode(appearance))

Itā€™s lowercase - json not JSON.

1 Like

and still not save (table not update)

qb-clothing\client\main.lua

RegisterCommand(ā€˜customizationā€™, function()

local config = {
ped = true,
headBlend = true,
faceFeatures = true,
headOverlays = true,
components = true,
props = true,
tattoos = true
}

exports[ā€˜fivem-appearanceā€™]:startPlayerCustomization(function (appearance)
if (appearance) then
TriggerServerEvent(ā€˜saveCharacterCustomizationā€™, json.encode(appearance))
end
end, config)

end, false)

RegisterNetEvent(ā€˜loadCharacterAppearanceā€™)
AddEventHandler(ā€˜loadCharacterAppearanceā€™, function (encodedAppearance)
local appearance = json.decode(encodedAppearance)
exports[ā€˜fivem-appearanceā€™]:setPlayerAppearance(appearance)
end)

my script wont work at at im conused on to set it it up correctly to get it to work

Hi, I wanted to make some changes to the UI of the clothing menu, I downloaded the source code and tried installing the dependencies but I keep encountering errors

GTAO Multicharacter now supports fivem-appearance.

2 Likes