02.07.2016, 16:09
I see no problem with TogglePlayerClock, its just unfortunate that there isn't a function to set the clock for all players
Using a textdraw instead would be a bit more effective (no need for the while loop)
The problem is the update rate because we can't replicate 1 second exact, therefore I use a faster rate
Using a textdraw instead would be a bit more effective (no need for the while loop)
PHP код:
// OnGameModeInit
SetTimerEx("Clock", 750, true, "i", gettime() - 3 * 60 * 2); // start at 3 o'clock
// OnPlayerSpawn ?
TogglePlayerClock(playerid, true);
//
forward Clock(start);
public Clock(start) {
const sec = 2;
new
diff = ((gettime() - start) / sec) % (60 * 24),
i = GetPlayerPoolSize(),
minute = diff % 60,
hour = diff / 60
;
while(i >= 0) {
SetPlayerTime(i--, hour, minute);
}
}