# QBCore

## Download Resource

You will receive the script in [`keymaster.fivem.net`](https://keymaster.fivem.net/asset-grants) profile, after this click in blue "download" button.

After download, put the script in your server files.

{% hint style="warning" %}
Remeber:

You need to be logged with the same cfx.re account you used to buy in my tebex store.
{% endhint %}

## Dependencies Part

* [**qb-clothing** ](https://github.com/qbcore-framework/qb-clothing)**or** [**jpr-clothestore**](https://www.youtube.com/watch?v=_fv1BRFlhGQ\&t=19s\&ab_channel=JPResources) **or** [**illenium-appearance**](https://github.com/iLLeniumStudios/illenium-appearance)
* **Any garage script who uses (player\_vehicles)**
* [**qb-core**](https://github.com/qbcore-framework/qb-core)

Download all the scripts by clicking on their respective names, put them in the server files and start server.cfg

## Stash Logs Part:

Open your inventory - server - main.lua\
Line 598 and add this under:

```
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local nomejogador = Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname
TriggerEvent("jpr-crewsystem:server:adicionarlog", "The item: <b>"..ItemData.label.."</b> has add by: <b>"..nomejogador.."</b> count: <b>"..amount.."x</b>","1", src)
```

Line 667 and add this under:

```

local src = source
local Player = QBCore.Functions.GetPlayer(src)
local ItemData = QBCore.Shared.Items[itemName]

local nomejogador = Player.PlayerData.charinfo.firstname.." "..Player.PlayerData.charinfo.lastname
TriggerEvent("jpr-crewsystem:server:adicionarlog", "The item: <b>"..ItemData.label.."</b> has taken by: <b>"..nomejogador.."</b> count: <b>"..amount.."x</b>","0", src)
```

{% hint style="warning" %}
If you skip this you will not have stash logs working

If you have jpr-inventory you can skip this
{% endhint %}

## Stash Images

To add stash images open:\
jpr-crewsystem - html - img - items

Here you can add your own images to your items

## Level system triggers

To incorporate level system with your custom scripts follow this steps:\
\
**To remove level:**\
`TriggerServerEvent("jpr-crewsystem:server:tirarnivel", here put crew name, here amount of xp to remove)`\
\
**To add level:**\
`TriggerServerEvent("jpr-crewsystem:server:darnivel", here put crew name, here amount of xp to add)`<br>

## Sync with garage script

This step serves to synchronize the vehicles taken from the garage with the vehicles taken from the crew system garage, i will do a example with **qb-garages**:

**Qb-Garages / server / main.lua**\
Find: `qb-garage:server:spawnvehicle`

\
Add this **inside** the **callback**:\
`TriggerEvent("jpr-crewsystem:server:atualizargaragemcrew", plate, veh)`\
\
In the **end of file**, add this little code:\
`RegisterServerEvent('jpr-crewsystem:server:atualizargaragem') AddEventHandler('jpr-crewsystem:server:atualizargaragem', function(plate, veh) if (plate ~= nil and veh ~= nil) then local netId = NetworkGetNetworkIdFromEntity(veh) OutsideVehicles[plate] = {netID = netId, entity = veh} end end)`<br>

{% hint style="warning" %}
JPR - Garages buyers can skip this.
{% endhint %}

{% hint style="info" %}
This is optional for those who want only one same vehicle running on the server, otherwise you can skip it.
{% endhint %}

## To be compatible with IlleniumAppearance

Open **config.lua** and set **Config.UseIlleniumAppearance = true**

Open **IlleniumAppearance resource / server / database / playeroutfits** and find:

```
function Database.PlayerOutfits.Add(citizenID, outfitName, model, components, props)
   return MySQL.insert.await("INSERT INTO player_outfits (citizenid, outfitname, model, components, props) VALUES (?, ?, ?, ?, ?)", {
        citizenID,
        outfitName,
        model,
        components,
        props
    })
end
```

**Replace to:**

<pre><code>local QBCore                  = exports[----- HERE PUT YOUR CORE NAME ----]:GetCoreObject()
<strong>function Database.PlayerOutfits.Add(citizenID, outfitName, model, components, props)
</strong>   return MySQL.insert.await("INSERT INTO player_outfits (citizenid, outfitname, model, components, props, outfitId) VALUES (?, ?, ?, ?, ?, ?)", {
        citizenID,
        outfitName,
        model,
        components,
        props,
	"outfit-"..QBCore.Shared.RandomInt(1).."-"..QBCore.Shared.RandomInt(6),
    })
end
</code></pre>

## SQL

Only need to execute SQL file attached to crewsystem folder.

{% hint style="danger" %}
This is mandatory to avoid errors
{% endhint %}

## Config.lua

Setup all config.lua to your needs, read all comments in green color to be more easier.

{% hint style="success" %}
You are good to go!\
Any question open a ticket in my discord server.
{% endhint %}

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


---

# 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://joaos-organization-3.gitbook.io/jpresources-documentation/installation/crew-system/qbcore.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.
