# Installation

## Downloading Dependencies

Dependencies are very important — you need to install them before moving on to the installation of our script.

{% stepper %}
{% step %}

### ox\_lib

{% embed url="<https://github.com/overextended/ox_lib>" %}
{% endstep %}
{% endstepper %}

***

## Server.cfg

All dependencies you’ve installed must be started before our script. Make sure to follow the correct start-up order in your `server.cfg`.

```
ensure ox_lib
ensure op-multicharacter
```

***

## Additional Steps (Important):

{% tabs %}
{% tab title="ESX" %}

1. Go to your `es_extended`
2. Find config file located in `shared/config/main.lua`
3. Change line:

* From: `Config.Multichar = GetResourceState("esx_multicharacter") ~= "missing"`  &#x20;
* To: `Config.Multichar = true`&#x20;
  {% endtab %}

{% tab title="QBOX" %}

1. Go to your qbx\_core
2. Find config located in config/client.lua

* Change `useExternalCharacters` to true&#x20;

Before:&#x20;

<figure><img src="https://36113860-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1vEl4u37HzsUUsBP0oWM%2Fuploads%2Fv6LrNGwMSJZHO181hDDB%2Fimage.png?alt=media&#x26;token=32bf13be-404d-4d99-9905-5790b6284e69" alt=""><figcaption></figcaption></figure>

After:

<figure><img src="https://36113860-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1vEl4u37HzsUUsBP0oWM%2Fuploads%2FjtHMaFccdfV70ZpddaE3%2Fimage.png?alt=media&#x26;token=559ed9e0-0d08-4de8-b196-4ca3303dec63" alt=""><figcaption></figcaption></figure>

3. Find resource:  `qbx_properties`
4. Go to `qbx_properties/server/apartmentselect.lua`
5. Find event `QBCore:Server:OnPlayerLoaded`

* Replace this:

  ```lua
  RegisterNetEvent('QBCore:Server:OnPlayerLoaded', function()
      local playerSource = source --[[@as number]]
      local player = exports.qbx_core:GetPlayer(playerSource)
      local hasApartment = MySQL.single.await('SELECT * FROM properties WHERE owner = ?', {player.PlayerData.citizenid})
      if not hasApartment then
          TriggerClientEvent('apartments:client:setupSpawnUI', playerSource)
      end
  end)
  ```
* With This:

  ```lua
  RegisterNetEvent('QBCore:Server:OnPlayerLoaded', function()
      local playerSource = source --[[@as number]]
      local player = exports.qbx_core:GetPlayer(playerSource)
      local hasApartment = MySQL.single.await('SELECT * FROM properties WHERE owner = ?', {player.PlayerData.citizenid})
      if not hasApartment then
          --TriggerClientEvent('apartments:client:setupSpawnUI', playerSource)
      end
  end)
  ```

{% endtab %}

{% tab title="QBCore" %}
Only If you're using qb-clothing:

{% embed url="<https://docs.otherplanet.dev/scripts/op-multicharacter/integrations/qb-clothing>" %}
{% endtab %}
{% endtabs %}

***

## Final Step

Make sure you deleted other Multicharacter scripts from your server, like esx\_multicharacter or qb-multicharacter!
