Set player weather according to time...
#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


Messages In This Thread
Set player weather according to time... - by IamNotKoolllll - 24.04.2010, 23:13
Re: Set player weather according to time... - by Nero_3D - 25.04.2010, 00:37

Forum Jump:


Users browsing this thread: 2 Guest(s)