> For the complete documentation index, see [llms.txt](https://docs.veryinsanee.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.veryinsanee.space/advanced-roleplay-environment/installation.md).

# Installation

{% hint style="info" %}
**Note:** This script can be used with any framework since it has no dependencies.
{% endhint %}

## General

### Basic Installation

1. Download the script from the [FiveM Asset Manager](https://keymaster.fivem.net/asset-grants).
2. Extract the <mark style="color:yellow;">`visn_are.pack.zip`</mark>-archive into your <mark style="color:yellow;">`resources`</mark> folder.
3. Rename <mark style="color:yellow;">`visn_are.pack`</mark> to <mark style="color:yellow;">`visn_are`</mark>.
4. Open the <mark style="color:yellow;">`configuration`</mark> folder inside the <mark style="color:yellow;">`visn_are`</mark>-folder.
5. Customize the <mark style="color:yellow;">`client_config.lua`</mark> and <mark style="color:yellow;">`server_config.lua`</mark> to your needs.
6. Start the script.

![The console output should look like this if you have done everything correct.](/files/xgCdWVCAMQFzC17Hc0lc)

## ESX Integration

### esx\_ambulancejob integration

If you are using esx\_ambulancejob go into <mark style="color:yellow;">`esx_ambulancejob/client/main.lua`</mark> and replace:

{% tabs %}
{% tab title="Old" %}
{% code title="esx\_ambulancejob\client\main.lua" %}

```lua
AddEventHandler('esx:onPlayerSpawn', function()
	isDead = false
	
	if firstSpawn then
		firstSpawn = false
	
		if Config.SaveDeathStatus then
			while not ESX.PlayerLoaded do
				Wait(1000)
			end
	
			ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie)
				if shouldDie then
					Wait(1000)
					SetEntityHealth(PlayerPedId(), 0)
				end
			end)
		end
	end
end)

function OnPlayerDeath()
    isDead = true
    ESX.UI.Menu.CloseAll()
    TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)

    StartDeathTimer()
    StartDistressSignal()

    StartScreenEffect('DeathFailOut', 0, false)
end
```

{% endcode %}
{% endtab %}

{% tab title="New" %}
{% code title="esx\_ambulancejob\client\main.lua" %}

```lua
AddEventHandler('esx:onPlayerSpawn', function()
    isDead = false
end)

function OnPlayerDeath()
    ESX.UI.Menu.CloseAll()
end
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Command Implementation

{% tabs %}
{% tab title="Revive Command (esx\_ambulancejob)" %}
To integrate the revive command, please do the following:

1. Open the file <mark style="color:yellow;">`server/main.lua`</mark> inside the <mark style="color:yellow;">`esx_ambulancejob`</mark>-folder and search for the command "revive" and replace it with following code.

{% tabs %}
{% tab title="ESX 1.1 or older" %}
{% code title="server/main.lua" %}

```lua
TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args ,user)
    if args[1] ~= nil then
        if GetPlayerName(tonumber(args[1])) ~= nil then
            TriggerClientEvent('esx_ambulancejob:revive', tonumber(args[1]))
            TriggerClientEvent('visn_are:resetHealthBuffer', tonumber(args[1]))
        end
    else
        TriggerClientEvent('esx_ambulancejob:revive', source)
        TriggerClientEvent('visn_are:resetHealthBuffer', source)
    end
end, function(source, args, user)
    TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient permissions.'}})
end, { help = _U('revive_help'), params = {{ name = 'id'}}})
```

{% endcode %}
{% endtab %}

{% tab title="ESX 1.2, Legacy or newer" %}
{% code title="server/main.lua" %}

```lua
ESX.RegisterCommand('revive', 'admin', function(xPlayer, args, showError)
    args.playerId.triggerEvent('esx_ambulancejob:revive')
    args.playerId.triggerEvent('visn_are:resetHealthBuffer')
end, true, {help = _U('revive_help'), validate = true, arguments = { {name = 'playerId', help = 'The player id', type = 'player'} }})
```

{% endcode %}
{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## QBCore Integration

### qb-ambulancejob Integration

If you are using qb-ambulancejob go into <mark style="color:yellow;">`qb-ambulancejob/fxmanifest.lua`</mark> and remove the following lines from client\_scripts:

```lua
'client/wounding.lua'
'client/laststand.lua'
'client/dead.lua'
```

### Command Implementation

{% tabs %}
{% tab title="Revive Command (qb-ambulancejob)" %}
To integrate the revive command, please do the following:

1. Open the file <mark style="color:yellow;">`server/main.lua`</mark> inside the <mark style="color:yellow;">`qb-ambulancejob`</mark>-folder and search for the command "revive" and replace it with following code.

{% tabs %}
{% tab title="qb-ambulancejob 1.0.0" %}
{% code title="server/main.lua" %}

```lua

QBCore.Commands.Add("revive", Lang:t('info.revive_player_a'), {{name = "id", help = Lang:t('info.player_id')}}, false, function(source, args)
	local src = source
	if args[1] then
		local Player = QBCore.Functions.GetPlayer(tonumber(args[1]))
		if Player then
			TriggerClientEvent('hospital:client:Revive', Player.PlayerData.source)
			TriggerClientEvent('visn_are:resetHealthBuffer', Player.PlayerData.source)
		else
			TriggerClientEvent('QBCore:Notify', src, Lang:t('error.not_online'), "error")
		end
	else
		TriggerClientEvent('hospital:client:Revive', src)
		TriggerClientEvent('visn_are:resetHealthBuffer', src)
	end
end, "admin")
```

{% endcode %}
{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

## Standalone Integration

This script works out of the box for standalone. If you want to integrate custom framework things, have a look inside <mark style="color:yellow;">`visn_are/script/helpers/s_functions.lua`</mark>.

### Revive Command

A revive command is included in the script. You can enable it in the Server Config. In order to customize the permissions for it have a look inside <mark style="color:yellow;">`visn_are/script/helpers/s_functions.lua`</mark>.
