-.Paradox.- Posted December 26, 2013 Posted December 26, 2013 Hello guys, i made an oxygen level bar but not working, here is my code addEventHandler("onClientRender", root, function() local oxygen = math.floor(getPedOxygenLevel ( getLocalPlayer() )) if oxygen < 1000 then oxygen = oxygen / 2 end dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, 264*(oxygen/10), 18, tocolor(8, 154, 246, 255), true) end ) As you can see the oxygen is the sky-blue color bar and thats the bug If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
WASSIm. Posted December 26, 2013 Posted December 26, 2013 addEventHandler("onClientRender", root, function() local oxygen = getPedOxygenLevel(localPlayer) if (isElementInWater(localPlayer)) then dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, 264*(oxygen/1000), 18, tocolor(8, 154, 246, 255), true) end end)
-.Paradox.- Posted December 26, 2013 Author Posted December 26, 2013 Still the same problem If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Arsilex Posted December 26, 2013 Posted December 26, 2013 x,y = guiGetScreenSize() local r = x/1000 addEventHandler("onClientRender", root, function() local oxygen = math.floor(getPedOxygenLevel ( getLocalPlayer() )) if oxygen < 1000 then oxygen = oxygen / 2 end dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, oxygen*r*(1.3/264), 18, tocolor(8, 154, 246, 255), true) end )
Spajk Posted December 26, 2013 Posted December 26, 2013 x,y = guiGetScreenSize() local r = x/1000 addEventHandler("onClientRender", root, function() local oxygen = math.floor(getPedOxygenLevel ( getLocalPlayer() )) if oxygen < 1000 then oxygen = oxygen / 2 end dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, oxygen*r*(1.3/264), 18, tocolor(8, 154, 246, 255), true) end ) and what should "r" be? addEventHandler("onClientRender", root, function() if (isElementInWater(localPlayer)) then local oxygen = getPedOxygenLevel(localPlayer) dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, 264*(oxygen/getPedStat (localPlayer, 225)), 18, tocolor(8, 154, 246, 255), true) end end) Try this one.
-.Paradox.- Posted December 27, 2013 Author Posted December 27, 2013 Not working but now just showing a black rectangle If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Snow-Man Posted December 27, 2013 Posted December 27, 2013 addEventHandler("onClientRender", root, function() local oxygen = math.floor (getPedOxygenLevel ( localPlayer )) if oxygen < 1000 or isElementInWater(getLocalPlayer()) then dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, 264*(oxygen/100), 18, tocolor(8, 154, 246, 255), true) end) USC Informations Head Staff & Owner Of USC. Youtube Channel : My Channel
DNL291 Posted December 27, 2013 Posted December 27, 2013 addEventHandler("onClientRender", root, function() local oxygen = math.floor (getPedOxygenLevel ( localPlayer )) if oxygen < 1000 or isElementInWater(getLocalPlayer()) then dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, 264*(oxygen/100), 18, tocolor(8, 154, 246, 255), true) end) Is missing 'end' to close the if statement. Please do not PM me with scripting related question nor support, use the forums instead.
Snow-Man Posted December 27, 2013 Posted December 27, 2013 addEventHandler("onClientRender", root, function() local oxygen = math.floor (getPedOxygenLevel ( localPlayer )) if oxygen < 1000 or isElementInWater(getLocalPlayer()) then dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, 264*(oxygen/100), 18, tocolor(8, 154, 246, 255), true) end end) sorry i forget it USC Informations Head Staff & Owner Of USC. Youtube Channel : My Channel
Renkon Posted December 27, 2013 Posted December 27, 2013 local ratio = 1000 -- Not sure, but please write here the maximum oxygen, whether its 10 100 or 1000. local oxygen = math.floor(getPedOxygenLevel(getLocalPlayer())/ratio) dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, 264*(oxygen), 18, tocolor(8, 154, 246, 255), true)
-.Paradox.- Posted December 29, 2013 Author Posted December 29, 2013 Still the same anyway my max oxygen level is 250 I guess it would help If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Plean Posted December 29, 2013 Posted December 29, 2013 addEventHandler('onClientRender', root, function () local oxygenLevel = math.ceil(getPedOxygenLevel(getLocalPlayer())) local maxOxygenLevel = 1000 + 1.5 * getPedStat(getLocalPlayer(), 225) if oxygenLevel < maxOxygenLevel or isElementInWater(getLocalPlayer()) then dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, math.floor(264 / maxOxygenLevel * oxygenLevel), 18, tocolor(8, 154, 246, 255), true) end end )
K4stic Posted December 29, 2013 Posted December 29, 2013 (edited) it's simple and easy :3 addEventHandler("onClientRender", root, function() local oxygen = string.format( "%.0f", (getPedOxygenLevel ( localPlayer ) ) ) -- i remake it to it give correct value of oxygen without decimals i mean like 1.0000147 dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, (oxygen/2.5)*26.5, 18, tocolor(8, 154, 246, 255), true) end ) Edited December 29, 2013 by Guest Giving a Fuck? Nope, That isn't in My Skill Set
-.Paradox.- Posted December 29, 2013 Author Posted December 29, 2013 Still the same i tried both codes If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
K4stic Posted December 29, 2013 Posted December 29, 2013 (edited) Copy my code again Edited December 29, 2013 by Guest Giving a Fuck? Nope, That isn't in My Skill Set
-.Paradox.- Posted December 29, 2013 Author Posted December 29, 2013 Idk,By the way i used /crun getPedOxygenLevel(localPlayer) and it output that my max oxygen is 250 If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
K4stic Posted December 29, 2013 Posted December 29, 2013 Idk,By the way i used /crun getPedOxygenLevel(localPlayer) and it output that my max oxygen is 250 in MTA wiki says 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). but if it's 250 them copy my code again and test But Correct setPlayerOxygen to 1000 them replace in my code the 2.5 to 10 Giving a Fuck? Nope, That isn't in My Skill Set
-.Paradox.- Posted December 29, 2013 Author Posted December 29, 2013 Still not working If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
-.Paradox.- Posted December 31, 2013 Author Posted December 31, 2013 Help? If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Plean Posted December 31, 2013 Posted December 31, 2013 Try mine again, but first remove your old one. Maybe your bugged oxygen bar was covering other's bars.
denny199 Posted December 31, 2013 Posted December 31, 2013 addEventHandler("onClientRender", root,function() local oxygen = math.floor(getPedOxygenLevel ( localPlayer )) --dxDrawText (tostring(oxygen), 100, 500 ) dxDrawRectangle(900, 94, 266, 20, tocolor(0, 0, 0, 255), true) dxDrawRectangle(901, 95, 264*(oxygen/1000), 18, tocolor(8, 154, 246, 255), true) end ) It works properly for me? P.S; your code isn't working for every screen resolution. Sometimes I dream about cheese
-.Paradox.- Posted January 1, 2014 Author Posted January 1, 2014 I fixed it thanks a lot guys If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
denny199 Posted January 2, 2014 Posted January 2, 2014 How did you fixed it, or what was the problem? Sometimes I dream about cheese
-.Paradox.- Posted January 5, 2014 Author Posted January 5, 2014 I just set all the players stamina stats to 0 If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now