> For the complete documentation index, see [llms.txt](https://0bugscripts.gitbook.io/0bugscripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0bugscripts.gitbook.io/0bugscripts/infinity-scripts/multicharacter-v2/installation.md).

# Installation

## Requirements

* 0bug-core (Latest Version)
* ESX/QBCore/QBox Framework
* Default framework multicharacter tables

## Installation Steps

#### 1. Dependencies First

<pre class="language-lua"><code class="lang-lua"><strong>ensure oxmysql 
</strong><strong>ensure qb-core/es_extended/qbx_core
</strong><strong>ensure 0bug-core
</strong></code></pre>

#### 2. Resource Installation

* Download <mark style="color:blue;">`0bug-multicharacter-v2`</mark>
* Place in your `[0bug]` folder
* Add to your server.cfg:

```lua
ensure 0bug-core
```

3. Database Setup

Keep the same players/users table that your framework has.

#### 4. Load Order

```lua
server.cfg load order

ensure mysql-async/oxmysql
ensure es_extended/qb-core/qbx_core
ensure 0bug-core
```

#### 5. Required Discord Setup

1. Create a Discord Bot at [Discord Developer Portal](https://discord.com/developers/applications)
2. Get your Bot Token
3. Enable required bot permissions
4. Get your Discord Server (Guild) ID
5. Add these to server\_Config.lua
6. Check this tutoriel and take it as an example&#x20;

{% embed url="<https://www.youtube.com/watch?v=c_xkk8UMwkk>" %}

#### 6. Core Configuration

#### Configure 0bug-core/shared/config.lua

```lua
WIZ_CONFIG = {
    Framework = "ESX", -- QBCore, QBox, ESX
    MySQL = "oxmysql",
    DefaultAvatar = "https://w0.peakpx.com/wallpaper/163/205/HD-wallpaper-street-fivem-gta-gta-v-roleplay.jpg",
    Lang = "en", -- en, fr, es, de, pl, sv, nl, it, pt-BR, ja, zh-CN, zh-TW, ru, cs,
}
```

#### Configure 0bug-core/shared/scriptConfig.lua

```lua
WIZ_SCRIPT_CONFIG = {
  ["Houses"] = {
    Name = "qb-houses" -- ps-housing, qb-houses
  },
  ["Apartments"] = {
    Name = "qb-apartments" -- ps-housing, qb-apartments
  },
  ["Clothes"] = {
    Name = "illenium-appearance" -- skinchanger,qb-clothing, tgiann-clothing, bl_appearance, codem-appearance, illenium-appearance, fivem-appearance, rcore_clothing, pa_appearance, bp-clothingv4 
  },
  ["Notification"] = {
    Name = "qb-core", -- qb-core, esx-notification, mythic_notify
  },
}
```

#### Configure 0bug-core/shared/server\_Config.lua

```lua
WIZ_SERVER_CONFIG = {
    DISCORD = {
        Discord_Token = "YOUR_DISCORD_BOT_TOKEN",    -- Required
        Discord_Guild_ID = "YOUR_DISCORD_SERVER_ID", -- Required
        Discord_Log_Webhook = "",                    -- Optional
    }
}
```

{% hint style="info" %}

#### Once you are done with that but you have a different <mark style="color:red;">Clothing</mark> or <mark style="color:green;">Apartments</mark> and <mark style="color:green;">Housing System</mark> than the ones pre-configured by us you will have to visit these paths&#x20;

{% endhint %}

* 0bug-core/client/Apartment\_Houses&#x20;
* 0bug-core/client/Clothes
* 0bug-core/server/Clothes

#### 7. Visit Script Configuration Page.

## Tebex Slot Purchase Integration

1\. First enable Tebex integration in your config:

```lua
Customize = {
    Tebex_Buy_Slot_Enable = true,
    Tebex_Buy_Slot_Command = "buySlot",  -- This is the command that will be executed
}
```

2. In your Tebex store:

* Create the character slot package
* Go to the package settings
* Choose <mark style="color:green;">Game Server Commands</mark> as deliverables for this package
* Under <mark style="color:orange;">"Game Command"</mark>, add:

```
buySlot {transaction}
```

The <mark style="color:red;">{transaction}</mark> parameter will automatically be replaced with the transaction ID

<figure><img src="/files/MsLVaNNZ9YT1t4W6HRuF" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/cBrmrRyz119Jck6eX4gV" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/cGIkphKv5nmPciEtbgC8" alt=""><figcaption></figcaption></figure>

3. When a player purchases a slot:

* They will receive an email with the transaction ID&#x20;
* They can enter this ID in the "Extra Slot" menu in-game
* The system will verify the purchase and grant the additional slot

## Important Notes

* Make sure your Tebex store is properly connected to your FiveM server
* The command must match exactly what you set in <mark style="color:purple;">Tebex\_Buy\_Slot\_Command</mark>
* Keep <mark style="color:purple;">Tebex\_Buy\_Slot\_Enable</mark> <mark style="color:green;">= true</mark> to allow this functionality

## Verify Installation

1. Start your server
2. Create new character
3. Check if all features work properly

{% hint style="warning" %}
DATABASE FOR <mark style="color:orange;">**QBCORE**</mark>
{% endhint %}

```sql
CREATE TABLE IF NOT EXISTS `players` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `citizenid` varchar(50) NOT NULL,
  `cid` int(11) DEFAULT NULL,
  `license` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `money` text NOT NULL,
  `charinfo` text,
  `job` text NOT NULL,
  `gang` text,
  `position` text NOT NULL,
  `metadata` text NOT NULL,
  `inventory` longtext,
  `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`citizenid`),
  KEY `id` (`id`),
  KEY `last_updated` (`last_updated`),
  KEY `license` (`license`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
COMMIT;
```

{% hint style="info" %}
DATABASE FOR <mark style="color:blue;">**ESX**</mark>
{% endhint %}

```sql
CREATE TABLE IF NOT EXISTS `users` (
  `identifier` varchar(46) NOT NULL,
  `accounts` longtext,
  `group` varchar(50) DEFAULT 'user',
  `inventory` longtext,
  `job` varchar(20) DEFAULT 'unemployed',
  `job_grade` int(11) DEFAULT '0',
  `loadout` longtext,
  `position` varchar(255) DEFAULT '{"x":-269.4,"y":-955.3,"z":31.2,"heading":205.8}',
  `firstname` varchar(16) DEFAULT NULL,
  `lastname` varchar(16) DEFAULT NULL,
  `dateofbirth` varchar(10) DEFAULT NULL,
  `sex` varchar(1) DEFAULT NULL,
  `height` int(11) DEFAULT NULL,
  `skin` longtext,
  `status` longtext,
  `is_dead` tinyint(1) DEFAULT '0',
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `disabled` tinyint(1) DEFAULT '0',
  `last_property` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `last_seen` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
  `phone_number` int(11) DEFAULT NULL,
  `pincode` int(11) DEFAULT NULL,
  PRIMARY KEY (`identifier`),
  UNIQUE KEY `id` (`id`),
  UNIQUE KEY `index_users_phone_number` (`phone_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
COMMIT;
```
