# ZSX\_Multicharacter

### Client Side

Detect the appearance resource `ZSX_Multicharacter/client/framework/framework_functions.lua`

Find where the appearance resource is defined and add the following detection: `Framework.AppereanceResource`

```lua
GetResourceState('origen_clothing') == 'started' and 'origen_clothing'
```

Apply the player skin `SetSkin`

Locate the **SetSkin** function or the `if / elseif` block that handles appearance systems: `if (Framework.AppereanceResource == ... )`

```lua
elseif Framework.AppereanceResource == 'origen_clothing' then
        if skinData and skinData.skin then
            exports['origen_clothing']:SetAppearance(ped, skinData.skin)
        end 
```

Open the character creation menu `OpenSkinMenu`

Find the **OpenSkinMenu** function or the block that opens clothing/appearance menus: `elseif Framework.AppereanceResource`

```lua
elseif Framework.AppereanceResource == 'origen_clothing' then
        local currentCoords = GetEntityCoords(PlayerPedId())
        exports['origen_clothing']:startPedCreation(currentCoords, gender, PlayerPedId(), false, function()
            if Config.Identity.SetInBucketOnAppearance then 
                TriggerServerEvent('ZSX_Multicharacter:Event:SetPlayerState', 'LOG_IN_USER') 
            end
            if UserInterfaceActive then
                exports[ZSX_UI]:HideUI(false)
            end
            HandleHud(false)
        end)
```

### Server Side

Configure the appearance resource: `ZSX_Multicharacter/server/functions/characters.lua`

Make sure this variable exists `local appearanceResource = Config.ForceAppereance` and then paste the next code in the same line:

```lua
GetResourceState('origen_clothing') == 'started' and 'origen_clothing'
```

Convert and load the skin from the database: `Characters.ConvertSkin`

Locate the **Characters.ConvertSkin** function and the `if / elseif` block that handles appearance systems

```lua
elseif appearanceResource == 'origen_clothing' then
        local result = MySQL.query.await("SELECT * FROM `origen_clothing_skins` WHERE `citizenid` = ? AND active = 1", {convertedIdentifier})
        if result and result[1] and result[1].skin then
            skin = {
                skin = json.decode(result[1].skin),
                model = result[1].model,
                hairslots = result[1].hairslots and json.decode(result[1].hairslots) or nil
            }
        end
```

*Thanks for SYX Lucifer* :heart:
