Sign in to follow this  
KingSCR

Help: Convert Float to Integer

Recommended Posts

Hi, I'm in need of help.
I'm trying to show the player's life on the screen, however getElementhealth returns me a number like this "96.657466574"
Can I convert it to integer? type: Life: 96
Sorry for my english, I'm using the translator.
local Vida = getElementHealth ( localPlayer ) or 0
dxDrawText("Vida: "..Vida, x*932, y*62, x*1072, y*87, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)

 

qVk14OH.png

Edited by KingSCR

Share this post


Link to post

Resolved

local Vida = math.floor( getElementHealth ( localPlayer ) or 0 )

 

Share this post


Link to post

or you might as well just do a ("%i"):format(getElementHealth(localPlayer) or 0) thing

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.