Server not restarting.
#1

Hello,

I have this script where my server should restart after 30 seconds. But when it executes the RconCommand: GMX in the client it says it's restarting but in the server its not restarting at all.

pawn Код:
if(PInfo[playerid][AdminLevel] > 0)
        {
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_ERROR, "Syntax: /restartserver (reason)");
                return 1;
            }
            if(ServerRestarting == 1)
            {
                SendClientMessage(playerid, COLOR_ERROR, "The server is already restarting!");
                return 1;
            }
            new restartmsg[128];
            ServerRestarting = 1;
            format(restartmsg,sizeof(restartmsg),"Administrator {FF9900}%s(%d) {FFFFFF}has restarted the server - {FF9900}[Reason: %s]", PlayerName(playerid),playerid, result);
            SendClientMessageToAll(COLOR_WHITE, restartmsg);
            SendClientMessageToAll(COLOR_WHITE, "* Server restarting in {FF9900}30 {FFFFFF}seconds ...");
            SetTimerEx("RestartServer", 30000, false, "i", playerid);
            AdminLog(playerid, "/restartserver", result, "Everyone");
            return 1;
        }
        else return 0;
Dont mind me using the idx.

pawn Код:
public RestartServer()
{
    SendRconCommand("gmx");
    return 1;
}
pawn Код:
public OnGameModeExit()
{
    mysql_close();
    return 1;
}
Reply
#2

Change:
pawn Код:
SetTimerEx("RestartServer", 30000, false, "i", playerid);
to
pawn Код:
SetTimer("RestartServer", 30000, false);
Reply
#3

Not working unfortunately.

Still it says restarting ingame as in: The server is restarting...

But then seeing the logs it isn't.
Reply
#4

Someone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)