For you that still have errors in changing into work clothes, here’s what I’ve found.
Dependency
Notes
- I completely get rid of skinchanger and esx_skin
- 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 - 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
- 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)
- 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
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!