Jump to content

[HELP] Update


1LoL1

Recommended Posts

Posted

Hello, i created script but when anyone attacked me and taked Health of me i see always old Health.

So my question is how i can update health in label?

so i must use:

setTimer

setTimer(function()

?

function health () 
local health2 = math.floor(getElementHealth(localPlayer)) 
local screenWidth, screenHeight = guiGetScreenSize() 
local health = guiCreateLabel(screenWidth - 170, screenHeight - 15, screenWidth , 20, "", false) 
guiSetText(health, ""..health2.."") 
end 
addEventHandler("onClientResourceStart", getRootElement(), health) 

Posted

it will work only onClientResourceStart ^ , you need to use an other event example "onClientPlayerDamage"

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
it will work only onClientResourceStart ^ , you need to use an other event example "onClientPlayerDamage"

But I think even when I jump out of something so it takes away my HP and still shows 100% and I jumped and I have 95%.

Posted
But I think even when I jump out of something so it takes away my HP and still shows 100% and I jumped and I have 95%.

lol

function playerDamage (attacker)  
    if (attacker and getElementType(attacker) == "player" and attacker ~= localPlayer) then   
        -- guiSetText 
    else 
        -- guiSetText 
    end  
end 
addEventHandler ( "onClientPlayerDamage",getLocalPlayer(), playerDamage ) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
But I think even when I jump out of something so it takes away my HP and still shows 100% and I jumped and I have 95%.

lol

function playerDamage (attacker)  
    if (attacker and getElementType(attacker) == "player" and attacker ~= localPlayer) then   
        -- guiSetText 
    else 
        -- guiSetText 
    end  
end 
addEventHandler ( "onClientPlayerDamage",getLocalPlayer(), playerDamage ) 

I don't mean attacker.. but i want only update health in label..

Posted

simply you can use setTimer or onClientRender event .

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
simply you can use setTimer or onClientRender event .

Thanks i used onClientRender work but label is created 50x

function health () 
local health2 = math.floor(getElementHealth(localPlayer)) 
local screenWidth, screenHeight = guiGetScreenSize() 
local health = guiCreateLabel(screenWidth - 170, screenHeight - 15, screenWidth , 20, "", false) 
guiSetText(health, ""..health2.."") 
guiSetFont(health, "default-bold-small") 
end 
addEventHandler("onClientRender", getRootElement(), health) 

Posted

Thanks i used onClientRender work but label is created 50x

function health () 
local screenWidth, screenHeight = guiGetScreenSize() 
health = guiCreateLabel(screenWidth - 170, screenHeight - 15, screenWidth , 20, "", false) 
guiSetFont(health, "default-bold-small") 
end 
addEventHandler("onClientResourceStart", getRootElement(), health) 
  
function ste() 
local health2 = math.floor(getElementHealth(localPlayer)) 
guiSetText(health, ""..health2.."") 
end  
addEventHandler("onClientRender", getRootElement(), ste) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

Thanks i used onClientRender work but label is created 50x

function health () 
local screenWidth, screenHeight = guiGetScreenSize() 
health = guiCreateLabel(screenWidth - 170, screenHeight - 15, screenWidth , 20, "", false) 
guiSetFont(health, "default-bold-small") 
end 
addEventHandler("onClientResourceStart", getRootElement(), health) 
  
function ste() 
local health2 = math.floor(getElementHealth(localPlayer)) 
guiSetText(health, ""..health2.."") 
end  
addEventHandler("onClientRender", getRootElement(), ste) 

Thanks works.

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