09.03.2012, 02:15
Okay, so at first I was a little confused with timers. But soon i figured it out. They are actually really simple.
Lets say you want the server to restart by itself every 1 hour. This is how you would do it.
1. Forward the timer. At the top of your script put forward timerName(); So i will name it Restart
2. Now under OnGameModeInit we will start the timer when the GM starts.
SetTimer("name", time, repeating);
repeating; true = repeat, false = dont repeat
(the time is in milliseconds)
(Remember capitalization matters)
So in our case it would be;
3600000 milliseconds = 1 hour
true means it will repeat the timer (in this case it wont matter since the timer restarts with the Gamemode)
Ok so the timer is set up. Now we need to tell the timer what to do when it gets to 0.
Any where in the script you have to put public timerName() So;
Now under this you want it to send the Rcon CMD.
After 1 hour the server should restart the GM and then the next hour it will do the same and so on. Any questions/errors? Post a message
Lets say you want the server to restart by itself every 1 hour. This is how you would do it.
1. Forward the timer. At the top of your script put forward timerName(); So i will name it Restart
pawn Code:
forward Restart();
SetTimer("name", time, repeating);
repeating; true = repeat, false = dont repeat
(the time is in milliseconds)
(Remember capitalization matters)
So in our case it would be;
pawn Code:
SetTimer("Restart",3600000,true);
true means it will repeat the timer (in this case it wont matter since the timer restarts with the Gamemode)
Ok so the timer is set up. Now we need to tell the timer what to do when it gets to 0.
Any where in the script you have to put public timerName() So;
pawn Code:
public Restart()
pawn Code:
public Restart()
{
SendRconCommand("gmx");
}