SetPedOxygenLevel: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Added OOP syntax) |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool setPedOxygenLevel ( ped thePed, float oxygen )</syntaxhighlight> | <syntaxhighlight lang="lua">bool setPedOxygenLevel ( ped thePed, float oxygen )</syntaxhighlight> | ||
{{OOP||[[ped]]:setOxygenLevel|oxygenLevel|getPedOxygenLevel}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePed''': the [[ped]] whose oxygen level you want to modify. | *'''thePed''': the [[ped]] whose oxygen level you want to modify. | ||
*'''oxygen''': the amount of oxygen you want to set on the ped. Native values are from 0 to | *'''oxygen''': the amount of oxygen you want to set on the [[ped]]. Native values are from 0 to 1000. Each of the stamina (22) and underwater stamina (225) [[Template:Stats|stat]] maximum adds a bonus of 1500. So the maximum oxygen level is 4000. | ||
===Returns=== | ===Returns=== | ||
Line 14: | Line 15: | ||
==Example== | ==Example== | ||
This example fills the local player's oxygen. | This example fills the local player's oxygen. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function fillOxygen ( command ) | function fillOxygen ( command ) | ||
local maxOxygen = getPedStat ( localPlayer, 225 ) * 1. | local maxOxygen = math.floor ( 1000 + getPedStat ( localPlayer, 22 ) * 1.5 + getPedStat ( localPlayer, 225 ) * 1.5 ) | ||
setPedOxygenLevel ( localPlayer, maxOxygen ) | setPedOxygenLevel ( localPlayer, maxOxygen ) | ||
end | end | ||
addCommandHandler ( "filloxygen", fillOxygen ) | addCommandHandler ( "filloxygen", fillOxygen ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client_ped_functions}} | {{Client_ped_functions}} |
Latest revision as of 17:45, 26 November 2014
This function allows you to set the oxygen level of a ped.
Syntax
bool setPedOxygenLevel ( ped thePed, float oxygen )
OOP Syntax Help! I don't understand this!
- Method: ped:setOxygenLevel(...)
- Variable: .oxygenLevel
- Counterpart: getPedOxygenLevel
Required Arguments
- thePed: the ped whose oxygen level you want to modify.
- oxygen: the amount of oxygen you want to set on the ped. Native values are from 0 to 1000. Each of the stamina (22) and underwater stamina (225) stat maximum adds a bonus of 1500. So the maximum oxygen level is 4000.
Returns
Returns true if the oxygen level was changed succesfully. Returns false if an invalid ped and/or oxygen level was specified.
Example
This example fills the local player's oxygen.
function fillOxygen ( command ) local maxOxygen = math.floor ( 1000 + getPedStat ( localPlayer, 22 ) * 1.5 + getPedStat ( localPlayer, 225 ) * 1.5 ) setPedOxygenLevel ( localPlayer, maxOxygen ) end addCommandHandler ( "filloxygen", fillOxygen )
See Also
- canPedBeKnockedOffBike
- getPedAnalogControlState
- getPedAnimation
- getPedBonePosition
- getPedCameraRotation
- getPedControlState
- getPedMoveState
- getPedOxygenLevel
- getPedSimplestTask
- getPedTargetCollision
- getPedTargetEnd
- getPedTargetStart
- getPedTask
- getPedVoice
- getPedWeaponMuzzlePosition
- givePedWeapon
- isPedBleeding
- isPedDoingTask
- isPedReloadingWeapon
- isPedTargetingMarkerEnabled
- setAnalogControlState
- setPedAimTarget
- setPedAnalogControlState
- setPedBleeding
- setPedCameraRotation
- setPedCanBeKnockedOffBike
- setPedControlState
- setPedEnterVehicle
- setPedExitVehicle
- IsPedFootBloodEnabled
- setPedFootBloodEnabled
- setPedLookAt
- setPedOxygenLevel
- setPedTargetingMarkerEnabled
- setPedVoice
- Shared
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle