- Documentation
- Shared functions
- getVehicleModelsOfType
Function
getVehicleModelsOfType
Returns the numbers of all models of a kind, e.g. all boats or helicopters. Useful for picking a random vehicle of a specific type.
Syntax
table getVehicleModelsOfType(string typeName)Arguments
typeNamestring- A type as in
getVehicleType, e.g."Boat","Helicopter".
Returns
An array of model IDs (empty for an unknown type).
Example
local boats = getVehicleModelsOfType("Boat")
createVehicle(boats[math.random(#boats)], 2950, -2050, 1)