GetVehiclesOfType: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 20: Line 20:
         x, y, z = getEntityPosition ( vehicleValue )
         x, y, z = getEntityPosition ( vehicleValue )
         -- Move the vehicle to the left
         -- Move the vehicle to the left
         setEntityPosition ( vehicle, x - 5, y, z )
         setEntityPosition ( vehicleValue, x - 5, y, z )
end
end
</syntaxhighlight>
</syntaxhighlight>

Revision as of 21:24, 8 June 2006

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

Syntax

table getVehiclesOfType ( model )

Required Arguments

  • model: The model of vehicles you want.

Returns

Returns a table of existing vehicles matching the specified model.

Example

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

See Also