Auto Restart
#1

How to make auto-restart server (gmx) in 00:00 clock? Or after 24 hours?
Reply
#2

Код:
forward restart();
public restart()
{
SendRconCommand("gmx");
return 1;
}
 
public OnGameModeInit()
{
SetTimer("restart",100*60*60*24,1);
return 1;
}
Reply
#3

I guess that code only works when you activate the timer at 00:00... You may wanna use GetTime
Reply
#4

If you are on linux u could make a CRON, thats what i did
Reply
#5

try this:

pawn Код:
//
public OnPlayerUpdate(playerid)
{
    new Hour, Min, Second;
    gettime(Hour, Min, Second);
    if(Hour == 23 && Min == 59)
    {
        SendRconCommand("gmx");
        SendClientMessageToAll(0xDEEE20FF, "24 hours have passed, the server is restarted.");
    }
    return 1;
}
Reply
#6

NO, do NOT use that god damnit OnPlayerUpdate is called like god knows how many times per second.

pawn Код:
SetTimer("AutoRestart",30000,0);

forward AutoRestart();
public AutoRestart()
{
    new h,m,s;
    gettime(h,m,s);
    if(h == 23 && m == 59)
    {  
        print("Auto Restarting..");
        SendRconCommand("gmx");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)