BlowVehicle: Difference between revisions
Jump to navigation
Jump to search
m (Minor change in example 2) |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
This function will blow up a vehicle. This will cause an explosion and will kill the driver and any passengers inside it. | This function will blow up a vehicle. This will cause an explosion and will kill the driver and any passengers inside it. | ||
Line 18: | Line 19: | ||
==Example== | ==Example== | ||
<section name="Example 1" class="both" show="true"> | |||
This example will blow up every vehicle in the game. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
vehicles = getElementsByType ( "vehicle" ) | vehicles = getElementsByType ( "vehicle" ) | ||
Line 31: | Line 33: | ||
blowVehicle ( root ) | blowVehicle ( root ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
<section name="Example 2" class="server" show="true"> | |||
This example will blow a player's vehicle when he enters the car, like a carbomb. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function blowVehicleEnter ( thePlayer, seat, jacked ) | function blowVehicleEnter ( thePlayer, seat, jacked ) | ||
Line 42: | Line 46: | ||
addEventHandler ( "onVehicleEnter", riggedVehicle, blowVehicleEnter ) --trigger the function when a certain vehicle is entered | addEventHandler ( "onVehicleEnter", riggedVehicle, blowVehicleEnter ) --trigger the function when a certain vehicle is entered | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Vehicle_functions}} | {{Vehicle_functions}} |
Revision as of 15:59, 15 August 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
Click to collapse [-]
Example 1This 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 )
Click to collapse [-]
Example 2This example will blow a player's vehicle when he enters the car, like a carbomb.
function blowVehicleEnter ( thePlayer, seat, jacked ) --ENGINE START BOMB. if seat == 0 then --check if the seat the player got into was id 0 - i.e. driver seat blowVehicle ( source ) --if it was, toast him end end addEventHandler ( "onVehicleEnter", riggedVehicle, blowVehicleEnter ) --trigger the function when a certain vehicle is entered
See Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates