15.09.2013, 05:25
Guys i made my own game time but i getting a problem my time is on timer so when the hours and minutes is less then 10 then should be showing like 01:01 and if greater then 10 both then showing 10:10 but i getting this error if hours and minutes is less then 10 then showing 01:1 i don't what is the problem here is the code i try much but not getting fixed
pawn Код:
forward GameTime(playerid);
public GameTime(playerid)
{
new string[256];
GameSeconds[playerid] = GameSeconds[playerid]+1;
if(GameSeconds[playerid] == 60)
{
GameMinutes[playerid] = GameMinutes[playerid]+1;
GameSeconds[playerid] = 0;
}
if(GameMinutes[playerid] == 24)
{
GameMinutes[playerid] = 0;
GameSeconds[playerid] = 0;
}
if(GameMinutes[playerid] < 10)
{
format(string, sizeof string, "0%d:%d",GameMinutes,GameSeconds);
TextDrawSetString(Time2, string);
}
else if(GameSeconds[playerid] < 10)
{
format(string, sizeof string, "%d:0%d",GameMinutes,GameSeconds);
TextDrawSetString(Time2, string);
}
else if ( GameMinutes[playerid] >= 10 || GameSeconds[playerid] >= 10)
{
format(string, sizeof string, "%d:%d",GameMinutes,GameSeconds);
TextDrawSetString(Time2, string);
}
return 1;
}