SA-MP Forums Archive
Fixing Time Change cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Fixing Time Change cmd (/showthread.php?tid=574196)



Fixing Time Change cmd - perfectboy - 14.05.2015

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





Re: Fixing Time Change cmd - Konstantinos - 14.05.2015

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


Re: Fixing Time Change cmd - perfectboy - 14.05.2015

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.