ResetVehicleExplosionTime: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Added an example.) |
||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
This example resets every vehicle's explosion time when the resource is stopped. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function resetVehiclesExplosionTime () | ||
local vehicles = getElementsByType ( "vehicle" ) -- Return all the vehicles in a table | |||
for k, vehicle in ipairs ( vehicles ) do -- For every vehicle do the following... | |||
resetVehicleExplosionTime ( vehicle ) -- Reset the vehicle's explosion time | |||
end | |||
end | |||
-- When this resource is stopped, trigger the resetVehiclesExplosionTime function (above). | |||
addEventHandler ( "onResourceStop", getResourceRootElement(getThisResource()), resetVehiclesExplosionTime ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} | ||
Revision as of 20:18, 23 February 2010
Resets the vehicle explosion time. This is the point in time at which the vehicle last exploded: at this time plus the vehicle's respawn delay, the vehicle is respawned. You can use this function to prevent the vehicle from respawning.
Syntax
bool resetVehicleExplosionTime ( vehicle theVehicle )
Required Arguments
- theVehicle: The vehicle you wish to reset the explosion time from.
Returns
Returns true if the vehicle explosion time has been reset, false if it failed to reset the explosion time.
Example
This example resets every vehicle's explosion time when the resource is stopped.
function resetVehiclesExplosionTime () local vehicles = getElementsByType ( "vehicle" ) -- Return all the vehicles in a table for k, vehicle in ipairs ( vehicles ) do -- For every vehicle do the following... resetVehicleExplosionTime ( vehicle ) -- Reset the vehicle's explosion time end end -- When this resource is stopped, trigger the resetVehiclesExplosionTime function (above). addEventHandler ( "onResourceStop", getResourceRootElement(getThisResource()), resetVehiclesExplosionTime )
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