BlowVehicle: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 21: Line 21:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
vehicles = getElementsByType ( "vehicle" )
vehicles = getElementsByType ( "vehicle" )
for vehicleKey, vehicleValue in vehicles do
for vehicleKey, vehicleValue in ipairs(vehicles) do
blowVehicle ( vehicleValue )
blowVehicle ( vehicleValue )
end
end

Revision as of 22:37, 6 May 2007

This function will blow up a vehicle. This will cause an explosion and will kill the driver and any passengers inside it.

Syntax

bool blowVehicle ( vehicle vehicleToBlow, [ bool explode=true ] )              

Required Arguments

  • vehicleToBlow: The vehicle that you wish to blow up.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • explode: If this argument is true then the vehicle will explode, otherwise it will just be blown up silently.

Returns

Returns true if the vehicle was blown up, false if invalid arguments were passed to the function.

Example

This example will blow up every vehicle in the game.

vehicles = getElementsByType ( "vehicle" )
for vehicleKey, vehicleValue in ipairs(vehicles) do
	blowVehicle ( vehicleValue )
end

It is worth noting that the same could be achieved with the following:

root = getRootElement ()
blowVehicle ( root )

See Also

Template:Vehicle Functions