[RELEASE] CleanUI (cui) character

work this with qbus?

Hey, the double character bug issue also comes up with female characters.

1 Like

There was a mistake in ClonePed function call, but I fixed it. I’ve tested it by logging in from 2 clients and it looked fine. Is it still a problem?

I guess so, when I am home I will go more in depth.

But I have a question aside. I replaced all the skinchanger functions from policejob and stuff. But is there a way to return the current Clothe ID somewhere ? Because the config with the clothes still needs to be configured and Cui_character works with names and not IDs.

And where exactly can I define streamed addon clothes for example like EUP?. They do not show up on vanilla so I guess i have to adjust some values or something.

For an outside resource? Use cui_character:getCurrentClothes event.

I am not really familiar with how drawable/texture IDs are defined inside the game and how exactly new ones are added when streaming clothes.

If you can somehow figure out how to stream metadata about those new clothes you add, so these functions:

GetShopPedComponent
GetNumberOfPedDrawableVariations
GetNumberOfPedTextureVariations
GetNumberOfPedPropDrawableVariations
GetNumberOfPedPropTextureVariations

Can ‘see’ the new clothes, then cui_character will just work with them.

It’s not really a cui_character problem, but a more general one: How to add clothes defined completely with whatever extra data is required for native functions to recognize those new additions.

Thanks for the answer. Do you mean something like this ?

mp_f_freemode_01_tutorial_clothes.meta

<?xml version="1.0" encoding="UTF-8"?>
<ShopPedApparel>
<pedName>mp_f_freemode_01</pedName>
<dlcName>tutorial_clothes</dlcName>
<fullDlcName>mp_f_freemode_01_tutorial_clothes</fullDlcName>
<eCharacter>SCR_CHAR_MULTIPLAYER_F</eCharacter>
<creatureMetaData>MP_CreatureMetadata_tutorial_clothes</creatureMetaData>

<pedOutfits>
</pedOutfits>
<pedComponents>
</pedComponents>
<pedProps>
</pedProps>

</ShopPedApparel>

fxmanifest.lua

fx_version 'cerulean'
game 'gta5'

files {
    'mp_f_freemode_01_tutorial_clothes.meta'
}

data_file 'SHOP_PED_APPAREL_META_FILE' 'mp_f_freemode_01_tutorial_clothes.meta'

Taken from this post:

This looks about right, but I’ve never done it and probaly never will (at least as long as streaming clothes feature is paywalled). I’m strongly opposed to any form of paywalls.

Simple fact is that cui_character uses the above natives to manage clothes. If those natives can’t see some clothes then cui_character won’t see them either.

1 Like

Heya, I have a problem over here.

When I join the creator is displayed, even though it should be hided so yeah lol.

I checked if there is a display: none and yeah it is in the body.

you can add it by and on the jquery on the append. It’s not the best solution, but it works. the other way is to insert them on the Table of items

Okay understandable. To get the IDs of my current clothes I used

print(cui_character:getCurrentClothes)

This gives me a bunch of numbers which I guess are the IDs for the single component clothes. Can you tell me how they are formatted ? Which number represents which component. And where can I see if an ID goes over 2 or 3 digits ?

AddEventHandler('cui_character:getCurrentClothes', function(cb)
    local result = {}

    result.sex = currentChar.sex
    result.tshirt_1 = currentChar.tshirt_1
    result.tshirt_2 = currentChar.tshirt_2
    result.torso_1 = currentChar.torso_1
    result.torso_2 = currentChar.torso_2
    result.decals_1 = currentChar.decals_1
    result.decals_2 = currentChar.decals_2
    result.arms = currentChar.arms
    result.arms_2 = currentChar.arms_2
    result.pants_1 = currentChar.pants_1
    result.pants_2 = currentChar.pants_2
    result.shoes_1 = currentChar.shoes_1
    result.shoes_2 = currentChar.shoes_2
    result.mask_1 = currentChar.mask_1
    result.mask_2 = currentChar.mask_2
    result.bproof_1 = currentChar.bproof_1
    result.bproof_2 = currentChar.bproof_2
    result.neckarm_1 = currentChar.chain_1 or currentChar.neckarm_1
    result.neckarm_2 = currentChar.chain_2 or currentChar.neckarm_2
    result.helmet_1 = currentChar.helmet_1
    result.helmet_2 = currentChar.helmet_2
    result.glasses_1 = currentChar.glasses_1
    result.glasses_2 = currentChar.glasses_2
    result.lefthand_1 = currentChar.watches_1 or currentChar.lefthand_1
    result.lefthand_2 = currentChar.watches_2 or currentChar.lefthand_2
    result.righthand_1 = currentChar.bracelets_1 or currentChar.righthand_1
    result.righthand_2 = currentChar.bracelets_2 or currentChar.righthand_2
    result.bags_1 = currentChar.bags_1
    result.bags_2 = currentChar.bags_2
    result.ears_1 = currentChar.ears_1
    result.ears_2 = currentChar.ears_2

    cb(result)
end)

