Vehicles
vehicles.lua
This module provides utilities for reading, modifying, and interacting with vehicle properties and positioning.
searchCar(vehicle)
Searches the 'Vehicles' table for a specific vehicle's details.
If the vehicle differs from the last searched, it retrieves its model and updates the carInfo table.
The table includes the vehicle's name, price, and class information.
Example:
getVehicleProperties(vehicle)
Retrieves the properties of a given vehicle using the active framework.
Example:
setVehicleProperties(vehicle, props)
Sets the properties of a given vehicle if changes are detected.
It compares the current properties with the new ones and applies the update using the active framework.
Example:
checkDifferences(vehicle, newProps)
Checks for differences between the current and new vehicle properties.
Compares properties using JSON encoding for deep comparison and logs differences.
Example:
pushVehicle(entity)
This function ensures that the vehicle is controlled by the current player and is set as a mission entity.
It requests network control and sets the vehicle accordingly to synchronize changes across clients.
Example:
getClosestVehicle(coords, src)
Finds the closest vehicle to the specified coordinates.
The function uses different APIs based on whether a source is provided.
Example:
Last updated