ResetVehicleIdleTime: Difference between revisions
Jump to navigation
Jump to search
(New page: {{Server client function}} __NOTOC__ Resets the vehicle idle time ==Syntax== <syntaxhighlight lang="lua"> bool resetVehicleIdleTime ( vehicle theVehicle ) </syntaxhighlight> ===Required Arguments=== *'''theVeh...) |
m (→See Also) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Server | {{Server function}} | ||
__NOTOC__ | __NOTOC__ | ||
Resets the vehicle idle time | Resets the vehicle idle time | ||
Line 15: | Line 15: | ||
==Example== | ==Example== | ||
This example resets every vehicle's idle time when the resource is stopped. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | 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 ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | |||
==See Also== | |||
{{Vehicle_functions|server}} |
Latest revision as of 23:04, 6 September 2024
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
- addVehicleSirens
- getModelHandling
- getVehicleIdleRespawnDelay
- getVehicleRespawnDelay
- getVehicleRespawnPosition
- getVehicleRespawnRotation
- getVehiclesOfType
- isVehicleRespawnable
- removeVehicleSirens
- resetVehicleExplosionTime
- resetVehicleIdleTime
- respawnVehicle
- setModelHandling
- setVehicleIdleRespawnDelay
- setVehicleRespawnDelay
- setVehicleRespawnPosition
- setVehicleRespawnRotation
- spawnVehicle
- toggleVehicleRespawn
- Shared
- 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