Page cover image

💻Installation

Don't know how to install the script? Don't worry, we are here to help!

1) Go to keymaster and download the package

You can find your keymaster here, 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.

2) Putting it in the server

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

resources

[cfx-default]

[core]

[esx_addons] -> Drop here

[standalone] -> Or here

loadingscreen

3) LegacyFuel

If you use LegacyFuel as dependency follow these steps. If you do not have it you can download it here.

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

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

To This:

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:

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

To this:

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.

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

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:

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:

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

To this:

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 😄

Last updated