cui_character

Adding new fonts is recommended ONLY for experienced developers!

cui_character

cui_character have troubles with skinchanger bridge, which is why you may need to do following changes.

server/main.lua

    RegisterServerEvent('esx_skin:save')
    AddEventHandler('esx_skin:save', function(data)
        charSave(data, source)
    end)

    RegisterServerEvent('cui_character:save')
    AddEventHandler('cui_character:save', function(data)
        charSave(data, source)
    end)

    function charSave(data, Source)
        local xPlayer = ESX.GetPlayerFromId(Source)

        if ESX.GetConfig and ESX.GetConfig().Multichar and xPlayer == nil then
            charSkins[Source] = data
            return
        else
            charSkins[Source] = nil
        end

        MySQL.ready(function()
            MySQL.Async.execute('UPDATE users SET skin = @data WHERE identifier = @identifier', {
                ['@data'] = json.encode(data),
                ['@identifier'] = xPlayer.identifier
            })
        end)
    end

client/main.lua

RegisterNetEvent('skinchanger:loadSkin')
AddEventHandler('skinchanger:loadSkin', function(skin, cb)
    local newSkin = GetDefaultCharacter(skin.sex == 0)

    for key, value in pairs(currentChar) do
        if newSkin[key] then
            newSkin[key] = value
        end
    end

    for key, value in pairs(skin) do
        if newSkin[key] then
            newSkin[key] = value
        end
    end

    UpdateClothes(newSkin)
    LoadCharacter(newSkin, cb)
end)
function LoadModel(hash)
    isModelLoaded = false
    local playerPed = PlayerPedId()

    if GetEntityModel(playerPed) == hash then
        isModelLoaded = true
        return
    end

    SetEntityInvincible(playerPed, true)

    if IsModelInCdimage(hash) and IsModelValid(hash) then
        RequestModel(hash)
        while not HasModelLoaded(hash) do
            Citizen.Wait(0)
        end
        SetPlayerModel(PlayerId(), hash)
        FreezePedCameraRotation(playerPed, true)
    end
    SetEntityInvincible(playerPed, false)

    isModelLoaded = true
    if not Config.StandAlone then
        TriggerEvent('skinchanger:modelLoaded')
    end
end

There are another ways around it, you can get a pre-done version :)

Last updated