#Just_Me Posted November 17, 2015 Share Posted November 17, 2015 hello guys I want to know how can dividing the number of a certain value to give us greater value? i mean when i do it like this: let's say that i want it when my health is 100 it take from me 1000 and when it 90 it take from me 2000 and when it 80 it take 3000 .. etc so can you help me with that ? Link to comment
Banex Posted November 17, 2015 Share Posted November 17, 2015 1000*(11-(math.floor(getElementHealth(localPlayer)+0.5)/10)) this? Link to comment
EmBaby85 Posted November 17, 2015 Share Posted November 17, 2015 I didn't get what you want, maybe you're talking about bigger than and smaller than? function getHealth() if (getElementHealth(localPlayer)) == "100" then --Checks if the player has full HP takePlayerMoney(localPlayer, 1000) elseif (getElementHealth(localPlayer)) => "80" then --Checks if the player has more than or equal 80 health ... Link to comment
Saml1er Posted November 17, 2015 Share Posted November 17, 2015 I didn't get what you want, maybe you're talking about bigger than and smaller than? function getHealth() if (getElementHealth(localPlayer)) == "100" then --Checks if the player has full HP takePlayerMoney(localPlayer, 1000) elseif (getElementHealth(localPlayer)) => "80" then --Checks if the player has more than or equal 80 health ... getElementHealth returns an int with range ( 0-100) so... function getHealth() if (getElementHealth(localPlayer)) == 100 then --Checks if the player has full HP takePlayerMoney(localPlayer, 1000) elseif (getElementHealth(localPlayer)) => 80 then --Checks if the player has more than or equal 80 health ... Link to comment
ALw7sH Posted November 17, 2015 Share Posted November 17, 2015 I didn't get what you want, maybe you're talking about bigger than and smaller than? function getHealth() if (getElementHealth(localPlayer)) == "100" then --Checks if the player has full HP takePlayerMoney(localPlayer, 1000) elseif (getElementHealth(localPlayer)) => "80" then --Checks if the player has more than or equal 80 health ... getElementHealth returns an int with range ( 0-100) so... function getHealth() if (getElementHealth(localPlayer)) == 100 then --Checks if the player has full HP takePlayerMoney(localPlayer, 1000) elseif (getElementHealth(localPlayer)) => 80 then --Checks if the player has more than or equal 80 health ... elseif (getElementHealth(localPlayer)) >= 80 then --Checks if the player has more than or equal 80 health >= Link to comment
Noki Posted November 18, 2015 Share Posted November 18, 2015 I didn't get what you want, maybe you're talking about bigger than and smaller than?getElementHealth returns an int with range ( 0-100) so... On a player or ped it returns a value between 0 and 100, and on a vehicle it returns a value between 0 and 1000. Link to comment
Moderators IIYAMA Posted November 18, 2015 Moderators Share Posted November 18, 2015 -- debug -- addEventHandler("onClientRender",root, function () ------------- local playerHealth = math.min(getElementHealth(localPlayer),100) local strangeValue = 1000 -- We start at 1000 (when you have 100 health) strangeValue = strangeValue + ((100-playerHealth)*100) -- debug -- dxDrawText("strangeValue: " .. strangeValue, 300,300) end) ------------- ? Link to comment
#Just_Me Posted November 18, 2015 Author Share Posted November 18, 2015 Thank you all for help .. i found what i want thanks. Link to comment
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