ResetVehicleIdleTime: Difference between revisions
Jump to navigation
Jump to search
(Added an example.) |
(Replace to predefined variables.) |
||
Line 24: | Line 24: | ||
end | end | ||
-- When this resource is stopped, trigger the resetVehiclesIdleTime function (above). | -- When this resource is stopped, trigger the resetVehiclesIdleTime function (above). | ||
addEventHandler ( "onResourceStop", | addEventHandler ( "onResourceStop", resourceRoot, resetVehiclesIdleTime ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Revision as of 04:33, 16 May 2023
Resets the vehicle idle time
Syntax
bool resetVehicleIdleTime ( vehicle theVehicle )
Required Arguments
- theVehicle: The vehicle you wish to reset the idle time from.
Returns
Returns true if the vehicle idle time has been reset, false if it failed to reset the idle time.
Example
This example resets every vehicle's idle time when the resource is stopped.
function resetVehiclesIdleTime () local vehicles = getElementsByType ( "vehicle" ) -- Return all the vehicles in a table for k, vehicle in ipairs ( vehicles ) do -- For every vehicle do the following... resetVehicleIdleTime ( vehicle ) -- Reset the vehicle's idle time end end -- When this resource is stopped, trigger the resetVehiclesIdleTime function (above). addEventHandler ( "onResourceStop", resourceRoot, resetVehiclesIdleTime )
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