# Installation

## Step 1. Remove old chat resource <a href="#remove-old-clothing-resources" id="remove-old-clothing-resources"></a>

Delete `chat` or any other chat resource, It's generally located in `\resources\[cfx-default]\[gameplay]\chat`

***

## Step 2. Install dependencies <a href="#install-dependencies" id="install-dependencies"></a>

Install the dependencies if they are not installed.

| ox\_lib | <https://github.com/overextended/ox_lib> |
| ------- | ---------------------------------------- |

***

## Step 3. Download lvs\_chat <a href="#download-illenium-appearance" id="download-illenium-appearance"></a>

Download the lvs-chat package from your keymaster. It contains two resources: `chat` and `lvs_chat_extra`. Place both inside the `resources` folder.

{% hint style="danger" %}
Do not change the name of the `chat` resource.
{% endhint %}

***

## Step 4. Script initiate (server.cfg) <a href="#add-it-to-your-server" id="add-it-to-your-server"></a>

The `chat` should go where it normally does at the beginning, and `lvs_chat_extra` should go after `ox_lib`

```editorconfig
...

set resources_useSystemChat false # set false to build-in chat (newest version of fxserver))

...

# These resources will start by default.
ensure mapmanager
ensure chat # <-- still here
ensure spawnmanager
ensure sessionmanager

...

ensure ox_lib
ensure lvs_chat_extra # <-- somewhere after ox_lib

...
```

***

## Step 5. Config <a href="#step-5" id="step-5"></a>

Now configure and translate your resources.

<details>

<summary>Config files</summary>

`chat/config.lua`\
`lvs_chat_extra/config.lua`\
`lvs_chat_extra/server/webhook.lua`

</details>

***

## Step 6. qb-core

Open `qb-core/server/commands.lua` remove the commands <mark style="color:yellow;">ooc</mark> and <mark style="color:yellow;">me</mark> (line 272).

This ones:

{% code title="qb-core/server/commands.lua" %}

```lua
-- Out of Character Chat
QBCore.Commands.Add('ooc', Lang:t('command.ooc.help'), {}, false, function(source, args)
    local message = table.concat(args, ' ')
    local Players = QBCore.Functions.GetPlayers()
    local Player = QBCore.Functions.GetPlayer(source)
    local playerCoords = GetEntityCoords(GetPlayerPed(source))
    for _, v in pairs(Players) do
        if v == source then
            TriggerClientEvent('chat:addMessage', v, {
                color = QBCore.Config.Commands.OOCColor,
                multiline = true,
                args = { 'OOC | ' .. GetPlayerName(source), message }
            })
        elseif #(playerCoords - GetEntityCoords(GetPlayerPed(v))) < 20.0 then
            TriggerClientEvent('chat:addMessage', v, {
                color = QBCore.Config.Commands.OOCColor,
                multiline = true,
                args = { 'OOC | ' .. GetPlayerName(source), message }
            })
        elseif QBCore.Functions.HasPermission(v, 'admin') then
            if QBCore.Functions.IsOptin(v) then
                TriggerClientEvent('chat:addMessage', v, {
                    color = QBCore.Config.Commands.OOCColor,
                    multiline = true,
                    args = { 'Proximity OOC | ' .. GetPlayerName(source), message }
                })
                TriggerEvent('qb-log:server:CreateLog', 'ooc', 'OOC', 'white', '**' .. GetPlayerName(source) .. '** (CitizenID: ' .. Player.PlayerData.citizenid .. ' | ID: ' .. source .. ') **Message:** ' .. message, false)
            end
        end
    end
end, 'user')

-- Me command

QBCore.Commands.Add('me', Lang:t('command.me.help'), { { name = Lang:t('command.me.params.message.name'), help = Lang:t('command.me.params.message.help') } }, false, function(source, args)
    if #args < 1 then
        TriggerClientEvent('QBCore:Notify', source, Lang:t('error.missing_args2'), 'error')
        return
    end
    local ped = GetPlayerPed(source)
    local pCoords = GetEntityCoords(ped)
    local msg = table.concat(args, ' '):gsub('[~<].-[>~]', '')
    local Players = QBCore.Functions.GetPlayers()
    for i = 1, #Players do
        local Player = Players[i]
        local target = GetPlayerPed(Player)
        local tCoords = GetEntityCoords(target)
        if target == ped or #(pCoords - tCoords) < 20 then
            TriggerClientEvent('QBCore:Command:ShowMe3D', Player, source, msg)
        end
    end
end, 'user')
```

{% endcode %}


---

# 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://fivem.lvsoft.com.ar/qb-esx/lvs-chat/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.
