BlowVehicle: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This | This function will blow up a vehicle. This will cause an explosion and will kill the driver and any passengers inside it. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool blowVehicle ( | bool blowVehicle ( vehicle vehicleToBlow, [ bool explode=true ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''vehicleToBlow:''' The vehicle that you wish to blow up. | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
{{OptionalArg}} | {{OptionalArg}} | ||
*''' | *'''explode:''' If this argument is ''true'' then the vehicle will explode, otherwise it will just be blown up silently. | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if | Returns ''true'' if the vehicle was blown up, ''false'' if invalid arguments were passed to the function. | ||
==Example== | ==Example== | ||
This example | This example will blow up every vehicle in the game. | ||
<syntaxhighlight lang="lua"> | |||
vehicle = getElementsByType ( "vehicle" ) | |||
for vehicleKey, vehicleValue in vehicles do | |||
blowVehicle ( vehicleValue ) | |||
end | |||
</syntaxhighlight> | |||
It is worth noting that the same could be achieved with the following: | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
root = getRootElement () | |||
blowVehicle ( root ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{ | {{Vehicle_Functions}} |
Revision as of 00:18, 21 May 2006
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.
vehicle = getElementsByType ( "vehicle" ) for vehicleKey, vehicleValue in vehicles do blowVehicle ( vehicleValue ) end
It is worth noting that the same could be achieved with the following:
root = getRootElement () blowVehicle ( root )