Clock Troubles
#1

whats the best way to sync the game clock? right now i have a 1000 mil sec (1 sec) timer setting the second ++ every second to make sure all players clocks are synced... but the sky flashes allot and its really annoying... is there any way to fix this / better way to sync the clock?

i also had it synced to every minute before, but within that minute all the cocks get off of sync.....

any ideas?
Reply
#2

i guess no one has any ideas
Reply
#3

AFAIK the player clock that is used in single-player can only count minutes as real-life seconds (and hours as real-life minutes) and there's no changing that. So if you wanted it to be real-time, the clock would keep trying to increase 1 minute every second and you would have to reset it constantly for it to be accurate.

That's why I would just disable the player clock, create a textdraw that looks similar to the player clock, and use TextDrawSetString to update it.

I'm not too sure why your sky would flash though. Post your code?
Reply
#4

BUMB!

Having the same problem, my clock makes the sky flash 2, and realy like every second (ANOYING! )

Here is my code, hope you guys can figure out why the sky flashes, (it would be a miracle)

somewhere in OnGameModeInit()
pawn Код:
SetTimer("ClockSync", 1000, 1);
bit furder down in my code

pawn Код:
forward ClockSync(playerid);
public ClockSync(playerid)
{
  new string[128];
  Minute = Minute + 1;
  if (Minute == 60)
  {
    Time = Time + 1;
    Minute = 0;
  }
  if (Time == 24)
  {
        Time = 0;
    }
  for(new i; i<MAX_PLAYERS; i++)
  SetPlayerTime(i, Time, Minute);
  format(string, sizeof(string), "The time [%d] [%d]", Time, Minute);
  //print(string); // testing only.
 
  print("achtenveertigste bericht - tot hier ok");

 
  return 1;
}
Grts Riz
Reply
#5

I suggest you not to use SetPlayerTime. SetWorldTime is better, it doesn't need to be synced and the time doesn't go until you do SetWorldTime once again.
Reply
#6

How are you suggesting me to use SetWorldTime(hour); since it only has one param ?

Grts Riz
Reply
#7

Weather does not actually differ a lot during 1 hour. So you can make your own clock with textdraw and use gettime(); to set minutes and hours(+SetWorldTime) to that textdraw.
Reply
#8

Ok, so you're saying, I should just make my own textdraw and each hour(rl minute) set the world time so the weather changes with it?

Fine by me but, anyone has the coцrdinates of a textdraw at the spot of the playertime? (right-top corner)

Grts Riz
Reply
#9

Look here - http://forum.sa-mp.com/index.php?topic=84349.0
Reply
#10

Ok thnx man

Appreciate it

Grts Riz
Reply
#11

Ohai rizzy

I just wonder. Why should your string be posted in the console?

That would spam it alot unneccesary
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)