SetPedOxygenLevel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Undo revision 34159 by Bass (talk) - Wrong values)
Line 8: Line 8:
===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 1000 (At the maximum value of UNDERWATER_STAMINA full oxygen level is 2500. Higher values do not appear in the HUD).
*'''oxygen''': the amount of oxygen you want to set on the [[ped]]. Native values are from 0 to 1750. And with full (225) [[Template:Stats|stat]] - from 0 to 3250.


===Returns===
===Returns===
Line 18: Line 18:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function fillOxygen ( command )
function fillOxygen ( command )
local maxOxygen = getPedStat ( localPlayer, 225 ) * 1.502 + 1750
local maxOxygen = getPedStat ( localPlayer, 225 ) * 1.5 + 1750
setPedOxygenLevel ( localPlayer, maxOxygen )
setPedOxygenLevel ( localPlayer, maxOxygen )
end
end

Revision as of 09:46, 26 July 2014

This function allows you to set the oxygen level of a ped.

Syntax

bool setPedOxygenLevel ( ped thePed, float oxygen )

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 1750. And with full (225) stat - from 0 to 3250.

Returns

Returns true if the oxygen level was changed succesfully. Returns false if an invalid ped and/or oxygen level was specified.

Example

Click to collapse [-]
Client

This example fills the local player's oxygen.

function fillOxygen ( command )
	local maxOxygen = getPedStat ( localPlayer, 225 ) * 1.5 + 1750
	setPedOxygenLevel ( localPlayer, maxOxygen )
end
addCommandHandler ( "filloxygen", fillOxygen )


See Also