# Installation

## Requirements

* [ox-lib](https://github.com/overextended/ox_lib/releases/tag/v3.6.2)
* [ox-target](https://github.com/overextended/ox_target/releases)
* [PolyZone](https://github.com/mkafrin/PolyZone/releases)
* [ps-ui](https://github.com/Project-Sloth/ps-ui)

## 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 - Database

Execute the following code in your database

```sql
CREATE TABLE `es_banktrucks` (
  `citizenid` varchar(255) NOT NULL,
  `completed` varchar(500) NOT NULL,
  `current` varchar(500) DEFAULT NULL,
  `routes` varchar(255) DEFAULT NULL,
  `xp` int(255) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `es_banktrucks`
  ADD PRIMARY KEY (`citizenid`);

INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES
('hacking_device', 'Hacking Device', 1, 0, 1),
('thermitecharge', 'Thermite Charge', 1, 0, 1),
('routes_normal', 'Low Routes', 1, 0, 1),
('routes_better', 'Mid Routes', 1, 0, 1),
('routes_elite', 'High Routes', 1, 0, 1);
```

## Step 3 - Edit fxmanifest

Open up the `fxmanifest.lua` file and uncomment the following line

```lua
shared_scripts {
    'config.lua',
    '@ox_lib/init.lua',
    -- '@es_extended/imports.lua' uncomment if using esx
}
```

## Step 4 - Upload Images

Add the images found in the images folder into your inventory script images folder if needed

## Step 5 - Make changes to configuration

Change the framework to `esx`

```lua
Config.Framework = "esx"
```

Change target to ox-target. If you are not using ox-target, open a ticket in Discord to add compatibility

```lua
Config.Target = "ox-target"
```

Change dispatch script to none. Currently there is no support for dispatch on esx. If you would like to get compatibility added, please open a ticket in Discord.

```lua
Config.Dispatch = "none"
```

Change payment type to an esx payment type. You can do: `money` `bank` `black_money`

```lua
Config.PaymentType = "money"
```

Change `Config.GetPlayerIdentifier` to esx version

```lua
function Config.GetPlayerIdentifier(src)
    -- QB Core
    --local Player = QBCore.Functions.GetPlayer(src)
    --if not Player then return nil end
    --return Player.PlayerData.citizenid

    -- ESX
    local Player = ESX.GetPlayerFromId(src)
    if not Player then return nil end
    return Player.identifier
end
```

Change `Config.GetPlayerByIdentifier` to esx version

```lua
function Config.GetPlayerByIdentifier(identifier)
    -- QB Core
    --return QBCore.Functions.GetPlayerByCitizenId(identifier)

    -- ESX
    return ESX.GetPlayerFromIdentifier(identifier)
end
```

Change `Config.Email` to esx version

```lua
function Config.Email(sender, subject, text)
    -- qb-phone
    -- TriggerServerEvent("qb-phone:server:sendNewMail", {
    --     sender = sender,
    --     subject = subject,
    --     message = text,
    --     button = {}
    -- })

    -- qs-smartphone
    --TriggerServerEvent("qs-smartphone:server:sendNewMail", {
    --    sender = sender,
    --    subject = subject,
    --    message = text,
    --    button = {}
    --})

    -- lb-phone
    --TriggerServerEvent("es-banktrucks:Server:lbmail", subject, text)

    -- ESX Notification
    local mugshot, mugshotStr = ESX.Game.GetPedMugshot(PlayerPedId())
    ESX.ShowAdvancedNotification(sender, subject, text, mugshotStr, 2, false, true)
    UnregisterPedheadshot(mugshot)
end
```

## Step 6 - Configure

Configure to your liking. It is very lengthy because it contains the data for the missions. I recommend that you do not mess with any of the mission data, other than stuff like costs, rewards, spawns, ect. You should not be editing stuff like the names of missions, ect, as you will probably break something. It is already pre-configured so you shouldn't have to change much other than what I mentioned above.


---

# 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/esx/bank-trucks/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.
