10.01.2015, 10:50
This is my global time system:
But there is a problem
For example, when time is 2:2, it is is showing 02:2 instead of 02:02
How can I fix it?
PHP код:
public TimeU()
{
new string[7];
Tsec+=1;
if(Tsec==60)
{
Tsec=00;
THrs+=1;
}
if(THrs==24)
{
Tsec=00;
THrs=0;
}
if(Tsec<10)
{
format(string,sizeof(string),"%d:0%d",THrs,Tsec);
}
if(Tsec>10)
{
format(string,sizeof(string),"%d:%d",THrs,Tsec);
}
if(THrs<10)
{
format(string,sizeof(string),"0%d:%d",THrs,Tsec);
}
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetPlayerTime(i,THrs,Tsec);
}
}
TextDrawSetString(Time,string);
}
For example, when time is 2:2, it is is showing 02:2 instead of 02:02
How can I fix it?