Need help with time system - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with time system (
/showthread.php?tid=148559)
Need help with time system -
coole210 - 17.05.2010
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.
Re: Need help with time system -
Backwardsman97 - 17.05.2010
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);
}
}
Re: Need help with time system -
coole210 - 18.05.2010
How will that fix my really fast time problem? it goes like 1 to 8 to 24 to 2 etc...
Re: Need help with time system -
Backwardsman97 - 18.05.2010
Are you saying the textdraw is going fast or the default clock?
Re: Need help with time system -
coole210 - 19.05.2010
everything is going too fast i made a /time command that showed the exact time of the textdraw so the textdraw isnt the problem..
Re: Need help with time system -
coole210 - 19.05.2010
bump
Re: Need help with time system -
Joe_ - 19.05.2010
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