Implementations

you can use this guide to implement, fuel scripts, car keys, and more, all of this its on config.lua

Car keys

Config.Carkeys = function(source, plate)
    print("Sending Keys")
    TriggerClientEvent('vehiclekeys:client:SetOwner', source, plate) -- THIS EVENT IS QBCORE CAR KEYS!, replace the event name to your carkeys event
end

Fuel System for mission

Config.MissionFuel = true --  the missions vehicles will lose fuel fast to mandatory the player to use the flatbed3 vehicle to transport the vehicle
Config.TimeToEmpty = .40   -- 40 seconds to empty the fuel change the .4 to 1 to make it 1 minute, this value is in minutes (1 = 1 minute), the vehicle will lose fuel every second and when pass the time it will be empty
Config.SetVehicleFuel = function(vehicle, fuelLevel)
    if GetResourceState('qs-fuelstations') == 'started' then
        exports['qs-fuelstations']:SetFuel(vehicle, fuelLevel)
    elseif GetResourceState('LegacyFuel') == 'started' then
        exports["LegacyFuel"]:SetFuel(vehicle, fuelLevel)
    else
        ErrorPrint("Fuel System not found, please add qs-fuelstations or LegacyFuel to your resources or if it not possible add your fuel system to the config.lua Config.SerVehicleFuel and Config.GetVehicleFuel functions")
        SetVehicleFuelLevel(vehicle, fuelLevel)
    end
end
Config.GetVehicleFuel = function(vehicle)
    local fuelLevel = 100

    if GetResourceState('qs-fuelstations') == 'started' then
        fuelLevel = exports['qs-fuelstations']:GetFuel(vehicle)
    elseif GetResourceState('LegacyFuel') == 'started' then
        fuelLevel = exports["LegacyFuel"]:GetFuel(vehicle)
    else
        fuelLevel = GetVehicleFuelLevel(vehicle)
    end

    return fuelLevel
end

Last updated