xbenny2506x Posted September 24, 2009 Share Posted September 24, 2009 HI I have a problem with the guiCreateLabel and getElementHealth. I want that the player see his health. So i have make this script ... local client = getLocalPlayer() local healthtext = guiCreateLabel(0.35,0.40,0.94,0.2, getElementHealth ( client ), true) guiSetFont ( healthtext, "sa-header" ) guiLabelSetColor ( healthtextt, 255, 234, 0 ) ... addEventHandler("onClientPlayerJoin", getRootElement(), fullhealth) But i see nothing! Can me someone say, how i can make it that the player see his health? Link to comment
subenji99 Posted September 24, 2009 Share Posted September 24, 2009 (edited) getElementHealth() returns an integer, not a string. --correction, it returns a float. (a number with decimal places) Use tostring(). Don't forget you'll have to update the label with guiSetText() regularly too, which also takes a string. Edited September 26, 2009 by Guest Link to comment
xbenny2506x Posted September 25, 2009 Author Share Posted September 25, 2009 THX now my script work! But a i have a little problem with the health number. Sometimes is see 98.599998474121 or other so long health numbers. How can i make it that is see only numbers so long without the " . "???? Link to comment
Buffalo Posted September 25, 2009 Share Posted September 25, 2009 Use math functions.. math.ceil() or math.floor() Link to comment
xbenny2506x Posted September 25, 2009 Author Share Posted September 25, 2009 yh THX!! Its work very good! THX 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