SA-MP Forums Archive
sscanf warning - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: sscanf warning (/showthread.php?tid=426621)



sscanf warning - SilverKiller - 29.03.2013

Hello,

I get this in my console :

Код:
[20:19:05] sscanf warning: No default value found.
[20:19:05] sscanf warning: Unknown format specifier '[', skipping.
[20:19:05] sscanf warning: Unknown format specifier '6', skipping.
[20:19:05] sscanf warning: Unknown format specifier '4', skipping.
[20:19:05] sscanf warning: Unknown format specifier ']', skipping.
[20:19:05] sscanf warning: Format specifier does not match parameter count.
This happens when i do my /ban command, the command works fine but i want to fix the warnings too!

Command :

pawn Код:
CMD:ban(playerid, params[])
{
    new ReAson[64];
    if(PlayerInfo[playerid][pAdmin] < 5)
        return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to be Level 5 to use this command!");
    else if(sscanf(params, "dS[64]", bID, ReAson))
        return SendClientMessage(playerid, COLOR_LIGHTRED, "Usage: /ban <playerid> <reason>");
    else if(bID == playerid)
        return SendClientMessage(playerid, COLOR_LIGHTRED, "You can't ban yourself!");
    else if(!IsPlayerConnected(bID))
        return SendClientMessage(playerid, COLOR_LIGHTRED, "Player not found!");
    else
    {
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "Adminstrator %s banned you! (Reason : %s)", pName, ReAson);
        SendClientMessage(bID, COLOR_ORANGE, str);
        new pNaMe[24];
        new rName[24];
        new sTr[128];
        GetPlayerName(playerid, pNaMe, 24);
        GetPlayerName(bID, rName, 24);
        format(sTr, 128, "Adminstrator %s banned %s! (Reason : %s)", pNaMe, rName, ReAson[0] ? ReAson : "No Reason Given");
        SendClientMessageToAll(COLOR_ORANGE, sTr);
        SetTimerEx("BanPlayer", 100, false, "i", playerid);
    }
    return 1;
}
BanPlayer Timer :

pawn Код:
forward BanPlayer(playerid);
public BanPlayer(playerid)
{
    Ban(bID);
    return 1;
}
Please help!


Re: sscanf warning - TomatoRage - 29.03.2013

i saw ****** said once becuase you type capital latters try s small latter not S


Re: sscanf warning - SilverKiller - 29.03.2013

If i type s it is fixed but,

i want the reason to be optional and when i use z

it gives me this :

Код:
sscanf warning: 'z' is deprecated, consider using 'S' instead.



Re: sscanf warning - Djole1337 - 29.03.2013

If you want it optional you can use

S(No reason given)[size]


Re: sscanf warning - SilverKiller - 29.03.2013

Gives me the same warnings in the first post.

EDIT : i fixed it