1LoL1 Posted November 7, 2015 Posted November 7, 2015 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)
Walid Posted November 7, 2015 Posted November 7, 2015 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
1LoL1 Posted November 7, 2015 Author Posted November 7, 2015 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%.
Walid Posted November 7, 2015 Posted November 7, 2015 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
1LoL1 Posted November 7, 2015 Author Posted November 7, 2015 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..
Walid Posted November 7, 2015 Posted November 7, 2015 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
1LoL1 Posted November 7, 2015 Author Posted November 7, 2015 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)
Walid Posted November 7, 2015 Posted November 7, 2015 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
1LoL1 Posted November 7, 2015 Author Posted November 7, 2015 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.
Walid Posted November 7, 2015 Posted November 7, 2015 np. 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
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