19.08.2013, 20:33
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.
Dont mind me using the idx.
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;
pawn Код:
public RestartServer()
{
SendRconCommand("gmx");
return 1;
}
pawn Код:
public OnGameModeExit()
{
mysql_close();
return 1;
}