Jump to content

Need some help with the operators


Franky

Recommended Posts

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

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

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 by Guest
Link to comment
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

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