Franky Posted September 12, 2008 Share Posted September 12, 2008 What i need to know is that how do i say 100 to 50 in lua Example: If (playerHP) "100 to 50" then make him die. Hope you getting this Link to comment
churchill Posted September 12, 2008 Share Posted September 12, 2008 are you saying that their health has dropped from 100 to 50, or that their health is between 50 and 100? Link to comment
Franky Posted September 12, 2008 Author Share Posted September 12, 2008 That their health is between 100 to 50 Link to comment
Scarface Posted September 12, 2008 Share Posted September 12, 2008 Might be useful: http://development.mtasa.com/index.php? ... ayerDamage Link to comment
Gamesnert Posted September 12, 2008 Share Posted September 12, 2008 What i need to know is that how do i say 100 to 50 in luaExample: If (playerHP) "100 to 50" then make him die. Hope you getting this Hmmm local health=getElementHealth(playerElement) if health and health>50 and health<100 then Or do you mean if he suffered between 100 and 50 damage? Link to comment
robhol Posted September 12, 2008 Share Posted September 12, 2008 -- Is X larger than Y? result = (X > Y) result = (X < Y) -- smaller? -- Is X larger than or equal Y? result = (X >= Y) result contains a boolean value (digital value, yes/no, 1/0, or most commonly, true/false) Link to comment
Franky Posted September 12, 2008 Author Share Posted September 12, 2008 (edited) Okey like i see you cant understand what i mean.. I want to know how to write something like this: if player's health is 91-100 then he will be okey, but if player health is 71-90 then he will bleed a little and if players health is 11-70 then he will bleed heavily. And if player's health is 1-10 he will black out and bleed to death(which is HP 0) Edited May 5, 2009 by Guest Link to comment
50p Posted September 13, 2008 Share Posted September 13, 2008 Okey like i see you cant understand what i mean..I want to know how to right something like this: if player's health is 91-100 then he will be okey, but if player health is 71-90 then he will bleed a little and if players health is 11-70 then he will bleed heavily. And if player's health is 1-10 he will black out and bleed to death(which is HP 0) How do you want to make him bleed? FX functions will be available from DP3. As they said previously, use player's health and compare the health with those values: -- "This event is triggered when a player is damaged, in any way." addEventHandler( "onPlayerDamage", getRootElement( ), function( ) local health = getElementHealth( source ) -- get player's health if health > 90 and health <= 100 then -- he has more then 90 and less then or equal to 100 hp here elseif health > 70 and health <= 90 then -- his hp is more then 70 and less then or equal to 90 elseif health > 10 and health <= 70 then -- you probably know what this means now... end end ) 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