Posts: 5
Threads: 1
Joined: Nov 2007
Reputation:
0
Hi! Sorry if this topic already exist but I want to know how to Synchronize the World time to the other players (using TogglePlayerClock if possible)
Or can you send me a code for a custom clock (1 in-game hour = 1 real life minute)
Posts: 19
Threads: 0
Joined: Sep 2007
Reputation:
0
use timers and toggleplayerclock and setplayertime and getplayer time
Posts: 273
Threads: 4
Joined: Nov 2007
Reputation:
0
Sounds sorta like you want a time system like my own... I'll explain what my script does & you let me know if that's what you're looking for
Every REAL second that passes, 12 GAME seconds pass, so every 5 REAL seconds mean 1 GAME minute has passed. Every 1 REAL minute mean 12 GAME minutes goes by & every 5 REAL minutes means 1 GAME hour has passed. Every 1 REAL hour means 12 GAME hours, so every 2 REAL hour would mean a full 24 GAME hour cycle... Confused yet? Heh, this was confusing me just typing it :P
Every 24 GAME hours would then turn the day (Sun-Sat) & also the date(1st-31st) of the month. Once you reach the end of the month, the month turns (Jan-Dec) & finally the year turns at 12 months etc. I use formats to be able to display ALL this information correctly... Use my time command on server would result this similar message:
The day is Tuesday, March 12th of 2004
The time is 5:07am
The light turns with every passing GAME hour as well as weather change, but nothing silly like clear day jumps to storm or anything etc. (Noticed a red sky once or twice though *Shrugs*) I only use 5 possible weather changes though and it doesn't jump, it checks the last weather & then decides what weather may come next... The 5: Clear skies, Cloudy, Real Cloudy, Storm & Fog (Also: Use the correct day/night weathers according to hour etc.)
Now if that's not what you're looking for, are you talking about the in game timer showing players time? I don't use that, sorry. However, I do have plans of supporting the calendar/clock by using Game Text...
Posts: 797
Threads: 21
Joined: Jan 2007
Reputation:
0
Ok, but thats Game time. he wants Game time = Real Time. I have it done to mine but i dont know what all is needed. The code posted above was perfect from what i saw. Even mines not perfectly synced.
Posts: 2,593
Threads: 34
Joined: Dec 2007
full xD
Код:
// top
new Minute=8;
new Second;
// on filterscript/gamemode init
SetTimer("ClockSync", 1000, 1);
// OnPlayerConnect
TogglePlayerClock(playerid, 1);
// function
forward ClockSync();
public ClockSync()
{
Second++;
if(Second == 60)
{
Minute++;
Second = 0;
}
if(Minute >= 24) Minute = 0;
for(new i; i<GetMaxPlayers(); i++) SetPlayerTime(i, Minute, Second);
new string[64];
format(string, sizeof(string), "The time [%d] [%d]", Minute, Second);
print(string); // testing only.
return 1;
}