SetVehicleNitroLevel: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (fixes) |
||
Line 5: | Line 5: | ||
}} | }} | ||
{{Warning|Function is not working correctly. -[[User:Ccw|Ccw]]}} | |||
{{Warning|Function not working correctly}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool setVehicleNitroLevel ( vehicle theVehicle, float level )</syntaxhighlight> | <syntaxhighlight lang="lua">bool setVehicleNitroLevel ( vehicle theVehicle, float level )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle''' The [[vehicle]] which you want to set. | *'''theVehicle''' The [[vehicle]], which you want to set. | ||
*'''level''' Nitro level you want to set | *'''level''' Nitro level you want to set (ranges from 0.0001 to 1.0). | ||
===Returns=== | ===Returns=== | ||
Line 18: | Line 17: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <section name="Client" class="client" show="true"> | ||
This function installs nitrous to the vehicle and sets the level of it to 0.1 when a player enters the vehicle. | |||
<syntaxhighlight lang="lua"> | |||
function changeNitroLevel(pPlayer) | |||
if pPlayer == localPlayer then | |||
if not getVehicleUpgradeOnSlot(source, 8) then -- Check if the vehicle has nitro in it or not | |||
addVehicleUpgrade(source, 1010) -- Install nitrous | |||
end | end | ||
setVehicleNitroLevel(source, 0.1) -- Set a nitro level of 0.1 to the vehicle | |||
end | end | ||
)</syntaxhighlight> | end | ||
addEventHandler("onClientVehicleEnter", root, changeNitroLevel) | |||
</syntaxhighlight> | |||
</section> | |||
==Requirements== | ==Requirements== |
Revision as of 11:59, 14 March 2013
Syntax
bool setVehicleNitroLevel ( vehicle theVehicle, float level )
Required Arguments
- theVehicle The vehicle, which you want to set.
- level Nitro level you want to set (ranges from 0.0001 to 1.0).
Returns
Returns true if the nitro level was set successfully to the vehicle, false otherwise.
Example
Click to collapse [-]
ClientThis function installs nitrous to the vehicle and sets the level of it to 0.1 when a player enters the vehicle.
function changeNitroLevel(pPlayer) if pPlayer == localPlayer then if not getVehicleUpgradeOnSlot(source, 8) then -- Check if the vehicle has nitro in it or not addVehicleUpgrade(source, 1010) -- Install nitrous end setVehicleNitroLevel(source, 0.1) -- Set a nitro level of 0.1 to the vehicle end end addEventHandler("onClientVehicleEnter", root, changeNitroLevel)
Requirements
This template will be deleted.
See Also
- areVehicleLightsOn
- getHeliBladeCollisionsEnabled
- getHelicopterRotorSpeed
- getVehicleAdjustableProperty
- getVehicleComponentPosition
- getVehicleComponentRotation
- getVehicleComponents
- getVehicleComponentScale
- getVehicleComponentVisible
- getVehicleCurrentGear
- getVehicleDummyPosition
- getVehicleGravity
- getVehicleLandingGearDown
- getVehicleModelDummyDefaultPosition
- getVehicleModelDummyPosition
- getVehicleModelExhaustFumesPosition
- getVehicleModelWheelSize
- getVehicleNitroCount
- getVehicleNitroLevel
- getVehicleWheelFrictionState
- getVehicleWheelScale
- isTrainChainEngine
- isVehicleNitroActivated
- isVehicleNitroRecharging
- isVehicleOnGround
- isVehicleWheelOnGround
- isVehicleWindowOpen
- resetVehicleComponentPosition
- resetVehicleComponentRotation
- resetVehicleComponentScale
- resetVehicleDummyPositions
- setHeliBladeCollisionsEnabled
- setHelicopterRotorSpeed
- setVehicleAdjustableProperty
- setVehicleComponentPosition
- setVehicleComponentRotation
- setVehicleComponentScale
- setVehicleComponentVisible
- setVehicleDummyPosition
- setVehicleGravity
- setVehicleLandingGearDown
- setVehicleModelDummyPosition
- setVehicleModelExhaustFumesPosition
- setVehicleModelWheelSize
- setVehicleNitroActivated
- setVehicleNitroCount
- setVehicleNitroLevel
- setVehicleWheelScale
- setVehicleWheelStates
- setVehicleWindowOpen
- 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