Jump to content

Question in (*) and (/)


#Just_Me

Recommended Posts

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

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
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
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
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
-- 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...