SA-MP Forums Archive
How can i make a auto-time changer? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How can i make a auto-time changer? (/showthread.php?tid=88695)



How can i make a auto-time changer? - arie9000nerd - 28.07.2009

Hi, i am running a samp server.....but it is always the same time in my server XD,
so, can anyone help me making a script with a timer or something to auto-change the time in my server? and i know, i am a noob in scripting
i only know the basic things......

so thanx if anyody can help me!


Re: How can i make a auto-time changer? - ronyx69 - 28.07.2009

Under includes:
Код:
new weatherids[21] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
forward OnServerChangeWeather();
Under OnGameModeInIt:
Код:
SetTimer("OnServerChangeWeather", 300000, true);
Anywhere in your script since it is not in another callback:
Код:
public OnServerChangeWeather()
{
	new azhour, azminute, azsecond;
	gettime(azhour, azminute, azsecond);
	SetWorldTime(azhour);
    new weatherid = weatherids[random(21)];
    SetWeather(weatherid);
	return 1;
}
This will also sync the time in real world and game.


Re: How can i make a auto-time changer? - arie9000nerd - 28.07.2009

Quote:
Originally Posted by ronyx69
Under includes:
Код:
new weatherids[21] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
forward OnServerChangeWeather();
Under OnGameModeInIt:
Код:
SetTimer("OnServerChangeWeather", 300000, true);
Anywhere in your script since it is not in another callback:
Код:
public OnServerChangeWeather()
{
	new azhour, azminute, azsecond;
	gettime(azhour, azminute, azsecond);
	SetWorldTime(azhour);
    new weatherid = weatherids[random(21)];
    SetWeather(weatherid);
	return 1;
}
This will also sync the time in real world and game.
THANXXXXXXXXXXXXX!!!!!!!!!!!!!!!!!!!!!!!!