Time problem..
#1

Hello i need a code who changes the server time as set out.. Now in my country ( Bulgaria ) is a 22:40 and in the server have sunset.. How to change this? I have this..

Код:
//=========================[World Time]=========================================
new timeshift = -1;
new shifthour;
new ghour = 0;
new gminute = 0;
new gsecond = 0;
new realtime = 1;
new wtime = 15;
Reply
#2

pawn Код:
New hours,minutes,seconds;
gettime(hours,minutes,seconds);
SetWorldTime(hours);
Put this in timer.
Reply
#3

Dont work.. Can you give me other timer to add in gamemode?
Reply
#4

Or maybe i made a mistake i think i need a automatically weather set.. When is morning sunny and etc.
Reply
#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
#6

Where to post killtimer and setweather?

And i have a timer and everything but on 23:00 it's night in the server but in the real time in 16:50 already is night..
Reply
#7

Help please?
Reply
#8

Come on please help me..
Reply
#9

Under OnGameModeExit you put the KillTimer. You put the SetWeather in your timer.
Reply
#10

Dont work.. I delete my time and add the other and the weather bugged and show for 1 sec sunset and for 1 sec the night sky.. Help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)