Fixing Time Change cmd
#1

My cpu usage was on 94% so i profiled it and found that bug with public OnServerTimeUpdate(playerid) So i commented some lines now the cpu is down to 24 %
Код:
public OnGameModeInit()
{
SetTimer("OnServerTimeUpdate", 1, true);     Cpu Optisation
and

Код:
forward OnServerTimeUpdate(playerid);
public OnServerTimeUpdate(playerid)
{
    new hrs;
	new minutes;
	new seconds;

	if(nuke_time <= 0 || anthrax_time <= 0)
	{
		for(new i; i < MAX_PLAYERS; i ++)
		{
		    gettime(hrs, minutes, seconds);
			SetPlayerTime(i, hrs, minutes);
		}
	}
	return 1;
}

But when i do that my settime cmd gets bugged


Reply
#2

The timer is run every 1 millisecond (repeated). Use 1000+ milliseconds instead.
Reply
#3

Readded it and put the timer to 10000 , i had initially put it to 10000 but somehow it got changed i never noticed . Thanx anyways ++rep.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)