# cui\_character

{% hint style="danger" %}
Adding new fonts is recommended ONLY for experienced developers!
{% endhint %}

### cui\_character

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

**server/main.lua**

```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**

```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)
```

```lua
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 :)**

{% embed url="<https://github.com/Xogy/cui_character>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.rcore.cz/paid-resources/rcore_clothing/rcore_clothes/cui_character.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