_1s are drawable IDs and _2s are texture IDs

This seems wrong.

image

Made a command for the current ID in policejob. How could that be negative?

Okay I tried the method to stream “addon clothes” as own DLC Packs and it worked perfectly. As you can see in this random script i found on Github I can put on the addon clothes. I guess esx_skin doesnt have a problem with it either.

Just cui_character does not want to recognize the new changes:

I streamed it through this XML:

<?xml version="1.0" encoding="UTF-8"?>
<ShopPedApparel>

<pedName>mp_m_freemode_01</pedName>

<dlcName>brandpack1</dlcName>

<fullDlcName>mp_m_freemode_01_brandpack1</fullDlcName>

<eCharacter>SCR_CHAR_MULTIPLAYER</eCharacter>

<creatureMetaData>MP_CreatureMetadata_brandpack1</creatureMetaData>

<pedOutfits>
</pedOutfits>
<pedComponents>
</pedComponents>
<pedProps>
</pedProps>
</ShopPedApparel>

Is there anything where cui_character gets his data from? Or do you have an idea what i exactly can tweak to make it flow :stuck_out_tongue_winking_eye:

You can see the natives used in GetComponentsData function in client/main.lua, it uses first GetNumberOfPedDrawableVariations, then GetNumberOfPedTextureVariations for every drawable.

To retrieve name, it uses a method shown here. Native used to obtain the struct with data is GetShopPedComponent, called with:

Citizen.InvokeNative(0x74C0E2A57EC66760, hash, blob)

Then the struct is unpacked and name is obtained with GetLabelText on gxt field:

function GetComponentDataFromHash(hash)
    local blob = string.rep('\0\0\0\0\0\0\0\0', 9 + 16)
    if not Citizen.InvokeNative(0x74C0E2A57EC66760, hash, blob) then
        return nil
    end

    local lockHash = string.unpack('<i4', blob, 1)
    local hash = string.unpack('<i4', blob, 9)
    local locate = string.unpack('<i4', blob, 17)
    local drawable = string.unpack('<i4', blob, 25)
    local texture = string.unpack('<i4', blob, 33)
    local field5 = string.unpack('<i4', blob, 41)
    local component = string.unpack('<i4', blob, 49)
    local field7 = string.unpack('<i4', blob, 57)
    local field8 = string.unpack('<i4', blob, 65)
    local gxt = string.unpack('c64', blob, 73)

    return component, drawable, texture, gxt, field5, field7, field8
end

This is all repeated for props, since they use separate set of natives.

I guess that what you define in this xml, can be retrieved from that struct if it has a hash name (that GetShopPedComponent takes as argument).

I’ve noticed that you don’t define a hash name for your added clothes anywhere and I’m not sure if that’s even possible.

At one point cui_character uses GetHashNameForComponent on each component/drawable/texture group. If the hash is 0, that group is then skipped entirely. I think that this is what eliminates your custom clothes from the list.

Okay I understand. And is there a way to still add clothes even if they miss the missing meta data?
For example if there is a hash then the name is getting loaded. If not then the name is NULL but the Clothes are still getting loaded.

1 Like

If there is a hash but no name, it will also be skipped (at a later step). You need to add both hash and name if you want it to be on the list, or rework how clothes are selected/displayed, but that would be time-consuming.

1 Like

Is there no way to ignore these checks? I saw that you check the Hashes here:

if hash ~= 0 then

                local component, drawable, texture, gxt = GetComponentDataFromHash(hash)

                -- only named components

                if gxt ~= '' then

                    label = GetLabelText(gxt)

                    if label ~= 'NULL' then

                        local blacklisted = false

                        if componentBlacklist ~= nil then

                            if componentBlacklist[component] ~= nil then

                                if componentBlacklist[component][drawable] ~= nil then

                                    if componentBlacklist[component][drawable][texture] ~= nil then

                                        blacklisted = true

                                    end

                                end

                            end

                        end

    

                        if not blacklisted then

                            table.insert(result, {

                                name = label,

                                component = component,

                                drawable = drawable,

                                texture = texture

                            })

                        end

                    end

                end

            end

        end

    end

I tweaked some functions and I already got the clothes listed in the creator as “NULL” but they didnt load on my character.
I could go through the menu and had exactly the same number of options as Shirts out of my pack.
So basically I think it wouldnt be that difficult to get them loading. The names are not that important for me.

Hi, Thank you for this amazing script and making it available for free. It has almost everything I expected from a character creator. I also added the arms section to that thanks to @ilconfa above.

The only issue I am having is that original skin menu from ESX Legacy is popping up after I saved my character and if anything changed there it completely mess up the character created. Is there a way to disable skin menu pop up after character creation? Disabling esx_skin is not an option I think as
esx_multicharacter is depending on it.

when i load into my server im just frozen in place and invisible

Make sure you installed everything correctly. Look into the config.lua there you can see additional information. Check your ESX Version and make the changes that could have to be made.