getVehiclesOfType | Multi Theft Auto: Wiki Skip to content

getVehiclesOfType

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function scans through all the current vehicles and returns the ones matching the given model.

Syntax

getVehiclesOfType ( )

Code Examples

server

This example finds all landstalkers on the map and moves them 5 units to the left.

-- Find all the vehicles with the model 400 (landstalker)
vehicles = getVehiclesOfType ( 400 )
-- Loop through the vehicle list
for vehicleKey, vehicleValue in ipairs ( vehicles ) do
-- Get the vehicle's position
x, y, z = getElementPosition ( vehicleValue )
-- Move the vehicle to the left
setElementPosition ( vehicleValue, x - 5, y, z )
end

See Also

Vehicle Functions