Number digits in time limit
#1

Hello everyone!

I have a variable, which shows me time limit. I want to change it, so that all numbers are 2 characters long. (Damn my english)

Current look: TIME LEFT: 0:3:45
Wanted look: TIME LEFT: 00:03:45

How to do this?
Reply
#2

you can format your variable to show the preceding zeros:
pawn Код:
format(string,sizeof(string),"TIME LEFT: %02d:%02d:%02d",hours,minutes,seconds);
if you want a number like 0003, use %04d or for 0001.001337, use %04.06f
Reply
#3

Thank you very much Babul! Its working
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)