15.02.2019, 21:38
Hello this is my first tutorial Iam just gonna explain this fast (if there's anybody who needs this). This tutorial is about time on your server (not weather), how to make the server to automatically set the server time as the clock on your server...?
First you need to make a timer that will set server time every 1 hour (if you have a payday sistem which repeats every hour you can just put everything there):Code:
forward Time(); // you should put this timer with the other timers in you server but it is not really important public Time() { // This is what will happen when timer's time run out }
Code:
forward Time(); public Time() { new h; // here we make a new variable in which we will store that time we get from server gettime(h); // here we store it to variable 'h' }
Code:
forward Time(); public Time() { new h; gettime(h); if(h == 18 || h == 19) // here we check if it is 19h or 18h if it is we will set the world time to current time plus 5 hours so it will be night and so we are goin on with this below { SetWorldTime(h+5); } else if(h == 20 || h == 21) { SetWorldTime(h+4); } else if(h == 22 || h == 23) { SetWorldTime(h+2); } else // here we check if current time is not 18,19,20,21,22,23 (everything that we haven't specified before) and if time is like 9h AM it will set your world time to 9 { SetWorldTime(h); } }
Code:
SetTimer("Time", 3600000, true); // this is setting the public timer which you made before, 3600000 is the one hour in milliseconds and true means that timer will be repeated every time when interval get to 0 and your interval is 1hour (3600000)