ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. getVehicleModelsOfType

Function

getVehicleModelsOfType

Server and clientVehiclesTrilogy Hub only

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)

See also