27.09.2009, 07:24
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:
and then, put this into OnGameModeInit:
And the last, make the 'worldtime' function:
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
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;
Код:
public OnGameModeInit() { SetWorldTime(6); hour = 6; SetTimer("worldtime",60000,true); }
Код:
public worldtime() { hour += 1; if(hour == 24) { hour = 0; } SetWorldTime(hour); }
Hope it's helpfull