Dolinho Posted July 23, 2015 Share Posted July 23, 2015 how can I summarize? xr = math.floor(x) yr = math.floor(y) zr = math.floor(z) ex: 1603.9251708984,1829.6070556641,10.8203125 I want so 1603.925,1829.607,10.82 addEventHandler ("onClientGUIClick", root, function() if (source == get) then if guiCheckBoxGetSelected(Button[1]) == true then local x,y,z = getElementPosition (getLocalPlayer()) local rx, ry, rz = getElementRotation(getLocalPlayer()) xr = math.floor(x) yr = math.floor(y) zr = math.floor(z) rot = math.floor(rz) guiSetText (Pos, xr..","..yr..","..zr.." R:"..rot ) else local x,y,z = getElementPosition (getLocalPlayer()) guiSetText (Pos, (x)..","..(y)..","..(z) ) end end end ) Link to comment
Rataj Posted July 23, 2015 Share Posted July 23, 2015 round(1603.9251708984, 3) This will return 1603.925 Link to comment
GTX Posted July 24, 2015 Share Posted July 24, 2015 You also need a function. function round(num, idp) return tonumber(string.format("%." .. (idp or 0) .. "f", num)) end 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