Help me with 1 code
#1

Hi.It's again me...I'm converting my gangwars strcmp commands to zcmd.I get this error on server console when i use command /changerankname 6 Leader

Код:
sscanf warning: format specifier does not match parameter count
this is my command
pawn Код:
CMD:changerankname(playerid,params[])
{
    if(IsPlayerConnected(playerid))
    {
        new id2, result[256], string[256];
        if(PlayerInfo[playerid][pMember] == TEAM_CIVILIAN && PlayerInfo[playerid][pRank] != 6) return SendClientMessage(playerid, COLOR_GRAD1, "Usage: /changerankname [Rank ID 1-6] [Name]");
        else
        {
            if(sscanf(params, "s[256]",id2, result)) return SendClientMessage(playerid, COLOR_GRAD1, "Usage: (/f)action [team chat]" );
            else
            {
                if(strfind( result , "|" , true ) == -1)
                {
                    if(id2 == 1)
                    {
                        format(string, sizeof(string), "Information - You change rank name: %d(%s) to: %s", id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank1],result);
                        strmid(TeamInfo[PlayerInfo[playerid][pMember]][fRank1], (result), 0, strlen((result)), 128);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        SaveFactions();
                        format(string, sizeof(string), "Leader %s change rank name: %d(%s) to: %s", GetName(playerid), id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank1],result);
                        SendFactionMessage(PlayerInfo[playerid][pMember], COLOR_GREEN, string);
                    }
                    else if(id2 == 2)
                    {
                        format(string, sizeof(string), "Information - You change rank name: %d(%s) to: %s", id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank2],result);
                        strmid(TeamInfo[PlayerInfo[playerid][pMember]][fRank2], (result), 0, strlen((result)), 128);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        SaveFactions();
                        format(string, sizeof(string), "Leader %s change rank name: %d(%s) to: %s", GetName(playerid), id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank2],result);
                        SendFactionMessage(PlayerInfo[playerid][pMember], COLOR_GREEN, string);
                    }
                    else if(id2 == 3)
                    {
                        format(string, sizeof(string), "Information - You change rank name: %d(%s) to: %s", id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank3],result);
                        strmid(TeamInfo[PlayerInfo[playerid][pMember]][fRank3], (result), 0, strlen((result)), 128);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        SaveFactions();
                        format(string, sizeof(string), "Leader %s change rank name: %d(%s) to: %s", GetName(playerid), id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank3],result);
                        SendFactionMessage(PlayerInfo[playerid][pMember], COLOR_GREEN, string);
                    }
                    else if(id2 == 4)
                    {
                        format(string, sizeof(string), "Information - You change rank name: %d(%s) to: %s", id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank4],result);
                        strmid(TeamInfo[PlayerInfo[playerid][pMember]][fRank4], (result), 0, strlen((result)), 128);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        SaveFactions();
                        format(string, sizeof(string), "Leader %s change rank name: %d(%s) to: %s", GetName(playerid), id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank4],result);
                        SendFactionMessage(PlayerInfo[playerid][pMember], COLOR_GREEN, string);
                    }
                    else if(id2 == 5)
                    {
                        format(string, sizeof(string), "Information - You change rank name: %d(%s) to: %s", id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank5],result);
                        strmid(TeamInfo[PlayerInfo[playerid][pMember]][fRank5], (result), 0, strlen((result)), 128);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        SaveFactions();
                        format(string, sizeof(string), "Leader %s change rank name: %d(%s) to: %s", GetName(playerid), id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank5],result);
                        SendFactionMessage(PlayerInfo[playerid][pMember], COLOR_GREEN, string);
                    }
                    else if(id2 == 6)
                    {
                        format(string, sizeof(string), "Information - You change rank name: %d(%s) to: %s", id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank6],result);
                        strmid(TeamInfo[PlayerInfo[playerid][pMember]][fRank6], (result), 0, strlen((result)), 128);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        SaveFactions();
                        format(string, sizeof(string), "Leader %s change rank name: %d(%s) to: %s", GetName(playerid), id2, TeamInfo[PlayerInfo[playerid][pMember]][fRank6],result);
                        SendFactionMessage(PlayerInfo[playerid][pMember], COLOR_GREEN, string);
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "Undefined symbol: | ");
                }
            }
        }
    }
    return 1;
}
P.S: Srry for my bad english and command language..
Reply
#2

pawn Код:
if(sscanf(params, "s[256]",id2, result)) return SendClientMessage(playerid, COLOR_GRAD1, "Usage: (/f)action [team chat]" );
to
pawn Код:
if(sscanf(params, "us[256]",id2, result)) return SendClientMessage(playerid, COLOR_GRAD1, "Usage: (/f)action [team chat]" );
Reply
#3

I didn't see the error again but command didn't work ..
Reply
#4

Because of your language I cannot understand what exactly you are trying to script, anyway try this one.

pawn Код:
if(sscanf(params, "ds[256]",id2, result)) return SendClientMessage(playerid, COLOR_GRAD1, "Usage: (/f)action [team chat]" );
Reply
#5

If you use the latest version of sscanf, use this :

pawn Код:
if(sscanf(params, "ds[256]",id2, result))
This should work as i don't see anything wrong.

EDIT: Too late.
Reply
#6

didn't work again..i'll translate my command ..wait 1 minute
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)