# ESX vms\_multichar

### Step 1

Open file `vms_multichars/server/main.lua` and find `characters[id] = {` (inside function `SetupCharacters`)

Paste the following code **above** it.

```lua
if GetResourceState("rcore_clothing") == "started" then
    if v then
      v.skin = json.encode(exports["rcore_clothing"]:getSkinByIdentifier(v.identifier))
    elseif result and i and result[i] then
      result[i].skin = json.encode(exports["rcore_clothing"]:getSkinByIdentifier(result[i].identifier))
    else
      print("ERROR: Unknown version of multichar")
    end
end
```

### Step 2

Open file `vms_multichars/client/main.lua` and find `TriggerEvent('skinchanger:loadSkin', skin)` (inside function `SetupCharacter`)

Replace the line with the following code:

```lua
if Characters[index].skin then
    exports["rcore_clothing"]:setPlayerSkin(skin)
else
    TriggerEvent("skinchanger:loadSkin", skin)
end
```

### Step 3

In the same file as step 2 (`vms_multichars/client/main.lua`), find this code block in the function `SetupCharacter`:

```lua
TriggerEvent('skinchanger:loadSkin', Characters[index].skin, function()
	local playerPed = PlayerPedId()
	SetPedAoBlobRendering(playerPed, true)
	ResetEntityAlpha(playerPed)
	SetEntityVisible(playerPed,true)
	if isMenuOpened then
		SetEntityCoords(playerPed, Config.FromRight)
		TaskPedSlideToCoord(playerPed, Config.Spawn.x, Config.Spawn.y, Config.Spawn.z, Config.Spawn.w)
	end
	pedSliding = false
end)
```

Replace it with the following code: (remove the line `TriggerEvent('skinchanger:loadSkin', Characters[index].skin, function()` and `end)` and add the first exports line)

```lua
exports["rcore_clothing"]:setPlayerSkin(Characters[index].skin)
local playerPed = PlayerPedId()
SetPedAoBlobRendering(playerPed, true)
ResetEntityAlpha(playerPed)
SetEntityVisible(playerPed,true)
if isMenuOpened then
	SetEntityCoords(playerPed, Config.FromRight)
	TaskPedSlideToCoord(playerPed, Config.Spawn.x, Config.Spawn.y, Config.Spawn.z, Config.Spawn.w)
end
pedSliding = false
```

### Step 4

Open file `config\config_server.lua` and find `Config.UsersDatabase`.

Now add these entries to the Config.UsersDatabase variable:

```lua
rcore_clothing_current = "identifier",
rcore_clothing_purchased = "identifier",
rcore_clothing_outfits = "identifier",
```

### Step 5

Go to `config.lua` and set `Config.UseCustomSkinCreator = false`
