Client Open Files

Open Source Files

RegisterNetEvent('nf-skin:client:loadSkin', function(model, payload)
    model = model or "mp_m_freemode_01"

    Citizen.CreateThread(function()
        if Framework.QBCore() then
            if not model then
                model = "mp_m_freemode_01"
                if Framework.PlayerData.charinfo.gender == 1 then
                    model = "mp_f_freemode_01"
                end
            end
        elseif Framework.ESX() then
            if not model then
                model = "mp_m_freemode_01"
                if Framework.PlayerData.sex == "f" then
                    model = "mp_f_freemode_01"
                end
            end
        end

        SkinChanger.model = model
        SkinChanger.skinData.model = model
        SkinChanger:SetPedModel(model, function(playerPed)
            SkinChanger:SetPedAppearance(playerPed, payload or SkinChanger.skinData)
            SetEntityMaxHealth(playerPed, 200)
            SetEntityHealth(playerPed, SkinChanger.health)
            SetPedArmour(playerPed, SkinChanger.armour)
            SetPlayerHealthRechargeMultiplier(cache.playerId, 0.0)
            SetPlayerHealthRechargeLimit(cache.playerId, 0.0)
        end)
    end)
end)

RegisterNetEvent('nf-skin:client:openMenu', function()
    SkinChanger:OpenMenu({
        navSelected = 'head_blend',
        navList = {
            'head_blend', 'face_feature', 'head_overlay', 'hair_styles', 'clothes', 'tattoos'
        },
    })
end)

RegisterNetEvent('nf-skin:client:openOutfitMenu', function(payload)
    local outfits = lib.callback.await('nf-skin:server:getOutfits', false, payload)

    SkinChanger:OpenMenu({
        navSelected = 'outfits',
        navList = {
            'outfits'
        },
        outfits = outfits,
    })
end)

RegisterNetEvent('nf-skin:client:loadPlayerClothing', function(entity, payload)
    SkinChanger:SetPedAppearance(entity, payload or SkinChanger.skinData)
end)

RegisterNetEvent('nf-skin:textUI', function(text)
    if text == false then
        lib.hideTextUI()
    else
        lib.showTextUI(text)
    end
end)

RegisterNetEvent('nf-skin:client:saveSkin', function()
    TriggerServerEvent('nf-skin:server:saveSkin', nil, SkinChanger.model, SkinChanger.skinData)
end)

Last updated