Weather and time
#1

I was think about this for a long time, but I've no idea of how to create it. It is like this, Every hour the weather will change and so on, and this includes time. How am I going to change from weather to a different weather after an hour ?
Reply
#2

In the #include's:
Код:
#include <foreach>
On top of the script:
Код:
forward OneSecondUpdate();
Inside OnGameModeInit :
Код:
OnGameModeInit()
{
    SetTimer("OneSecondUpdate", 1000, true);
}
Anywhere:
Код:
public OneSecondUpdate()
{
	foreach(Player, i)
	{
	     new Hour, Minute, Second;
	     gettime(Hour, Minute, Second);
             if(Minute == 59, Second >= 59)
             {
		    SetWorldTime(Hour+2);
	     }
	}
	return 1;
}
*NOTE: If you get "loose identitation" or whatever, fix the { }'s using TAB only.
If I helped, +REP
Reply
#3

On the server we are creating (see below link) this exactly has been done, we actually have added temperature specific weathers changing per hour! If you'd like to know more, PM me, I'd help you, or sure use the above code!
Reply
#4

if you change the time more than once per game hour, the smooth weather transitions will get fucked up. apply the time-sync once per minute, after setting the new weather id, upon the next minute, the weather will change slowly.
oops, almost forgot: to enable the weather transitions, you need to add TogglePlayerClock(playerid,1); after a player logged in. indeed combined with the 1minute-timer for sync.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)