Weather and time - 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)
+--- Thread: Weather and time (
/showthread.php?tid=438294)
Weather and time -
Zex Tan - 19.05.2013
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 ?
Re: Weather and time -
Ceez - 19.05.2013
In the #include's:
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
Re: Weather and time -
RajatPawar - 19.05.2013
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!
Re: Weather and time -
Babul - 19.05.2013
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.