A large selection of vehicle related functions to cover pretty much anything that should be needed.
Functions
get_vehicle_plate
Retrieves the license plate number of the specified vehicle.
--- Retreive Vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local plate = utils.vehicles.get_vehicle_plate(vehicle)
print("Vehicle Plate:", plate)
--- Direct export
local plate = exports.boii_utils:get_vehicle_plate(vehicle)
get_vehicle_model
Retrieves the model name of the specified vehicle.
--- Retreive Vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local model = utils.vehicles.get_vehicle_model(vehicle)
print("Vehicle Model:", model)
--- Direct export
local model = exports.boii_utils:get_vehicle_model(vehicle)
get_doors_broken
Returns a list of broken doors for the specified vehicle
--- Retreive Vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local doors_broken = utils.vehicles.get_doors_broken(vehicle)
print("Broken Doors:", json.encode(doors_broken))
--- Direct export
local doors_broken = exports.boii_utils:get_doors_broken(vehicle)
get_window_broken
Returns a list of broken windows for the specified vehicle.
--- Retreive vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local windows_broken = utils.vehicles.get_windows_broken(vehicle)
print("Broken Windows (Utils):", json.encode(windows_broken))
--- Direct export
local windows_broken = exports.boii_utils:get_windows_broken(vehicle)
get_tyre_burst
Returns a list of burst tyres for the specified vehicle.
--- Retreive vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local burst_tyres = utils.vehicles.get_tyre_burst(vehicle)
print("Burst Tyres:", json.encode(burst_tyres))
--- Direct export
local burst_tyres = exports.boii_utils:get_tyre_burst(vehicle)
get_vehicle_extras
Retrieves the enabled extras for the specified vehicle.
--- Retreive vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local extras = utils.vehicles.get_vehicle_extras(vehicle)
print("Vehicle Extras:", json.encode(extras))
--- Direct export
local extras = exports.boii_utils:get_vehicle_extras(vehicle)
get_custom_xenon_colour
Retrieves the custom xenon color of the specified vehicle.
--- Retreive Vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local xenon_color = utils.vehicles.get_custom_xenon_color(vehicle)
print("Custom Xenon Color:", xenon_color and json.encode(xenon_color) or "None")
--- Direct export
local xenon_color = exports.boii_utils:get_custom_xenon_color(vehicle)
get_vehicle_mod
Retrieves the modification of a specific type for the specified vehicle.
--- Retreive Vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Define mod type
local mod_type = 15
--- Utils object
local mod = utils.vehicles.get_vehicle_mod(vehicle, mod_type)
print("Vehicle Mod:", json.encode(mod))
--- Direct export
local mod = exports.boii_utils:get_vehicle_mod(vehicle, mod_type)
get_vehicle_properties
Retrieves various detailed properties of the specified vehicle.
--- Retreive vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local properties = utils.vehicles.get_vehicle_properties(vehicle)
print("Vehicle Properties:", json.encode(properties))
--- Direct export
local properties = exports.boii_utils:get_vehicle_properties(vehicle)
get_vehicle_mods_and_maintenance
Retrieves the mods and maintenance data for the specified vehicle.
--- Retreive vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local mods, maintenance = utils.vehicles.get_vehicle_mods_and_maintenance(vehicle)
print("Vehicle Mods:", json.encode(mods))
print("Vehicle Maintenance:", json.encode(maintenance))
--- Direct export
local mods, maintenance = exports.boii_utils:get_vehicle_mods_and_maintenance(vehicle)
get_vehicle_class
Retrieves the class of the specified vehicle as a string.
--- Retreive vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local class = utils.vehicles.get_vehicle_class(vehicle)
print("Vehicle Class:", class)
--- Direct export
local class = exports.boii_utils:get_vehicle_class(vehicle)
get_vehicle_class_details
Retrieves detailed class information of the specified vehicle.
--- Retreive vehicle
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
--- Utils object
local class_details = utils.vehicles.get_vehicle_class_details(vehicle)
print("Vehicle Class Details:", json.encode(class_details))
--- Direct export
local class_details = exports.boii_utils:get_vehicle_class_details(vehicle)
get_vehicle_details
Retrieves detailed information about a vehicle, optionally the one the player is currently in.
--- Toggle if players vehicle should be used.
--- If false the closest vehicle will be used.
local use_players_vehicle = true
--- Utils object
local vehicle_details = utils.vehicles.get_vehicle_details(use_players_vehicle)
print("Vehicle Details:", json.encode(vehicle_details))
--- Direct export
local vehicle_details = exports.boii_utils:get_vehicle_details(use_players_vehicle)
spawn_vehicle
Spawns a vehicle with specified properties and modifications.
--- Define vehicle data
local vehicle_data = {
model = "adder",
coords = vector4(0.0, 0.0, 75.0, 0.0),
is_network = false,
net_mission_entity = true,
custom_plate = "SPAWNED",
lock_doors = true,
invincible = true,
maintenance = {
fuel = 80.0,
engine = 900.0,
},
mods = {
max_performance = true,
custom_paint = {
primary = { r = 255, g = 0, b = 0 },
secondary = { r = 0, g = 0, b = 255 },
},
},
}
--- Utils object
local vehicle = utils.vehicles.spawn_vehicle(vehicle_data)
print("Spawned Vehicle:", vehicle)
--- Direct export
local vehicle = exports.boii_utils:spawn_vehicle(vehicle_data)