# 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`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.rcore.cz/paid-resources/rcore_clothing/impl/esx_vms_multichar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
