Need help with time system
#1

Code:
	seconds += 1;
	if(seconds == 60)
	{
	  minutes++;
	  seconds = 0;
	}
	if(minutes == 24)
	{
	  minutes = 0;
	}
	SetWorldTime(minutes);
	new string[128];
	if(seconds < 10)
	{
	format(string,sizeof(string),"%i:0%i",minutes,seconds);
	TextDrawSetString(Textdraw1,string);
	}
	else
	{
	format(string,sizeof(string),"%i:%i",minutes,seconds);
	TextDrawSetString(Textdraw1,string);
	}
	return 1;
What is the problem with this code? It always speeds up too fast im using the timer set to 1000 miliseconds (1 second) and it does repeat

Help please.
Reply
#2

I think instead of SetWorldTime, you should put this in there.

pawn Code:
for(new i=0; i < MAX_PLAYERS; i++)
{
    if (IsPlayerConnected(i))
    {
       SetPlayerTime(i,minutes,seconds);
    }
}
Reply
#3

How will that fix my really fast time problem? it goes like 1 to 8 to 24 to 2 etc...
Reply
#4

Are you saying the textdraw is going fast or the default clock?
Reply
#5

everything is going too fast i made a /time command that showed the exact time of the textdraw so the textdraw isnt the problem..

Reply
#6

bump
Reply
#7

pawn Code:
if(minutes == 60)
    {
      minutes = 0;
      hours++;
    }
    SetWorldTime(hours);
if(hours == 24)
{
     hours = 0
}
Can't indent on here, but I think your problem was, you're checking if MINUTES if 24, then setting the world hours to MINUTES, which is 24.

60 Minutes in an hour, so if minutes == 60, hours++ and reset minutes varible
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)