NicooPasPris / nicoo_charcreator

Fivem Character Creator
47 stars 24 forks source link

opacity value is not saved correctly #8

Open kielerboy opened 4 years ago

kielerboy commented 4 years ago

if I create a char it will be displayed normally after relog beards and Chest Hair will no longer be displayed because the opacity is on 1 and not on the value you selected

Twiitchter commented 4 years ago

Can you find this..

function updateApperance(id, selected, color)
    local app = Apperance[id]
    local playerPed = PlayerPedId()

    if selected then
        if app.itemType == 'component' then
            ComponentVariation[app.item] = {app.index, 0}
            SetPedComponentVariation(playerPed, app.itemID, app.index, 0, 2)
        elseif app.itemType == 'headoverlay' then
            HeadOverlay[app.item] = {app.index, 10.0}
            SetPedHeadOverlay(playerPed, app.itemID, app.index, 10.0)
        elseif app.itemType == 'eye' then
            ParentData['eye_color'] = app.index
            SetPedEyeColor(playerPed, app.index, 0, 1)
        end
    end

And replace it with this?

function updateApperance(id, selected, color)
    local app = Apperance[id]
    local playerPed = PlayerPedId()

    if selected then
        if app.itemType == 'component' then
            ComponentVariation[app.item] = {app.index, 0}
            SetPedComponentVariation(playerPed, app.itemID, app.index, 0, 2)
        elseif app.itemType == 'headoverlay' then
            HeadOverlay[app.item] = {app.index, app.indextwo}
            SetPedHeadOverlay(playerPed, app.itemID, app.index, app.indextwo)
        elseif app.itemType == 'eye' then
            ParentData['eye_color'] = app.index
            SetPedEyeColor(playerPed, app.index, 0, 1)
        end
    end

Reply here and let me know if it works..

kielerboy commented 4 years ago

not work

Twiitchter commented 4 years ago

What does line 339 look like in your menu.lua?

Apperance[PanelVisage.Percentage.itemIndex].indextwo = math.floor(Percent*10)/10

Is it this?

kielerboy commented 4 years ago

yes

Twiitchter commented 4 years ago

Remove the /10 from the end please and retest.

Twiitchter commented 4 years ago

I forgot skinchanger does some math to gain percentages during its calling of setpedoverlay....

Might be getting it twice.

Otherwise the line on 339 is correct because it is returning a float, or something close enough too a float.

The problem would then lay with skin changer useing the extra math to apply features.

But to save on changing that resource, we could always do math inside the setpedoverlay in this one...

Twiitchter commented 4 years ago

Try this one... Keep line 339 without the /10.

function updateApperance(id, selected, color)
    local app = Apperance[id]
    local playerPed = PlayerPedId()

    if selected then
        if app.itemType == 'component' then
            ComponentVariation[app.item] = {app.index, 0}
            SetPedComponentVariation(playerPed, app.itemID, app.index, 0, 2)
        elseif app.itemType == 'headoverlay' then
            HeadOverlay[app.item] = {app.index, app.indextwo}
            SetPedHeadOverlay(playerPed, app.itemID, app.index, math.floor(app.indextwo)/10+0.0)
        elseif app.itemType == 'eye' then
            ParentData['eye_color'] = app.index
            SetPedEyeColor(playerPed, app.index, 0, 1)
        end
    end
kielerboy commented 4 years ago

ok eyebrows_2 works chest_hair not work beard not work

Twiitchter commented 4 years ago

Is that with a brand new character?

kielerboy commented 4 years ago

yes an i testet again and its works for chest_hair i have change the chest_1, chest_2 ,chest_3 to chest_hair_1 , chest_hair_2 ,chest_hair_3 on skinchanger to show chest_hair from the char creator

Twiitchter commented 4 years ago

to make it more compatible, you could just find it in the client.lua and change...

    {
        item = 'chest_hair',
        List = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ,16},
        index = 1,
        indextwo = 1,
        cam = 'body',
        itemType = 'headoverlay',
        itemID = 10,
        PercentagePanel = true,
        ColourPanel = true,
    },

to

    {
        item = 'chest',
        List = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ,16},
        index = 1,
        indextwo = 1,
        cam = 'body',
        itemType = 'headoverlay',
        itemID = 10,
        PercentagePanel = true,
        ColourPanel = true,
    },
Twiitchter commented 4 years ago

Good pickup on that though!

kielerboy commented 4 years ago

i have a other question how i can make other player visible in the char creator when 2 player connect i see the the other player

Twiitchter commented 4 years ago

Seperate issue.