# Installation

## Requirements

* [ox-lib](https://github.com/overextended/ox_lib)
* [ox-target](https://github.com/overextended/ox_target) or [qb-target](https://github.com/qbcore-framework/qb-target)
* [PolyZone](https://github.com/mkafrin/PolyZone)
* [LegacyFuel](https://github.com/InZidiuZ/LegacyFuel) or [cdn-fuel](https://github.com/CodineDev/cdn-fuel)
* [qb-phone](https://github.com/qbcore-framework/qb-phone) or qs-smartphone or lb-phone or renewed
* [ps-ui](https://github.com/Project-Sloth/ps-ui)
* [ps-dispatch](https://github.com/Project-Sloth/ps-dispatch)
* [dpemotes](https://github.com/andristum/dpemotes)

## Step 1 - Place resource in \[qb] folder

Place the folder qb-pos inside your folder with all the other qb scripts. This is most likely called \[qb]

## Step 2 - Add Items

Add the following items to your qb-core items.lua file:

```lua
-- Boosting Items
boostlaptop                  = { name = 'boostlaptop', label = 'Laptop', weight = 100, type = 'item', image = 'pixellaptop.png', unique = true, useable = true, shouldClose = true, description = 'A laptop' },
hacking_device               = { name = 'hacking_device', label = 'Hacking Device', weight = 100, type = 'item', image = 'disabler.png', unique = true, useable = true, shouldClose = true, description = 'A device' },
boostfile                    = { name = 'boostfile', label = 'File', weight = 100, type = 'item', image = 'file.png', unique = true, useable = true, shouldClose = true, description = 'A nail file' },
```

## Step 3 - Images

Open up the images folder and add the images to your inventory addon. For most people this will be called `qb-inventory.`

Drag and drop the images into the `html/images` folder.

## Step 4 - Adding Vehicles

The vehicles used for the boosting system are configured by you. Each tier has a different set of vehicles, this means that you need to configure this in your qb-core vehicles.lua. This is so you have more control over what vehicles players will be boosting.&#x20;

An example of a default vehicle is shown below

```lua
{ model = 'blista',        name = 'Blista',                        brand = 'Dinka',           price = 13000,   category = 'compacts',       type = 'automobile', shop = 'pdm' },
```

Here is the modified vehicle, at the end you can see we added the `tier` part

```lua
{ model = 'blista',        name = 'Blista',                        brand = 'Dinka',           price = 13000,   category = 'compacts',       type = 'automobile', shop = 'pdm', tier = 'D' },
```

Then, add the bottom of your vehicles.lua file you should see something like this:

```lua
for i=1, #Vehicles do
    QBShared.Vehicles[Vehicles[i].model] = {
        spawncode = Vehicles[i].model,
        name = Vehicles[i].name,
        brand = Vehicles[i].brand,
        model = Vehicles[i].model,
        price = Vehicles[i].price,
        category = Vehicles[i].categoryLabel:gsub("%s+", ""):lower(),
        categoryLabel = Vehicles[i].categoryLabel,
        hash = joaat(Vehicles[i].model),
        shop = Vehicles[i].shop,
    }
end
```

Change to:

```lua
for i=1, #Vehicles do
    QBShared.Vehicles[Vehicles[i].model] = {
        spawncode = Vehicles[i].model,
        name = Vehicles[i].name,
        brand = Vehicles[i].brand,
        model = Vehicles[i].model,
        price = Vehicles[i].price,
        category = Vehicles[i].categoryLabel:gsub("%s+", ""):lower(),
        categoryLabel = Vehicles[i].categoryLabel,
        hash = joaat(Vehicles[i].model),
        shop = Vehicles[i].shop,
        tier = Vehicles[i].tier,
    }
end
```

The line `tier = Vehicles[i].tier,` must be added.

## Step 5 - Database

Execute the following code in your database

```sql
CREATE TABLE `car_boosting` (
  `id` int(11) NOT NULL,
  `citizenid` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  `vehicle` varchar(255) NOT NULL,
  `value` double NOT NULL,
  `success` int(11) NOT NULL,
  `enemy_killed` int(11) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

ALTER TABLE `car_boosting`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `car_boosting`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
CREATE TABLE `car_boosting_messages` (
  `id` int(11) NOT NULL,
  `citizenid` varchar(255) NOT NULL,
  `message` varchar(255) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

ALTER TABLE `car_boosting_messages`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `car_boosting_messages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE player_vehicles 
ADD COLUMN vinnumber VARCHAR(50) DEFAULT NULL,
ADD COLUMN vinscratch INT(2) DEFAULT 0;
```

## Step 6 - dpemotes Setup

You need to make a slight modification to the dpemotes resource to make the player animations work correctly.

In the resource, open up the file `Client/Emote.lua` , and look for the function called `EmoteCommandStart`

Right below the function, after the `end` , add in the following:

```lua
exports('EmoteCommandStart', EmoteCommandStart)
```

It should now look like the following:

```lua
function EmoteCommandStart(source, args, raw)
    if #args > 0 then
    local name = string.lower(args[1])
    if name == "c" then
        if IsInAnimation then
            EmoteCancel()
        else
            EmoteChatMessage(Config.Languages[lang]['nocancel'])
        end
      return
    elseif name == "help" then
      EmotesOnCommand()
    return end

    if DP.Emotes[name] ~= nil then
      if OnEmotePlay(DP.Emotes[name]) then end return
    elseif DP.Dances[name] ~= nil then
      if OnEmotePlay(DP.Dances[name]) then end return
    elseif DP.PropEmotes[name] ~= nil then
      if OnEmotePlay(DP.PropEmotes[name]) then end return
    else
      EmoteChatMessage("'"..name.."' "..Config.Languages[lang]['notvalidemote'].."")
    end
  end
end
exports('EmoteCommandStart', EmoteCommandStart)
```

Next, you need to open up the `fxmanifest.lua` file for dpemotes. At the bottom of the file, add in the following line:

```lua
export 'EmoteCommandStart'
```

## Step 7 - Configuration

The configuration file is setup with some locations already. Feel free to add more and tweak the rest to your likings.


---

# 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.elusivestudios.net/qb/car-boosting/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.
