SA-MP Forums Archive
Weather/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/Time (/showthread.php?tid=328981)



Weather/Time - DannySnoopy - 26.03.2012

Hello, i know it's kind of a silly question, but i have clock and date, and it works fine.
But the weather never changes, i want it to change automatically with the time.

+1 rep for helpers!


Re: Weather/Time - The__ - 26.03.2012

pawn Код:
public SyncTime()
{
    new tmphour;
    new tmpminute;
    new tmpsecond;
    gettime(tmphour, tmpminute, tmpsecond);
    FixHour(tmphour);
    tmphour = shifthour;
    if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
    {
        ghour = tmphour;
        foreach(Player, i)
        {
            PayDayAuth[i] = 1;

        }
        if (realtime)
        {
            SetWorldTime(tmphour);
        }
        new RandomWeth;
        RandomWeth = random(3);
        switch(RandomWeth)
        {
            case 0:
            {
                DefaultWeather = 0;
                SetWeather(DefaultWeather);
            }
            case 1:
            {
                DefaultWeather = 11;
                SetWeather(DefaultWeather);
            }
            case 2:
            {
                DefaultWeather = 7;
                SetWeather(DefaultWeather);
            }
        }
    }
}
That's the code I use for my hours and weather changes.


Re: Weather/Time - The DeLuca - 26.03.2012

When you have the time change, simply add a random variable and SetWeather(weatherid); to change the weather for all players.