Vehicle Object
Vehicles are represented as objects when they are created. You can retrieve a vehicle object using:
local vehicle = exports.bhd_garage:GetVehicle(plate)This object contains various properties and functions that allow for full control over the vehicle in the system.
π§ Available Functions & Properties
Vehicle Properties (Stored in vehicle)
vehicle)These variables contain essential data about the vehicle:
vehicle.owner(string) β The identifier of the vehicle's owner.vehicle.plate(string) β The license plate of the vehicle.vehicle.props(json string) β The vehicleβs properties.vehicle.type(string) β The type of vehicle (e.g., car, boat, helicopter).vehicle.garage_id(string) β The ID of the garage where the vehicle is currently stored.vehicle.last_garage_id(string) β The ID of the last garage the vehicle was in.vehicle.impound_data(json string or nil) β Data related to vehicle impounding.vehicle.friends(json string) β List of friends who have access to the vehicle.vehicle.mileage(number) β The vehicleβs mileage in kilometers.vehicle.vinnumber(string) β The unique Vehicle Identification Number (VIN).vehicle.name(string) β The custom name given to the vehicle.vehicle.favourite(table or nil) β Stores whether the vehicle is marked as a favorite by players.vehicle.oldOwner(string or nil) β The previous owner of the vehicle before a transfer.vehicle.min_grade(number or nil) β The minimum job grade required to use the vehicle.vehicle.status(string) β The current status of the vehicle ("onstreet","garage","impounded").vehicle.fakePlate(string or nil) β A fake plate assigned to the vehicle.vehicle.title(string) β The formatted display title of the vehicle.vehicle.jobVehicle(boolean) β Whether the vehicle belongs to a job rather than a player.vehicle.img(string or nil) β The URL of the vehicle's image (if available).
Vehicle Functions
Set Favourite
Description: Marks or unmarks the vehicle as a favorite for a given player.
Arguments:
favourite(boolean) β Whether the vehicle should be marked as favorite.identifier(string) β The player identifier.
Returns: None.
Set Name
Description: Assigns a custom name to the vehicle.
Arguments:
name(string) β The new vehicle name.
Returns: None.
Take Out
Description: Marks the vehicle as taken out from the garage.
Arguments:
lastGarage(string) β The ID of the last garage the vehicle was stored in.
Returns: None.
Park
Description: Stores the vehicle in a garage.
Arguments:
garage(string) β The garage where the vehicle is stored.props(table) β The updated vehicle properties.mileage(number) β The current mileage of the vehicle.
Returns: None.
Transfer
Description: Transfers ownership of the vehicle to another player.
Arguments:
newOwner(string) β The identifier of the new owner.changeDatabase(boolean) β Whether to update the database.
Returns: None.
Is Owner
Description: Checks if the given player is the owner of the vehicle.
Arguments:
source(number) β The player's source ID.
Returns: Boolean (
trueif the player is the owner, otherwisefalse).
Get Sorted Data
Description: Retrieves organized vehicle data for UI purposes.
Arguments:
source(number or nil) β The player's source ID.
Returns: A table containing relevant vehicle information.
Get Scraped Data
Description: Retrieves all vehicle-related data.
Arguments: None.
Returns: Table with detailed vehicle information.
Impound
Description: Marks the vehicle as impounded.
Note: Date is
os.time()if you want to be able to take out the vehicle immediately. If you want to confiscate it for some time, set it toos.time() + time_in_seconds.Arguments:
date(number) β The timestamp of impoundment.price(number) β The fee for retrieving the vehicle.impoundLot(string) β The location where the vehicle is stored.reason?(string) β The reason for impounding.confiscated?(boolean) β Whether the vehicle is permanently confiscated.playerName?(string) β The owner's name.officerName?(string or nil) β The officer responsible for impounding.props?(table or nil) β The updated vehicle properties.
Returns: None.
UnImpound
Description: Removes the vehicle from impound.
Arguments:
intoGarage(boolean) β Whether to send the vehicle to a garage.newGarage?(string or nil) β The garage where the vehicle should be sent.
Returns: None.
Change Plate
Description: Updates the vehicle's plate number.
Arguments:
newPlate(string) β The new plate number.entity(entity ID or nil) β The vehicle entity (if applicable).
Returns: None.
Delete Vehicle
Description: Removes the vehicle from the system.
Arguments:
dontDeleteSQL?(boolean or nil) β Whether to keep the database entry.
Returns: None.
π Note: The Vehicle Object is dynamically created when a vehicle is spawned or registered in the system. Ensure all functions are called on a valid vehicle instance.
Last updated