# Installation

## 1) Go to keymaster and download the package

You can find your keymaster [here](https://keymaster.fivem.net/asset-grants), you'll need to login with your Fivem account. Make sure you get the right account because when you purchase the package, it is connected to the Fivem account you logged into.

Once logged in, you can download the package! Downloading the package is as easy as just pressing one button.&#x20;

<figure><img src="https://713169216-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSMUcNL0KU9J3ibGqYNJJ%2Fuploads%2FgRThI5wAN8QuiypVTAaI%2Fimage.png?alt=media&#x26;token=7da322bb-7a9a-40ef-811e-79792f8c5c58" alt=""><figcaption></figcaption></figure>

## 2) Putting it in the server

Unzip the folder and drop it into one of your folders inside **resources**.

<details>

<summary>resources</summary>

\[cfx-default]

\[core]

**\[esx\_addons]** -> Drop here

**\[standalone]** -> Or here

loadingscreen

</details>

## 3) LegacyFuel

If you use LegacyFuel as dependency follow these steps. If you do not have it you can download it [here](https://github.com/InZidiuZ/LegacyFuel/releases/tag/v1.1).

Making it so electric cars can't refuel at gas station: Go to `LegacyFuel > source > fuel_client.lua > line 221` and change this:

```lua
if IsControlJustReleased(0, 38) then
    isFueling = true
    TriggerEvent('fuel:refuelFromPump', isNearPump, ped, vehicle)
    LoadAnimDict("timetable@gardener@filling_can")
end
```

To This:

```lua
if IsControlJustReleased(0, 38) then
    ESX.TriggerServerCallback('lumio-electric:server:isElectric', function(isElectric)
        if not isElectric then
            isFueling = true

            TriggerEvent('fuel:refuelFromPump', isNearPump, ped, vehicle)
            LoadAnimDict("timetable@gardener@filling_can")
        else
            ESX.ShowNotification('Vehicle is electric, go charge it', "error")
        end
    end, GetEntityModel(vehicle))
end
```

Then go to `LegacyFuel > fxmanifest.lua` and change this:

```lua
client_scripts {
    'config.lua',
    'functions/functions_client.lua',
    'source/fuel_client.lua'
}
```

To this:

```lua
client_scripts {
    '@es_extended/locale.lua',
    '@es_extended/imports.lua',
    'config.lua',
    'functions/functions_client.lua',
    'source/fuel_client.lua'
}

dependencies {
    'es_extended',
}
```

## 3) ox\_fuel

If you use ox\_fuel as dependency follow these steps. If you do not have it you can download it [here](https://github.com/overextended/ox_fuel/releases).

Making it so electric cars can't refuel at gas station: Go to `ox_fuel > client.lua > line 209` and change this:

```lua
local function startFueling(vehicle, isPump)
	local Vehicle = Entity(vehicle).state
	local fuel = Vehicle.fuel or GetVehicleFuelLevel(vehicle)
	local duration = math.ceil((100 - fuel) / Config.refillValue) * Config.refillTick
	local price, moneyAmount
	local durability = 0

	if 100 - fuel < Config.refillValue then
		return lib.notify({type = 'error', description = locale('tank_full')})
	end

	if isPump then
		price = 0
		moneyAmount = getMoneyAmount()

		if Config.priceTick > moneyAmount then
			return lib.notify({
				type = 'error',
				description = locale('not_enough_money', Config.priceTick)
			})
		end
	elseif not fuelingCan then
		return lib.notify({type = 'error', description = locale('petrolcan_not_equipped')})
	elseif fuelingCan.metadata.ammo <= Config.durabilityTick then
		return lib.notify({
			type = 'error',
			description = locale('petrolcan_not_enough_fuel')
		})
	end

	isFueling = true

	TaskTurnPedToFaceEntity(cache.ped, vehicle, duration)
	Wait(500)

	CreateThread(function()
		lib.progressCircle({
			duration = duration,
			useWhileDead = false,
			canCancel = true,
			disable = {
				move = true,
				car = true,
				combat = true,
			},
			anim = {
				dict = isPump and 'timetable@gardener@filling_can' or 'weapon@w_sp_jerrycan',
				clip = isPump and 'gar_ig_5_filling_can' or 'fire',
			},
		})

		isFueling = false
	end)

	while isFueling do
		if isPump then
			price += Config.priceTick

			if price + Config.priceTick >= moneyAmount then
				lib.cancelProgress()
			end
		else
			durability += Config.durabilityTick

			if durability >= fuelingCan.metadata.ammo then
				lib.cancelProgress()
				durability = fuelingCan.metadata.ammo
				break
			end
		end

		fuel += Config.refillValue

		if fuel >= 100 then
			isFueling = false
			fuel = 100.0
		end

		Wait(Config.refillTick)
	end

	ClearPedTasks(cache.ped)

	if isPump then
		TriggerServerEvent('ox_fuel:pay', price, fuel, NetworkGetNetworkIdFromEntity(vehicle))
	else
		TriggerServerEvent('ox_fuel:updateFuelCan', durability, NetworkGetNetworkIdFromEntity(vehicle), fuel)
	end
end
```

To this:

```lua
local function startFueling(vehicle, isPump)
	local Vehicle = Entity(vehicle).state
	local fuel = Vehicle.fuel or GetVehicleFuelLevel(vehicle)
	local duration = math.ceil((100 - fuel) / Config.refillValue) * Config.refillTick
	local price, moneyAmount
	local durability = 0

	ESX.TriggerServerCallback('lumio-electric:server:isElectric', function(isElectric)
        if not isElectric then
			if 100 - fuel < Config.refillValue then
				return lib.notify({type = 'error', description = locale('tank_full')})
			end

			if isPump then
				price = 0
				moneyAmount = getMoneyAmount()

				if Config.priceTick > moneyAmount then
					return lib.notify({
						type = 'error',
						description = locale('not_enough_money', Config.priceTick)
					})
				end
			elseif not fuelingCan then
				return lib.notify({type = 'error', description = locale('petrolcan_not_equipped')})
			elseif fuelingCan.metadata.ammo <= Config.durabilityTick then
				return lib.notify({
					type = 'error',
					description = locale('petrolcan_not_enough_fuel')
				})
			end

			isFueling = true

			TaskTurnPedToFaceEntity(cache.ped, vehicle, duration)
			Wait(500)

			CreateThread(function()
				lib.progressCircle({
					duration = duration,
					useWhileDead = false,
					canCancel = true,
					disable = {
						move = true,
						car = true,
						combat = true,
					},
					anim = {
						dict = isPump and 'timetable@gardener@filling_can' or 'weapon@w_sp_jerrycan',
						clip = isPump and 'gar_ig_5_filling_can' or 'fire',
					},
				})

				isFueling = false
			end)

			while isFueling do
				if isPump then
					price += Config.priceTick

					if price + Config.priceTick >= moneyAmount then
						lib.cancelProgress()
					end
				else
					durability += Config.durabilityTick

					if durability >= fuelingCan.metadata.ammo then
						lib.cancelProgress()
						durability = fuelingCan.metadata.ammo
						break
					end
				end

				fuel += Config.refillValue

				if fuel >= 100 then
					isFueling = false
					fuel = 100.0
				end

				Wait(Config.refillTick)
			end

			ClearPedTasks(cache.ped)

			if isPump then
				TriggerServerEvent('ox_fuel:pay', price, fuel, NetworkGetNetworkIdFromEntity(vehicle))
			else
				TriggerServerEvent('ox_fuel:updateFuelCan', durability, NetworkGetNetworkIdFromEntity(vehicle), fuel)
			end
		else
			ESX.ShowNotification('Vehicle is electric, go charge it', "error")
		end
	end, GetEntityModel(vehicle))
end
```

Then go to `ox_fuel > fxmanifest.lua` and change this:

<pre class="language-lua"><code class="lang-lua">shared_scripts {
<strong>    '@ox_lib/init.lua',
</strong>    'config.lua'
}
</code></pre>

To this:

```lua
shared_scripts {
    '@ox_lib/init.lua',
    '@es_extended/imports.lua',
    'config.lua'
}
```

## 4) Start the script

Start the script and enjoy! For configuration info go to the next page :smile:


---

# 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://lumio-studio.gitbook.io/intro/evs-esx/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.
