<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Le3bA</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Le3bA"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Le3bA"/>
	<updated>2026-05-09T11:32:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPedMaxOxygenLevel&amp;diff=50528</id>
		<title>GetPedMaxOxygenLevel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPedMaxOxygenLevel&amp;diff=50528"/>
		<updated>2017-03-05T14:10:46Z</updated>

		<summary type="html">&lt;p&gt;Le3bA: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This functions gets the maximum oxigen level a [[ped]] should have, considering its max underwater stamina (225) [[Template:Stats|stat]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float getPedMaxOxygenLevel ( ped thePed )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''thePed:''' the [[ped]] whose maximum oxygen level you want to get.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A ''float'' with the maximum oxygen level of the specified [[ped]], an error if a invalid [[ped]] was passed.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Function source&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getPedMaxOxygenLevel(ped)&lt;br /&gt;
    -- Output an error and stop executing the function if the argument is not valid&lt;br /&gt;
    assert(isElement(ped) and (getElementType(ped) == &amp;quot;ped&amp;quot; or getElementType(ped) == &amp;quot;player&amp;quot;), &amp;quot;Bad argument @ 'getPedMaxOxygenLevel' [Expected ped at argument 1, got &amp;quot; .. tostring(ped) .. &amp;quot;]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    -- Grab his ped underwater stamina stat.&lt;br /&gt;
    local stat = getPedStat(ped, 225)&lt;br /&gt;
&lt;br /&gt;
    -- Do a linear interpolation to get how many oxygen a ped can have.&lt;br /&gt;
    -- Assumes: 1750 level = 0 stat, 3250 level = 1000 stat.&lt;br /&gt;
    local maxoxygen = 1750 + stat * 1.5&lt;br /&gt;
&lt;br /&gt;
    -- Return the max oxygen level.&lt;br /&gt;
    return maxoxygen&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client side&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
The next code snippet adds a /breathe command, which always fills the lungs player who types it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function breathCommand()&lt;br /&gt;
    if getPedOxygenLevel(localPlayer) &amp;lt; getPedMaxOxygenLevel(localPlayer) then&lt;br /&gt;
        setPedOxygenLevel(localPlayer, getPedMaxOxygenLevel(localPlayer))&lt;br /&gt;
        outputChatBox(&amp;quot;You have just breathed a lungful!&amp;quot;, 128, 192, 255)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Your lungs are already full.&amp;quot;, 255, 0, 0)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;breathe&amp;quot;, breathCommand)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Le3bA</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetPedMaxOxygenLevel&amp;diff=50527</id>
		<title>GetPedMaxOxygenLevel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetPedMaxOxygenLevel&amp;diff=50527"/>
		<updated>2017-03-05T14:10:13Z</updated>

		<summary type="html">&lt;p&gt;Le3bA: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle&amp;gt;&amp;lt;/lowercasetitle&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This functions gets the maximum oxigen level a [[ped]] should have, considering its max underwater stamina (225) [[Template:Stats|stat]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float getPedMaxOxygenLevel ( ped thePed )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''thePed:''' the [[ped]] whose maximum oxygen level you want to get.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
A ''float'' with the maximum oxygen level of the specified [[ped]], an error if a invalid [[ped]] was passed.&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Function source&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function getPedMaxOxygenLevel(ped)&lt;br /&gt;
    -- Output an error and stop executing the function if the argument is not valid&lt;br /&gt;
    assert(isElement(ped) and (getElementType(ped) == &amp;quot;ped&amp;quot; or getElementType(ped) == &amp;quot;player&amp;quot;), &amp;quot;Bad argument @ 'getPedMaxOxygenLevel' [Expected ped at argument 1, got &amp;quot; .. tostring(ped) .. &amp;quot;]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    -- Grab his ped underwater stamina stat.&lt;br /&gt;
    local stat = getPedStat(ped, 225)&lt;br /&gt;
&lt;br /&gt;
    -- Do a linear interpolation to get how many oxygen a ped can have.&lt;br /&gt;
    -- Assumes: 1750 level = 0 stat, 3250 level = 1000 stat.&lt;br /&gt;
    local maxoxygen = 1750 + stat * 1.5&lt;br /&gt;
&lt;br /&gt;
    -- Return the max oxygen level.&lt;br /&gt;
    return maxoxygen&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client side&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
The next code snippet adds a /breathe command, which always fills the lungs player who types it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function breathCommand()&lt;br /&gt;
    if getPedOxygenLevel(localPlayer) &amp;lt; getPedMaxOxygenLevel(localPlayer) then&lt;br /&gt;
        setPedOxygenLevel(localPlayer, getPedMaxOxygenLevel(localPlayer))&lt;br /&gt;
        outputChatBox(&amp;quot;You have just breathed a lungful!&amp;quot;, 128, 192, 255)&lt;br /&gt;
    else&lt;br /&gt;
        outputChatBox(&amp;quot;Your lungs are already full.&amp;quot;, 255, 0, 0)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;breathe&amp;quot;, breathCommand) --&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Le3bA</name></author>
	</entry>
</feed>