This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
YimMenu/docs/lua/tables/vehicles.md
gir489 11d48f49f9
feat(lua): added weapon and vehicle cache bindings (#2477)
* Replaced bad example in entities documentation.
* Updated Lua documentation for vehicles/weapons to allow for auto generation.
* Added Vector3 support to the Lua globals/locals class.
* Fixed a bug with get_float in globals/locals returning an int instead of a float.
* Fixed globals get_uint/set_uint using signed types for the return/parameter.
* Added unsigned int helpers to the locals Lua class.
2023-12-05 09:58:35 +01:00

63 lines
1.8 KiB
Markdown

# Table: vehicles
Table containing functions for getting information about vehicles in GTA V.
## Functions (4)
### `get_vehicle_display_name(vehicle_hash)`
- **Parameters:**
- `vehicle_hash` (Hash): JOAAT hash of the vehicle.
- **Returns:**
- `vehicle_display_string`: String: the in-game display string. If the vehicle is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
- **Example Usage:**
```lua
log.info(vehicles.get_vehicle_display_name('BTYPE2'))
```
### `get_vehicle_display_name(vehicle_name)`
- **Parameters:**
- `vehicle_name` (String): Name of the vehicle.
- **Returns:**
- `vehicle_display_string`: String: the in-game display string. If the vehicle is not found, or the call is made too early, a blank string will be returned. It is guranteed to return a safe value.
- **Example Usage:**
```lua
log.info(vehicles.get_vehicle_display_name('BTYPE2'))
```
### `get_all_vehicles_by_class(vehicle_class)`
- **Parameters:**
- `vehicle_class` (String): The vehicle class.
- **Returns:**
- `vehicles`: table<int, String>: a list of all vehicles that match the class passed in. The list can contain anything from 0 to n elements.
- **Example Usage:**
```lua
local sports_classics = vehicles.get_all_vehicles_by_class('Sports Classics')
for i = 1, #sports_classics do
log.info(sports_classics[i])
end
```
### `get_all_vehicles_by_mfr(manufacturer)`
- **Parameters:**
- `manufacturer` (String): The vehicle manufacturer.
- **Returns:**
- `vehicles`: table<int, String>: a list of all vehicles that match the manufacturer passed in. The list can contain anything from 0 to n elements.
- **Example Usage:**
```lua
local albanies = vehicles.get_all_vehicles_by_mfr('Albany')
for i = 1, #albanies do
log.info(albanies[i])
end
```