# Installation

{% hint style="success" %}
Please follow each step carefully to avoid unnecessary mistakes
{% endhint %}

{% hint style="warning" %}
**Dependencies**

* skinchanger
* oxmysql
* es\_extended
  {% endhint %}

## 1. Download Asset from Keymaster

1. First you have to get you resource from CFX Keymaster. Go to <https://keymaster.fivem.net/asset-grants> and download the `CharCreator | NEXT Scripts` resource

2\. Unpack the Zip File and Drag\&Drop *`next-char-creator`* resource into the resources folder of your server

3\. Go to you server.cfg and add the following on the bottom

```
start next-char-creator
```

## 2. Add the SQL

To make the char creator work you have to import the small sql file which comes with the download, called `char_creator.sql` into your database.

Or you just run these two lines in you database

```sql
ALTER TABLE `users` ADD `skin_created` INT(1) NOT NULL DEFAULT '0'; -- Create skin_created column
UPDATE `users` SET skin_created = 2 WHERE identifier IS NOT NULL -- Set every existing player to 1
```

## 3. Modify esx\_skin

In order for the new players on your server to really be able to use the new char creator system, we need to make some modifications to esx\_skin, which is usually responsible for skin creation.

1. First you need to find esx\_skin in your resources folder

<div align="left"><figure><img src="https://nextspace.one/images/uqny9.png" alt=""><figcaption><p>esx_skin in the resources folder </p></figcaption></figure></div>

2\. Replace code in client.lua

Open `esx_skin/client/main.lua` and replace the following parts.

Replace this

```lua
AddEventHandler('esx_skin:playerRegistered', function()
    CreateThread(function()
        while not ESX.PlayerLoaded do
            Wait(100)
        end

        if firstSpawn then
            ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
                if skin == nil then
                    TriggerEvent('skinchanger:loadSkin', {sex = 0}, OpenSaveableMenu)
                    Wait(100)
                    skinLoaded = true
                else
                    TriggerEvent('skinchanger:loadSkin', skin)
                    Wait(100)
                    skinLoaded = true
                end
            end)

            firstSpawn = false
        end
    end)
end)
```

with this

```lua
AddEventHandler('esx_skin:playerRegistered', function()
    CreateThread(function()
        while not ESX.PlayerLoaded do
            Wait(100)
        end
        
        if firstSpawn then
        
           TriggerServerEvent('nextSkin:PlayerRegistered')
           
           firstSpawn = false
       end
           
   end)
end)
```

this

```lua
RegisterNetEvent('esx_skin:openMenu')
AddEventHandler('esx_skin:openMenu', function(submitCb, cancelCb)
    OpenMenu(submitCb, cancelCb, nil)
end)
```

with this

```lua
RegisterNetEvent('esx_skin:openMenu')
AddEventHandler('esx_skin:openMenu', function(submitCb, cancelCb)
    TriggerEvent('nextSkin:OpenSkinMenu')
end)
```

and this

```lua
RegisterNetEvent('esx_skin:openSaveableMenu')
AddEventHandler('esx_skin:openSaveableMenu', function(submitCb, cancelCb)
    OpenSaveableMenu(submitCb, cancelCb, nil)
end)
```

with this

```lua
RegisterNetEvent('esx_skin:openSaveableMenu')
AddEventHandler('esx_skin:openSaveableMenu', function(submitCb, cancelCb)
    TriggerEvent('nextSkin:OpenSkinMenu')
end)
```

## 4. Restart Server

Now everything is set correctly and all you have to do is restart your server


---

# 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://docs.nextscripts.pro/char-creator/installation.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.
