Team Spartan Cookies & Milk Forums
HELP: Making a percentage without decimals - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Expression 2 (https://teamscm.co.uk/forum-6.html)
+--- Thread: HELP: Making a percentage without decimals (/thread-379.html)



HELP: Making a percentage without decimals - Alanzote - 12-07-2014

I am making a shield stats E2 but the percent show its' decimals:
16.66666666%
I'd like to be 16%, what I mean it's remove the decimals!
My Code:
ShieldUpercent = SUP/STC*100
E:egpText(19, ShieldUpercent+"%", vec2(255,255))
###################################


RE: HELP: Making a percentage without decimals - Person8880 - 12-07-2014

Use floor() on the number, so:
Code:
ShieldUpercent = floor( SUP / STC * 100 )



RE: HELP: Making a percentage without decimals - Alanzote - 12-07-2014

(12-07-2014, 07:47 PM)Person8880 Wrote: Use floor() on the number, so:
Code:
ShieldUpercent = floor( SUP / STC * 100 )
Thanks Person!