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 | ps-fuel | ox_fuel
LegacyFuel
1) Go to LegacyFuel > source > fuel_client.lua and find (around line 205)
2) Then replace it with
ps-fuel
1) Go to ps-fuel > client > client.lua and find (around line 254)
2) Then replace it with
ox_fuel
1) Go to ox_fuel > client > fuel.lua and find (around line 48)
2) Then replace it with
4) Battery item
Add the following to your qb-core > shared > items.lua
Also drop the image found in image folder, inside qb-inventory > html > images
if IsControlJustReleased(0, 38) then
isFueling = true
TriggerEvent('fuel:refuelFromPump', isNearPump, ped, vehicle)
LoadAnimDict("timetable@gardener@filling_can")
end
if IsControlJustReleased(0, 38) then
local vehModel = GetEntityModel(vehicle)
QBCore.Functions.TriggerCallback('lumio-electric:server:getCarTypeQB', 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
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)
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:getCarTypeQB', 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)
function fuel.startFueling(vehicle, isPump)
local vehState = Entity(vehicle).state
local fuelAmount = vehState.fuel or GetVehicleFuelLevel(vehicle)
local duration = math.ceil((100 - fuelAmount) / config.refillValue) * config.refillTick
local price, moneyAmount
local durability = 0
if 100 - fuelAmount < config.refillValue then
return lib.notify({ type = 'error', description = locale('tank_full') })
end
if isPump then
price = 0
moneyAmount = utils.getMoney()
if config.priceTick > moneyAmount then
return lib.notify({
type = 'error',
description = locale('not_enough_money', config.priceTick)
})
end
elseif not state.petrolCan then
return lib.notify({ type = 'error', description = locale('petrolcan_not_equipped') })
elseif state.petrolCan.metadata.ammo <= config.durabilityTick then
return lib.notify({
type = 'error',
description = locale('petrolcan_not_enough_fuel')
})
end
state.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',
},
})
state.isFueling = false
end)
while state.isFueling do
if isPump then
price += config.priceTick
if price + config.priceTick >= moneyAmount and lib.progressActive() then
lib.cancelProgress()
end
elseif state.petrolCan then
durability += config.durabilityTick
if durability >= state.petrolCan.metadata.ammo then
lib.cancelProgress()
durability = state.petrolCan.metadata.ammo
break
end
else
break
end
fuelAmount += config.refillValue
if fuelAmount >= 100 then
state.isFueling = false
fuelAmount = 100.0
end
Wait(config.refillTick)
end
ClearPedTasks(cache.ped)
if isPump then
TriggerServerEvent('ox_fuel:pay', price, fuelAmount, NetworkGetNetworkIdFromEntity(vehicle))
else
TriggerServerEvent('ox_fuel:updateFuelCan', durability, NetworkGetNetworkIdFromEntity(vehicle), fuelAmount)
end
end
function fuel.startFueling(vehicle, isPump)
local vehState = Entity(vehicle).state
local fuelAmount = vehState.fuel or GetVehicleFuelLevel(vehicle)
local duration = math.ceil((100 - fuelAmount) / config.refillValue) * config.refillTick
local price, moneyAmount
local durability = 0
local vehModel = GetEntityModel(vehicle)
local isElectric = lib.callback.await('lumio-electric:server:getCarTypeOX', false, vehModel)
if isElectric then
return lib.notify({
type = 'error',
description = 'Vehicle is electric and cannot be refueled with petrol.'
})
end
if 100 - fuelAmount < config.refillValue then
return lib.notify({ type = 'error', description = locale('tank_full') })
end
if isPump then
price = 0
moneyAmount = utils.getMoney()
if config.priceTick > moneyAmount then
return lib.notify({
type = 'error',
description = locale('not_enough_money', config.priceTick)
})
end
elseif not state.petrolCan then
return lib.notify({ type = 'error', description = locale('petrolcan_not_equipped') })
elseif state.petrolCan.metadata.ammo <= config.durabilityTick then
return lib.notify({
type = 'error',
description = locale('petrolcan_not_enough_fuel')
})
end
state.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',
},
})
state.isFueling = false
end)
while state.isFueling do
if isPump then
price += config.priceTick
if price + config.priceTick >= moneyAmount and lib.progressActive() then
lib.cancelProgress()
end
elseif state.petrolCan then
durability += config.durabilityTick
if durability >= state.petrolCan.metadata.ammo then
lib.cancelProgress()
durability = state.petrolCan.metadata.ammo
break
end
else
break
end
fuelAmount += config.refillValue
if fuelAmount >= 100 then
state.isFueling = false
fuelAmount = 100.0
end
Wait(config.refillTick)
end
ClearPedTasks(cache.ped)
if isPump then
TriggerServerEvent('ox_fuel:pay', price, fuelAmount, NetworkGetNetworkIdFromEntity(vehicle))
else
TriggerServerEvent('ox_fuel:updateFuelCan', durability, NetworkGetNetworkIdFromEntity(vehicle), fuelAmount)
end
end
['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'},