[RELEASE] CleanUI (cui) character

I’m using the dev branch version as I have ESX Legacy. Also, I use cd_identity as my character registration resource.
I’m having two issues:

  1. The creation menu doesn’t automatically pop up after my character spawns upon first registration
  2. When I use the command /character, it brings the menu up but won’t allow me to save the changes. When I select “Accept”, then confirm, it just brings me back to the menu.

There’s probably a conflict with your identity resource. I’ve put extra effort to merge identity data into character creation, so registering + creating character is no longer a 2 step process.

I don’t know what this cd_identity adds that you still feel the need to use it, but if you want to keep it, you will have to make significant changes to cui_character.

Also going into the plastic surgery blip makes the character go invisible with no errors in console and no errors in F8.

If it helps I’m using cd_multicharacter/identity/spawn select.
Multicharacter - Character Selection - Codesign Scripts

Link to the documentation, it requires edits to your scripts also.

Most of the error above are mostly caused by not doing the modification required written inside the config.lua.
CUI are pretty much deploy and forget.

Already done that, modified CUI to make cd_multichar work. and changed config options, but to no avail.

Still having issues with this.

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.