[FilterScript] [FS] Time System (Good for RPG Server)
#1

I was asking in Scripting Discussion about this, but before i got the right answer, i found how to make a Time System. It's really good for RPG, because they usually make somekind of "Pay Day" or "Bank Time" or something like that.

So, how it works? This Time System will change the server time every 1 minutes. And the code? It's so simple, so i don't need to upload it.

First, add this on the top:

Код:
forward worldtime();
new hour;
and then, put this into OnGameModeInit:

Код:
public OnGameModeInit()
{
SetWorldTime(6);
hour = 6;
SetTimer("worldtime",60000,true);
}
And the last, make the 'worldtime' function:

Код:
public worldtime()
{
	hour += 1;
	if(hour == 24)
	{
	  hour = 0;
	}
	SetWorldTime(hour);
}
Done! Now run your server. You'll see that your server is in the morning. Now wait, and u'll see its starting to get noon, and then turned into night, and back into morning...

Hope it's helpfull

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)