22.05.2006, 14:39
Quote:
Originally Posted by Sintax
New version with day/night cycle and fixed a bug in the gang system. Don't think the time is perfectly synced but it changes up the game world a bit.
|
// At the top
new gHour;
// In OnGameModeInit
new m, s;
gettime(gHour, m, s);
SetTimer("realtime", (3600 - (m * 60) - s) * 1000, 0);
// Run the function first on the hour (that will return milliseconds left in the hour)
SetWorldTime(gHour);
// Elsewhere
public realtime()
{
new m, s;
gettime(gHour, m, s);
SetTimer("setrealtime", 3600000, 1);
// Run the main function every hour
SetWorldTime(gHour);
}
public setrealtime()
{
gHour++;
SetWorldTime(gHour);
}