SA-MP Forums Archive
clock - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: clock (/showthread.php?tid=307000)



clock - jamesbond007 - 28.12.2011

why does this code goes from 1:10 to 1:9 on the clock ?

i need it 1:09 .. 1:08 ( double digits)

pawn Код:
format(strr,sizeof(strr),"%d:%2d",minutes,seconds);
        TextDrawSetString(time, strr);



Re: clock - Seven_of_Nine - 28.12.2011

pawn Код:
if(minutes < 10) {
    format(strr,sizeof(strr),"%d:0%d",minutes,seconds);
} else {
    format(strr,sizeof(strr),"%d:%2d",minutes,seconds);
}



Re: clock - jamesbond007 - 28.12.2011

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
pawn Код:
if(minutes < 10) {
    format(strr,sizeof(strr),"%d:0%d",minutes,seconds);
} else {
    format(strr,sizeof(strr),"%d:%2d",minutes,seconds);
}
that might work.. also u mean (seconds < 10) not minutes ?

is that the only way? why doesnt %2d work tho ? its suppose to force it into two digits.. :/


Re: clock - Seven_of_Nine - 28.12.2011

Quote:
Originally Posted by jamesbond007
Посмотреть сообщение
that might work.. also u mean (seconds < 10) not minutes ?

is that the only way? why doesnt %2d work tho ? its suppose to force it into two digits.. :/
Well I don't wanna go into that.
And yeah *seconds.

Isn't it irrevelant if it actually works? xD


Re: clock - jamesbond007 - 28.12.2011

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
Well I don't wanna go into that.
And yeah *seconds.

Isn't it irrevelant if it actually works? xD
no its not irrevelant because it should work ..