Set player weather according to time...
#1

i got the time enabled with TogglePlayerClock(playerid, 1); but its not setting the weather to the time like making it dark
Reply
#2

I dont prefer this clock because (Note: Time will automatically advance 6 hours when the player dies.)
But there is a good example (on the wiki page) how to sync it with all players
We only need to add SetWorldTime in the timer ProcessGameTime

Here the example (removed the text)
pawn Код:
static i_ServerSeconds;
static i_ServerMinutes;
static i_ServerHours;
 
forward ProcessGameTime();
 
public OnGameModeInit()
{
    SetWorldTime(i_ServerHours);
    SetTimer("ProcessGameTime", 1000, 1);
}
 
public ProcessGameTime()
{
    if(++i_ServerSeconds == 60)
    {
        if(++i_ServerMinutes == 60)
        {
            if(++i_ServerHours == 24)
            {
                i_ServerHours = 0;
            }
            SetWorldTime(i_ServerHours);
            i_ServerMinutes = 0;
        }
        i_ServerSeconds = 0;
    }
}
 
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    SetPlayerTime(playerid, i_ServerHours, i_ServerMinutes);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)