# Installation Guide

## Ambulance Job Script Installation Guide

This page is dedicated to installation of our Ambulance Job script. Follow steps listed below to start using pScripts Ambulance Job on your server.

{% hint style="danger" %}
Remember to DELETE all other Ambulance Jobs!
{% endhint %}

### Prerequisities

Before you begin, ensure you have:

1. FiveM server with administrator access
2. Access to your server's database
3. File transfer capability (FTP or direct file access)

## Step 1: Installing the dependencies

Our script requires 4 dependencies:

1. [ox\_lib](https://github.com/overextended/ox_lib)
2. [oxmysql](https://github.com/overextended/oxmysql/releases)
3. [ox\_target ](https://github.com/overextended/ox_target/releases)/ [qb-target](https://github.com/qbcore-framework/qb-target)
4. [p\_bridge](https://github.com/PiotreeQ/p_bridge)

*Additionaly, we recommend you use* [*MariaDB*](https://mariadb.org/) *as your Database Management System.*

## Step 2: Setting up the Database

For our script to work, you need to modify your database. Choose your framework and run given sql commands.

<details>

<summary>ESX</summary>

```sql
ALTER TABLE `users`
    ADD `ambulanceData` longtext NOT NULL DEFAULT '{"health": 200, "armor": 0, "type": "none", "damages": "{}"}';

CREATE TABLE `medic_outfits` (
  `id` int(11) NOT NULL,
  `job` varchar(30) NOT NULL,
  `grade` longtext NOT NULL,
  `label` varchar(60) NOT NULL,
  `gender` varchar(10) NOT NULL,
  `license` longtext DEFAULT 'none',
  `requirements` varchar(50) NOT NULL,
  `skin` longtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

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

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

CREATE TABLE `health_insurances` (
  `owner` varchar(60) NOT NULL,
  `insurance` varchar(30) NOT NULL,
  `duration` bigint(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

ALTER TABLE `health_insurances`
  ADD PRIMARY KEY (`owner`);
COMMIT;
```

</details>

<details>

<summary>QB/QBOX</summary>

```sql
ALTER TABLE `players`
    ADD `ambulanceData` longtext NOT NULL DEFAULT '{"health": 200, "armor": 0, "type": "none", "damages": "{}"}';

CREATE TABLE `medic_outfits` (
  `id` int(11) NOT NULL,
  `job` varchar(30) NOT NULL,
  `grade` longtext NOT NULL,
  `label` varchar(60) NOT NULL,
  `gender` varchar(10) NOT NULL,
  `license` longtext DEFAULT 'none',
  `requirements` varchar(50) NOT NULL,
  `skin` longtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

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

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

CREATE TABLE `health_insurances` (
  `owner` varchar(60) NOT NULL,
  `insurance` varchar(30) NOT NULL,
  `duration` bigint(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

ALTER TABLE `health_insurances`
  ADD PRIMARY KEY (`owner`);
COMMIT;
```

</details>

You can run these on your preferred Database Management Tool (ex. HeidiSQL, phpMyAdmin etc.)

## Step 3: Downloading the Script

1. Download the script from your [Keymaster](https://portal.cfx.re/assets/granted-assets).
2. Extract the files to your resources (or any other preffered) folder.
3. Go to `INSTALL` folder and add **Items** and **Icons** for your Inventory
4. Add the following line to your `server.cfg`\\

   ```
   ensure p_ambulancejob
   ```

## Step 4: Configuration

1. Open `config.lua` file in the Script folder
2. Configure our script basing on your needs.

## Step 5: P\_Bridge Configuration

1. Download and extract [p\_bridge](https://github.com/PiotreeQ/p_bridge) onto your server.
2. Configure p\_bridge and its funtions in `config.lua`
3. Add the following line to your `server.cfg`

<pre><code><strong>ensure p_bridge
</strong></code></pre>

{% hint style="danger" %}
Make sure p\_bridge starts before any of **OUR** scripts
{% endhint %}

## Step 6: Start using our script

1. Save all changes
2. Restart / Start your FiveM server

Enjoy using our Ambulance Job! :tada:
