params inside of a param
#1

I am able to get the params to work properly now, but I'm getting a sscanf error. This is the command:

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;
}
This is the error:

Код:
sscanf warning: Format specifier does not match parameter count.
Reply


Messages In This Thread
params inside of a param - by Scenario - 12.12.2011, 20:30
Re: params inside of a param - by Scenario - 12.12.2011, 22:08
Re: params inside of a param - by vital2k - 12.12.2011, 22:12
Re: params inside of a param - by Scenario - 12.12.2011, 22:16
Re: params inside of a param - by Scenario - 12.12.2011, 22:49
Re: params inside of a param - by Scenario - 12.12.2011, 23:18
Re: params inside of a param - by Phanto90 - 12.12.2011, 23:42
Re: params inside of a param - by Scenario - 13.12.2011, 00:31
Re: params inside of a param - by Scenario - 13.12.2011, 11:10

Forum Jump:


Users browsing this thread: 2 Guest(s)