Clock using timer?
#1

Well I was fooling around with ways to make my clock sync to real time and not get thrown off. Then I tried using a timer

Код:
#include <a_samp>

forward clock(playerid);

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Clock By Yury");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	SetTimer("clock",1000,true);

	return 1;
}

public clock(playerid)
{
	new Hour, Minute, Second;
	gettime(Hour, Minute, Second);
	SetPlayerTime(playerid,Hour,Minute);
}
It works/compiles but when I start up the time keeps switching between the time now (21:59) and the previous time (21:5 and it makes the sky look glitchy due to the time changing.

NOTE I have TogglePlayerClock(playerid,1); in the main gamemode script

Is there a way to fix it or will it just not work?
Reply


Messages In This Thread
Clock using timer? - by Yuryfury - 18.02.2009, 02:13
Re: Clock using timer? - by Mikep - 18.02.2009, 02:14
Re: Clock using timer? - by Joe Staff - 18.02.2009, 02:31

Forum Jump:


Users browsing this thread: 1 Guest(s)