12.12.2011, 20:30
(
Последний раз редактировалось Scenario; 12.12.2011 в 22:08.
)
I am able to get the params to work properly now, but I'm getting a sscanf error. This is the command:
This is the error:
pawn Код:
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.