# Installation guide

{% hint style="danger" %}
If you don't have any experience in development we are highly recommend to follow each step in this documentation, and if you have a developer ask them to install the script for you as they have more experience.
{% endhint %}

***

## Asset download&#x20;

{% hint style="success" %}
Once the purchase is made on our [<mark style="color:blue;">official website</mark>](https://store.brutalscripts.com), you will receive your asset directly in your [<mark style="color:blue;">Keymaster</mark>](https://keymaster.fivem.net), in the Granted Assets panel you will see the asset, download it and do the following steps to install it correctly.
{% endhint %}

* Put the script folder to your server.
* Start the script in the server.cfg. (ensure brutal\_ambulancejob)
* Restart your server! (And you get permission to use the script)

{% hint style="info" %}
[<mark style="color:blue;">**Click here if you haven't installed any script ever**</mark>](https://www.youtube.com/watch?v=55RQrpLhs1w)
{% endhint %}

***

## Upload the SQL

{% hint style="warning" %}
Do not rename your previous SQL or columns to adapt them to this system, use the complete database without making use of edits in your old databases.
{% endhint %}

{% tabs %}
{% tab title="ESX" %}

```sql
CREATE TABLE IF NOT EXISTS `ambulance_invoice_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `label` varchar(255) COLLATE utf8_hungarian_ci DEFAULT NULL,
  `amount` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci;

INSERT INTO `ambulance_invoice_types` (`id`, `label`, `amount`) VALUES
	(1, 'Medical Care', 670),
	(2, 'Hand breakage', 2000),
	(3, 'Leg fracture', 3000),
	(4, 'Gunshot wound care', 1650),
	(5, 'Head injury', 1340);
	
ALTER TABLE `users`
	ADD `is_dead` TINYINT(1) NULL DEFAULT '0'
;
```

{% endtab %}

{% tab title="QBCORE" %}

```sql
CREATE TABLE IF NOT EXISTS `ambulance_invoice_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `label` varchar(255) COLLATE utf8_hungarian_ci DEFAULT NULL,
  `amount` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_hungarian_ci;

INSERT INTO `ambulance_invoice_types` (`id`, `label`, `amount`) VALUES
	(1, 'Medical Care', 670),
	(2, 'Hand breakage', 2000),
	(3, 'Leg fracture', 3000),
	(4, 'Gunshot wound care', 1650),
	(5, 'Head injury', 1340);
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
If you don't have the sql tables for your core's ambulance job then upload these too below!
{% endhint %}

<details>

<summary>ESX</summary>

```sql
INSERT INTO `addon_account` (name, label, shared) VALUES
	('society_ambulance', 'Ambulance', 1)
;

INSERT INTO `addon_inventory` (name, label, shared) VALUES
	('society_ambulance', 'Ambulance', 1)
;

INSERT INTO `datastore` (name, label, shared) VALUES
	('society_ambulance', 'Ambulance', 1)
;

INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
	('ambulance',0,'ambulance','Paramedic',20,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'),
	('ambulance',1,'doctor','Doctor',40,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'),
	('ambulance',2,'chief_doctor','Chief Doctor',60,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}'),
	('ambulance',3,'boss','Director',80,'{\"tshirt_2\":0,\"hair_color_1\":5,\"glasses_2\":3,\"shoes\":9,\"torso_2\":3,\"hair_color_2\":0,\"pants_1\":24,\"glasses_1\":4,\"hair_1\":2,\"sex\":0,\"decals_2\":0,\"tshirt_1\":15,\"helmet_1\":8,\"helmet_2\":0,\"arms\":92,\"face\":19,\"decals_1\":60,\"torso_1\":13,\"hair_2\":0,\"skin\":34,\"pants_2\":5}','{\"tshirt_2\":3,\"decals_2\":0,\"glasses\":0,\"hair_1\":2,\"torso_1\":73,\"shoes\":1,\"hair_color_2\":0,\"glasses_1\":19,\"skin\":13,\"face\":6,\"pants_2\":5,\"tshirt_1\":75,\"pants_1\":37,\"helmet_1\":57,\"torso_2\":0,\"arms\":14,\"sex\":1,\"glasses_2\":0,\"decals_1\":0,\"hair_2\":0,\"helmet_2\":0,\"hair_color_1\":0}')
;

INSERT INTO `jobs` (name, label) VALUES
	('ambulance','EMS')
;

INSERT INTO `items` (name, label, weight) VALUES
	('bandage','Bandage', 2),
	('medikit','Medikit', 2)
;

ALTER TABLE `users`
	ADD `is_dead` TINYINT(1) NULL DEFAULT '0'
;
```

</details>

{% hint style="info" %}
[<mark style="color:blue;">**Click here if you don't know how to upload the sql, here is a quick guide**</mark>](https://www.youtube.com/watch?v=NXqmYn7bbMM)
{% endhint %}

{% embed url="<https://forum.cfx.re/t/how-to-how-to-import-an-sql-into-your-database/5168087/2>" %}

***

## Upload the items&#x20;

{% hint style="warning" %}
If you don't have the items integrated correctly, you will receive random errors.
{% endhint %}

{% hint style="danger" %}
Check that you don't have duplicate items in your inventory or database before integrating them, otherwise you might have some errors.
{% endhint %}

This asset depends on certain items for its operation, so don't forget to integrate all items correctly into your database or inventory system, depending on how you use your server.

If your inventory is not among the following, you can create the file yourself using the examples of each item by displaying any of the following tabs.

<details>

<summary>Items for esx_inventory</summary>

```sql
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES
('head_bandage', 'Head Bandage', 1, 0, 1),
('arm_wrap', 'Arm Wrap', 1, 0, 1),
('leg_plaster', 'Leg Plaster', 1, 0, 1),
('body_bandage', 'Body Bandage', 1, 0, 1),
('small_heal', 'Small Heal', 1, 0, 1),
('big_heal', 'Big Heal', 1, 0, 1);

INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES
('bandage', 'Bandage', 1, 0, 1),
('medikit', 'Medikit', 1, 0, 1);
```

</details>

<details>

<summary>Items for qb-inventory</summary>

```lua
['head_bandage'] 			 		 = {['name'] = 'head_bandage', 						['label'] = 'Head Bandage', 						['weight'] = 1, 		['type'] = 'item', 		['image'] = 'head_bandage.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
['arm_wrap'] 			 			 = {['name'] = 'arm_wrap', 							['label'] = 'Arm Wrap', 						['weight'] = 1, 		['type'] = 'item', 		['image'] = 'arm_wrap.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
['leg_plaster'] 					 = {['name'] = 'leg_plaster', 						['label'] = 'Leg Plaster', 						['weight'] = 1, 		['type'] = 'item', 		['image'] = 'leg_plaster.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
['body_bandage'] 					 = {['name'] = 'body_bandage', 						['label'] = 'Body Bandage', 						['weight'] = 1, 		['type'] = 'item', 		['image'] = 'body_bandage.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
['bandage'] 			 		 = {['name'] = 'bandage', 						['label'] = 'Bandage', 						['weight'] = 1, 		['type'] = 'item', 		['image'] = 'bandage.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
['medikit'] 			 			 = {['name'] = 'medikit', 							['label'] = 'Medikit', 						['weight'] = 1, 		['type'] = 'item', 		['image'] = 'medikit.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
['small_heal'] 					 = {['name'] = 'small_heal', 						['label'] = 'Small Heal', 						['weight'] = 1, 		['type'] = 'item', 		['image'] = 'small_heal.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
['big_heal'] 					 = {['name'] = 'big_heal', 						['label'] = 'Big Heal', 						['weight'] = 1, 		['type'] = 'item', 		['image'] = 'big_heal.png', 				['unique'] = false, 	['useable'] = true, 	['shouldClose'] = true,	   ['combinable'] = nil,   ['description'] = ''},
```

</details>

<details>

<summary>Items for ox-inventory</summary>

```lua
 ["body_bandage"] = {
        label = "Body Bandage",
        weight = 1,
        stack = true,
        close = true,
    },
    
    ["bandage"] = {
        label = "Bandage",
        weight = 1,
        stack = true,
        close = true,
    },
    
    ["medikit"] = {
        label = "Medikit",
        weight = 1,
        stack = true,
        close = true,
    },

    ["leg_plaster"] = {
        label = "Leg Plaster",
        weight = 1,
        stack = true,
        close = true,
    },

    ["small_heal"] = {
        label = "Small Heal",
        weight = 1,
        stack = true,
        close = true,
    },

    ["head_bandage"] = {
        label = "Head Bandage",
        weight = 1,
        stack = true,
        close = true,
    },

    ["big_heal"] = {
        label = "Big Heal",
        weight = 1,
        stack = true,
        close = true,
    },

    ["arm_wrap"] = {
        label = "Arm Wrap",
        weight = 1,
        stack = true,
        close = true,
    },
```

</details>

{% hint style="info" %}
[<mark style="color:blue;">**Click here if you don't know how to upload the sql, here is a quick guide**</mark>](https://www.youtube.com/watch?v=NXqmYn7bbMM)
{% endhint %}

{% hint style="success" %}
The images which we used to the items are in the **html/assets** folder
{% endhint %}

***

## Asset positioning

{% hint style="danger" %}
Correctly position the assets in the server.cfg by following this step, if something goes wrong you will probably get errors about exports not found, do not skip this step!
{% endhint %}

```lua
-- First we will start the cores, never below
ensure es_extended or qb-core

-- The Notify / TextUI or target system / Progressbar / Inventory / Billing have to be above our asset
ensure [notify]
ensure [inventory]
ensure [billing]
ensure [textui] -- or target system 

-- Start the Brutal Ambulance Job at the end
ensure brutal_ambulancejob
```

***

## Setting up the Webhook&#x20;

If you want to use the opportunnities which can be given by a webhook then you will have to set it up in our assets. You can do it by changeing a value to your [<mark style="color:blue;">discord webhook</mark>](https://docs.brutalscripts.com/site/others/discord-webhook) in the sv-utils.lua file.

<figure><img src="https://4039149930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7v0UUR2mr3gc8OlYzKhO%2Fuploads%2FYD3dBIsrNLZ1Jvx3Sm8L%2FK%C3%A9perny%C5%91k%C3%A9p%202024-02-16%20213349.png?alt=media&#x26;token=fa6bcf52-a448-4a88-acfe-f12faacb75a3" alt=""><figcaption><p>sv-utils.lua</p></figcaption></figure>

{% content-ref url="../../others/discord-webhook" %}
[discord-webhook](https://docs.brutalscripts.com/site/others/discord-webhook)
{% endcontent-ref %}

***

## Setting the loaded event

{% hint style="danger" %}
If you are using a multicharacter system then this step is really important to make our script working propetly! If you don't use any or the loaded event is the same as the basic core one then you are done with this step.
{% endhint %}

In the client-core.lua file go to the LoadedEvent variable and if you are using a different event then paste there your event which is used on your server.

<figure><img src="https://4039149930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7v0UUR2mr3gc8OlYzKhO%2Fuploads%2FiZsIrf5OSm3hfTPFbEiS%2FK%C3%A9perny%C5%91k%C3%A9p%202024-03-03%20210541.png?alt=media&#x26;token=c320d17a-ed65-4f76-8933-67914ef7b8c9" alt=""><figcaption><p>client-core.lua</p></figcaption></figure>

***

## Checking the Config file

Please make sure that you go through the whole file during the installation and check everything. It is one of the most important things as if you miss this step the script might won't work propetly.

### Most important steps

The most important things always at the top of the config so pay the most attencion to these elements.

<details>

<summary>Setting the Core</summary>

Set your server's core wether it's using es\_extended or qb-core, other cores aren't supported .

</details>

<details>

<summary>Setting the Notify</summary>

If you are using the [<mark style="color:blue;">Brutal Notify</mark>](https://docs.brutalscripts.com/site/scripts/notify) then it is good news, you don't have to do anything.\
If you aren't then set the BrutalNotify value to false in the config and set up your own notify in the cl-utils.lua

</details>

<details>

<summary>Setting the TextUI or Target</summary>

Set the TextUI from the options which are commented out. If your server using an other TextUI  it is not a problem, you can set it up in the cl-utils.lua. If you want to use a target system then set the TextUI to false and set your target.

</details>

***

## Using the script

{% hint style="danger" %}
To use any functions of the script players have to <mark style="color:red;">**duty in**</mark> every time they join to the server. If they miss this step then they won't be able to use the mdt and many other functions!
{% endhint %}

## Wheelchair

Download this resource or edit the WheelchairVehicle = 'iak\_wheelchair' in the config.lua.

{% file src="<https://4039149930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7v0UUR2mr3gc8OlYzKhO%2Fuploads%2FiGdJuBgnVhCOp8xzJNba%2Fiak_wheelchair.zip?alt=media&token=4aa218fd-0458-47c0-83ff-90251729aebc>" %}

***

## Editing framework

{% hint style="warning" %}
To use this script you will have to make some changes in your core. These steps have to be done to make our asset work 100% instead of the core police jo
{% endhint %}

{% tabs %}
{% tab title="ESX" %}
Navigate to **esx\_society/server/main.lua** and replace this function:

```lua
function isPlayerBoss(playerId, job)
	local xPlayer = ESX.GetPlayerFromId(playerId)

	if xPlayer.job.name == job then
		return true
	else
		print(('esx_society: %s attempted open a society boss menu!'):format(xPlayer.identifier))
		return false
	end
end
```

If you want the players only get paycheck if they are on duty then replace this function: **es\_extended/server /paycheck.lua**

{% file src="<https://4039149930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7v0UUR2mr3gc8OlYzKhO%2Fuploads%2FvD4GlLbC0DIU9sxVxIOo%2Fpaycheck.lua?alt=media&token=659bd54e-c835-486f-8ad7-01f009641b10>" %}
paycheck.lua
{% endfile %}
{% endtab %}

{% tab title="QBCORE" %}
Navigate to **qb-core/shared/job.lua** and set the **defaultDuty to false**:

<figure><img src="https://4039149930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7v0UUR2mr3gc8OlYzKhO%2Fuploads%2Fc3oGpy5qYXqRIzLIanMq%2Fimage.png?alt=media&#x26;token=2fda6646-eff3-4878-ad14-42102af3111b" alt=""><figcaption><p>job.lua</p></figcaption></figure>
{% endtab %}
{% endtabs %}

***

{% hint style="danger" %}

## Remove the basic Ambulance Job from your server

If you have the **esx\_ambulancejob**, **qb-ambulancejob**, or any other similar basic job like these, you don't need them anymore, so you can easily remove them from your server files!
{% endhint %}

## If you got any error

If you followed the installation guide and the script still don't work or you get any errors the please check the common errors, here in the docs and in our [<mark style="color:blue;">discord</mark> ](https://discord.gg/85u2u5c8q9)server, for more informations.
