> For the complete documentation index, see [llms.txt](https://docs.ak4y.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ak4y.com/scripts/ak4y-multicharacter-v2/editable-files/cl_utils.lua.md).

# cl\_utils.lua

```lua
local jobEvent = "QBCore:Client:OnJobUpdate" --
local loadEvent = "QBCore:Client:OnPlayerLoaded"

CreateThread(function()
    if GetResourceState("qbx_core") == "started" then
        jobEvent = "QBCore:Client:OnJobUpdate"
        loadEvent = "QBCore:Client:OnPlayerLoaded"
    elseif GetResourceState("es_extended") == "started" then
        jobEvent = "esx:setJob"
        loadEvent = 'esx:playerLoaded'
    elseif GetResourceState("qb-core") == "started" then
        jobEvent = "QBCore:Client:OnJobUpdate"
        loadEvent = "QBCore:Client:OnPlayerLoaded"
    end

    RegisterNetEvent(loadEvent, function()
        PlayerLoaded()
    end)
end)

function SetSkin(cid)
    local skindata = CORE:Trigger('ak4y-multicharacter-v2:GetSkinData', cid)
    skindata = skindata[1]
    if skindata then
        if skindata.model then
            local modelHash = joaat(skindata.model)
            RequestModel(modelHash)
            while not HasModelLoaded(modelHash) do
                Wait(50)
            end
            SetPlayerModel(PlayerId(), modelHash)

            SetPedHeadBlendData(PlayerPedId(), 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, false)

            if skindata.model == "mp_m_freemode_01" or skindata.model == "mp_f_freemode_01" then
                if skindata.skin then
                    exports['illenium-appearance']:setPlayerAppearance(json.decode(skindata.skin))
                end
            end
        end
    else
        print("Skin data bulunamadı: " .. cid)
    end
    Wait(300)
    local newData = CORE:Trigger('ak4y-multicharacter-v2:GetAnso', cid)
    if newData then
        local anso = json.decode(newData.anso)
        local animData = Config.Animations[anso.anim + 1]
        SendNUIMessage({
            action = "playSound",
            sound = anso.sound,
        })
        print("oynatılan", animData.label)
        if animData then
            RequestAnimDict(animData.dict)
            while not HasAnimDictLoaded(animData.dict) do
                Wait(10)
            end
            TaskPlayAnim(PlayerPedId(), animData.dict, animData.anim, 8.0, -8.0, animData.duration, 49, 0, false, false, false)
        else
            print("anim data not found")
        end
    end
end
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.ak4y.com/scripts/ak4y-multicharacter-v2/editable-files/cl_utils.lua.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.
