> For the complete documentation index, see [llms.txt](https://documentation.rcore.cz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.rcore.cz/paid-resources/rcore_clothing/integration/okok_multichar.md).

# okok\_multichar

Integration guide for `okok_multichar`.

***

## Step 0 - ESX only (optional)

In `es_extended/config.lua`, set:

```lua
Config.Multichar = true
```

Instead of `Config.Multichar = GetResourceState("esx_multicharacter") ~= "missing"`.

***

## Step 1 - Replace `cl_utils.lua`

Replace the entire contents of `cl_utils.lua` with:

```lua
ESX = exports.es_extended:getSharedObject()

RegisterNetEvent(Config.EventPrefix..":notification")
AddEventHandler(Config.EventPrefix..":notification", function(title, text, type, time)
    if Config.UseOkokNotify then
        exports['okokNotify']:Alert(title, text, time, type)
    else
        ESX.ShowNotification(text)
    end
end)

RegisterNetEvent(Config.EventPrefix..":onCharacterSpawn")
AddEventHandler(Config.EventPrefix..":onCharacterSpawn", function()
end)

RegisterNetEvent(Config.EventPrefix..":characterFirstSpawn")
AddEventHandler(Config.EventPrefix..":characterFirstSpawn", function()
    TriggerServerEvent(Config.EventPrefix..":setWorld", 0)

    if Config.ClothingSystem == 'fivem-appearance' then
        exports['fivem-appearance']:startPlayerCustomization(function (appearance)
            if (appearance) then
                TriggerServerEvent('saveCharacterCustomization', JSON.encode(appearance))
            end
        end)
    elseif Config.ClothingSystem == 'illenium-appearance' then
        TriggerEvent('esx_skin:openSaveableMenu')
    elseif Config.ClothingSystem == 'rcore_clothing' then
        TriggerEvent('esx_skin:openSaveableMenu')
    end
end)

RegisterNetEvent(Config.EventPrefix..":loadCharacterClothing")
AddEventHandler(Config.EventPrefix..":loadCharacterClothing", function(skin, ped)
    if Config.ClothingSystem == 'illenium-appearance' then
        exports.rcore_clothing:setPedSkin(ped, skin)
    elseif Config.ClothingSystem == 'fivem-appearance' then
        exports['fivem-appearance']:setPedAppearance(ped, skin)
    elseif Config.ClothingSystem == 'rcore_clothing' then
        exports.rcore_clothing:setPedSkin(ped, skin)
    end
end)

RegisterNetEvent(Config.EventPrefix..":openSpawnSelection")
AddEventHandler(Config.EventPrefix..":openSpawnSelection", function(newChar, charinfo)
    TriggerServerEvent(Config.EventPrefix..":setWorld", 0)

    if Config.UseOkokSpawnSelector then
        TriggerEvent('okokSpawnSelector:spawnMenu', newChar, charinfo)
    end
end)
```

***

## Step 2 - Replace `sv_utils.lua`

Replace the entire contents of `sv_utils.lua` with:

```lua
ESX = exports.es_extended:getSharedObject()
Webhook = ''

function MySQLexecute(query, values, func)
    return MySQL.Sync.fetchAll(query, values, func)
end

function MySQLinsert(query, values, func)
    return MySQL.Async.insert(query, values, func)
end

function initialItemsInfo(Player)
end

function deleteCharacter(citizenid)
end

lib.callback.register(Config.EventPrefix..":GetSkin", function(source, citizenid)
    if Config.ClothingSystem == 'rcore_clothing' then
        local skin = exports.rcore_clothing:getSkinByIdentifier(citizenid)
        if not skin then
            return false
        end
        return skin.ped_model, skin.skin
    end

    local identifier = GetIdentifier(source)
    local result = MySQLexecute('SELECT * FROM users WHERE identifier LIKE @citizenid', {['@citizenid'] = citizenid})
    if result[1] ~= nil then
        local model = json.decode(result[1].model)
        if model then return model.model, result[1].skin else return 'mp_m_freemode_01', result[1].skin end
    else
        return false
    end
end)
```
