Time problem..
#5

Quote:
Originally Posted by Dziugsas
Посмотреть сообщение
pawn Код:
New hours,minutes,seconds;
gettime(hours,minutes,seconds);
SetWorldTime(hours);
Put this in timer.
As said above. gettime() function, collects the local time of where the server is hosted. All the above script does is grabs the local time, stores it to variables and then sets the world time. As for timers (haven't tested it but yeah)...
Код:
[Top of code here]
new pclocktimer[MAX_PLAYERS];

forward clocktimer();
public clocktimer()
{
    new hours,minutes,seconds;
    gettime(hours,minutes,seconds);
    SetWorldTime(hours); //sets weather as well by default.
    return 1;
}

public OnPlayerSpawn(playerid)
{
    pclocktimer[playerid] = SetTimer("clocktimer", 1000, true); //every second, GTA's time ticks.

}
And if you want to clear the timer:

Код:
KillTimer(pclocktimer[playerid]) //for an individual player.

OR

for(new i = 0; i < MAX_PLAYERS; i++)
{
     KillTimer(pclocktimer[i]); //for all players.
}
If you don't want the default weather set by SetWorldTime, and want a custom one...

Код:
if(hours > 6 && hours < 18) //between 6:01 and 17:59
{
    SetWeather([weatherid]);
}
Reply


Messages In This Thread
Time problem.. - by dundolina - 27.11.2014, 19:50
Re: Time problem.. - by Dziugsas - 27.11.2014, 20:50
Re: Time problem.. - by dundolina - 28.11.2014, 19:59
Re: Time problem.. - by dundolina - 28.11.2014, 20:12
Re: Time problem.. - by iiNzTicTx - 28.11.2014, 23:20
Re: Time problem.. - by dundolina - 29.11.2014, 10:29
Re: Time problem.. - by dundolina - 29.11.2014, 23:35
Re: Time problem.. - by dundolina - 30.11.2014, 09:36
Re: Time problem.. - by AnthonyTimmers - 30.11.2014, 11:23
Re: Time problem.. - by dundolina - 02.12.2014, 22:31

Forum Jump:


Users browsing this thread: 1 Guest(s)