🟠Exports

This page is for developers who want to utilize some of ours functions and exports within their scripts

Lua
JS
GetFuel(Vehicle: entity)
  -- Get the closest vehicle using QBCore.Functions.GetClosestVehicle()
  local vehicle = QBCore.Functions.GetClosestVehicle()
  -- Get the fuel amount of the closest vehicle using exports['vt-fuel']:GetFuel(vehicle)
  local fuel = exports['vt-fuel']:GetFuel(vehicle)
  -- Print the fuel amount of the closest vehicle
  print(fuel)
function GetFuel(vehicle) {
  // Get the closest vehicle using QBCore.Functions.GetClosestVehicle()
  var closestVehicle = QBCore.Functions.GetClosestVehicle();
  // Get the fuel amount of the closest vehicle using exports['vt-fuel'].GetFuel(vehicle)
  var fuel = exports['vt-fuel'].GetFuel(closestVehicle);
  // Print the fuel amount of the closest vehicle
  console.log(fuel);
}

// Call the GetFuel function with a vehicle entity
var myVehicle = /* Your vehicle */;
GetFuel(myVehicle);

Last updated