esx_multicharacter

  1. Open @esx_multicharacter/client/main.lua

  2. Search for esx:playerLoaded

  3. Replace the trigger with this one below

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(playerData, isNew, skin)
    local spawn = playerData.coords or Config.Spawn
    if isNew or not skin or #skin == 1 then
        local finished = false
        skin = Config.Default[playerData.sex]
        skin.sex = playerData.sex == "m" and 0 or 1
        local model = skin.sex == 0 and mp_m_freemode_01 or mp_f_freemode_01
        RequestModel(model)
        while not HasModelLoaded(model) do
            RequestModel(model)
            Wait(0)
        end
        SetPlayerModel(PlayerId(), model)
        SetModelAsNoLongerNeeded(model)
        TriggerEvent('skinchanger:loadSkin', skin, function()
            local playerPed = PlayerPedId()
            SetPedAoBlobRendering(playerPed, true)
            ResetEntityAlpha(playerPed)
            TriggerEvent('esx_skin:openSaveableMenu', function()
                finished = true 
            end, function()
                finished = true
            end)
        end)
        repeat Wait(200) until finished
    end
    DoScreenFadeOut(100)
    SetCamActive(cam, false)
    RenderScriptCams(false, false, 0, true, true)
    cam = nil
    local playerPed = PlayerPedId()
    FreezeEntityPosition(playerPed, true)
    exports['vms_spawnselector']:OpenSpawnSelector() -- ADDED EXPORT TO OPEN SPAWN SELECTOR
    if not isNew then 
        TriggerEvent('skinchanger:loadSkin', skin or Characters[spawned].skin) 
    end
    Wait(400)
    DoScreenFadeIn(400)
    repeat Wait(200) until not IsScreenFadedOut()
    TriggerServerEvent('esx:onPlayerSpawn')
    TriggerEvent('esx:onPlayerSpawn')
    TriggerEvent('playerSpawned')
    TriggerEvent('esx:restoreLoadout')
    Characters, hidePlayers = {}, false
end)

Last updated

Was this helpful?