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]

[qb] -> Drop here

[standalone] -> Or here

[voice]

3) LegacyFuel or ps-fuel

LegacyFuel

1) Go to LegacyFuel > source > fuel_client.lua and find (around line 205)

if IsControlJustReleased(0, 38) then
    isFueling = true

    TriggerEvent('fuel:refuelFromPump', isNearPump, ped, vehicle)
    LoadAnimDict("timetable@gardener@filling_can")
end

2) Then replace it with

if IsControlJustReleased(0, 38) then
    local vehModel = GetEntityModel(vehicle)
    QBCore.Functions.TriggerCallback('lumio-electric:server:getCarType', function(isElectric)
        if isElectric then
            QBCore.Functions.Notify("Vehicle is electric, go to charging station")
        else
            isFueling = true
        end
    end, vehModel)

    TriggerEvent('fuel:refuelFromPump', isNearPump, ped, vehicle)
    LoadAnimDict("timetable@gardener@filling_can")
end

ps-fuel

1) Go to ps-fuel > client > client.lua and find (around line 254)

RegisterNetEvent('ps-fuel:client:SendMenuToServer', function()
    local vehicle = QBCore.Functions.GetClosestVehicle()
    local CurFuel = GetVehicleFuelLevel(vehicle)
    local refillCost = Round(Config.RefillCost - CurFuel) * Config.CostMultiplier
    local ped = PlayerPedId()
	
    if HasPedGotWeapon(ped, 883325847) then
	if GetAmmoInPedWeapon(ped, 883325847) ~= 0 then
	    if CurFuel < 95 then
		TriggerServerEvent('ps-fuel:server:OpenMenu', 0, inGasStatio, true)
	    else
		QBCore.Functions.Notify(Lang:t("notify.vehicle_full"), "error")
	    end
	else
	    QBCore.Functions.Notify(Lang:t("notify.jerrycan_empty"), "error")
	end
    else
	if CurFuel < 95 then
	    TriggerServerEvent('ps-fuel:server:OpenMenu', refillCost, inGasStation, false)
	else
	    QBCore.Functions.Notify(Lang:t("notify.vehicle_full"), "error")
	end
    end
end)

2) Then replace it with

RegisterNetEvent('ps-fuel:client:SendMenuToServer', function()
    local vehicle = QBCore.Functions.GetClosestVehicle()
    local vehModel = GetEntityModel(vehicle)
    local CurFuel = GetVehicleFuelLevel(vehicle)
    local refillCost = Round(Config.RefillCost - CurFuel) * Config.CostMultiplier
    local ped = PlayerPedId()
	
    QBCore.Functions.TriggerCallback('lumio-electric:server:getCarType', function(isElectric)
    	if isElectric then
            QBCore.Functions.Notify("Vehicle is electric, go to charging station")
        else
	    if HasPedGotWeapon(ped, 883325847) then
		if GetAmmoInPedWeapon(ped, 883325847) ~= 0 then
		    if CurFuel < 95 then
			TriggerServerEvent('ps-fuel:server:OpenMenu', 0, inGasStatio, true)
		    else
			QBCore.Functions.Notify(Lang:t("notify.vehicle_full"), "error")
		    end
		else
		    QBCore.Functions.Notify(Lang:t("notify.jerrycan_empty"), "error")
		end
	    else
		if CurFuel < 95 then
		    TriggerServerEvent('ps-fuel:server:OpenMenu', refillCost, inGasStation, false)
		else
		    QBCore.Functions.Notify(Lang:t("notify.vehicle_full"), "error")
		end
	    end
	end
    end, vehModel)
end)

4) Battery item

Add the following to your qb-core > shared > items.lua

    ['car_battery']                     = {['name'] = 'car_battery',                       ['label'] = 'Car battery',               ['weight'] = 10000,        ['type'] = 'item',         ['image'] = 'car_battery.png',             ['unique'] = false,         ['useable'] = true,      ['shouldClose'] = true,      ['combinable'] = nil,   ['description'] = 'Small amount of battery for your electric car'},

Also drop the image found in image folder, inside qb-inventory > html > images

5) Optional map

Download this map and start it. This is optional.

6) Start the script

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

Last updated