CMD:reboot(playerid, params[])
{
new szOption[9];
if(gPlayerData[playerid][EP_ADMINLVL] < 4)
return 0;
if(sscanf(params, "s[9]I", szOption))
return SendClientMessage(playerid, COLOR_YELLOW, "SYNTAX: /reboot [option] | OPTIONS: start, stop, postpone");
if(!strcmp(szOption, "start", true))
{
new iMinutes;
if(sscanf(params, "{s[9]}i", iMinutes))
return SendClientMessage(playerid, COLOR_YELLOW, "SYNTAX: /reboot start [minutes]");
if(RebootPending == 1)
return SendClientMessage(playerid, COLOR_ORANGE, "SERVER: There is already a reboot pending.");
if(iMinutes <= 0)
return SendClientMessage(playerid, COLOR_ORANGE, "SERVER: You need to specify a time greater than 0.");
new szString[128];
format(szString, sizeof(szString), "SERVER: %s %s has just initiated a server reboot. It will begin in %d minutes.", GetAdminRank(playerid), gPlayerData[playerid][EP_ADMINNAME], iMinutes);
SendClientMessageToAll(COLOR_ORANGE, szString);
defer Reboot(iMinutes);
RebootTimer = defer Reboot(iMinutes);
RebootMinutesTotal = iMinutes;
RebootPending = 1;
}
else if(!strcmp(szOption, "stop", true))
{
if(RebootPending != 1)
return SendClientMessage(playerid, COLOR_ORANGE, "SERVER: There currently is not a reboot pending.");
new szString[128];
format(szString, sizeof(szString), "SERVER: %s %s has stopped the reboot timer, the server will not be rebooted!", GetAdminRank(playerid), gPlayerData[playerid][EP_ADMINNAME]);
SendMessageToAll(COLOR_LRED, szString);
stop RebootTimer;
RebootPending = 0;
}
else if(!strcmp(szOption, "postpone", true))
{
new iMinutes;
if(sscanf(params, "{s[9]}i", iMinutes))
return SendClientMessage(playerid, COLOR_YELLOW, "SYNTAX: /reboot postpone [minutes]");
if(RebootPending != 1)
return SendClientMessage(playerid, COLOR_ORANGE, "SERVER: There currently is not a reboot pending.");
if(iMinutes <= 0)
return SendClientMessage(playerid, COLOR_ORANGE, "SERVER: You need to specify a time greater than 0.");
RebootMinutesTotal = RebootMinutesTotal+iMinutes;
new szString[128];
format(szString, sizeof(szString), "SERVER: %s %s has postpone the server reboot an extra %d minutes. The reboot will begin in %d minutes.", GetAdminRank(playerid), gPlayerData[playerid][EP_ADMINNAME], iMinutes, RebootMinutesTotal);
SendMessageToAll(COLOR_LRED, szString);
defer Reboot(RebootMinutesTotal);
RebootTimer = defer Reboot(RebootMinutesTotal);
}
return 1;
}
sscanf warning: Format specifier does not match parameter count.
you have if(sscanf(params, "{s[9]}i", iMinutes)) but you only state 1 parameter but your format specifier states you should have 2 params.
|
if(sscanf(params, "s[9]I", szOption))
if(sscanf(params, "s[9]I(0)", szOption))
if(sscanf(params, "s[9]I", szOption)) |
if(sscanf(params, "{s[9]}i", iMinutes)) |
Because you tell sscanf to get it, you might not use it but it still wants to try and save it because that's what you told it to do.
|