sscanf warning: Format specifier does not match parameter count.
#1

Hey guys,

This message on my console, keeps coming up in a lot of commands:

Код:
sscanf warning: Format specifier does not match parameter count.
What is it being caused by? How to fix it?
Reply
#2

No code = No help
Reply
#3

Yes, which happens in a lot of codes, so what's the problem I just wanted to know how it's being caused

Some codes that cause the problem:

pawn Код:
CMD:destroyveh(playerid, params[]) //SSCANFBUG
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COLOR_RED,".:: You are not authorized to use this command ::.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xA40000C8, "You must be in vehicle!");
    new currentveh = GetPlayerVehicleID(playerid);
    DestroyVehicle(currentveh);
    return 1;
}
pawn Код:
CMD:explode(playerid, params[]) //SSCANFBUG
{
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_RED,".:: You are not authorized to use this command ::.");
    new targetid;
    if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");
    else
    {
    new Float:SLX, Float:SLY, Float:SLZ;
    GetPlayerPos(targetid, SLX, SLY,SLZ);
    CreateExplosion(SLX, SLY, SLZ, 11, 0.25);
    new string[128];
    new pName[24], pTame[24];
    GetPlayerName(playerid,pName,24);
    GetPlayerName(targetid,pTame,24);
    format(string,sizeof string,""#COL_ORANGE"[SERVER]"#COL_LRED" %s has been exploded by Administrator %s.",pTame,pName);
    SendClientMessageToAll(COLOR_RED, string);
    }
    return 1;
}
And a lot more
Reply
#4

In explode command it should be "u" not "uz":

pawn Код:
if(sscanf(params, "u", targetid)) return Send
as far as I know the "z" specifier doesn't exist.

pawn Код:
Specifier(s)            Name                Example values
    i, d            Integer             1, 42, -10
    c           Character           a, o, *
    l           Logical             true, false
    b           Binary              01001, 0b1100
    h, x            Hex             1A, 0x23
    o           Octal               045 12
    n           Number              42, 0b010, 0xAC, 045
    f           Float               0.7, -99.5
    g           IEEE Float          0.7, -99.5, INFINITY, -INFINITY, NAN, NAN_E
    u           User name/id (bots and players) ******, 0
    q           Bot name/id         ShopBot, 27
    r           Player name/id          ******, 42
https://sampforum.blast.hk/showthread.php?tid=120356
Reply
#5

z specifier was previously used for optional parameters, but it is now replaced by capital specifiers.

Like if you want optional string, instead of s add S
Reply
#6

Yes, hm .. But, the problem is still there!
Reply
#7

First try updating your sscanf to v2.6 and try.
If that wont work,
Check in other commands which is like /explode, whether extra params are added.
Here,"uz" is added instead of "u",so try checking that if you can.
Reply
#8

Quote:
Originally Posted by [xB]Lordz
Посмотреть сообщение
First try updating your sscanf to v2.6 and try.
If that wont work,
Check in other commands which is like /explode, whether extra params are added.
Here,"uz" is added instead of "u",so try checking that if you can.
I did that my friend, but it's still the problem is there . I think that I suck at scripting .. eh
Reply
#9

Quote:
Originally Posted by Guitar
Посмотреть сообщение
pawn Код:
CMD:destroyveh(playerid, params[]) //SSCANFBUG
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COLOR_RED,".:: You are not authorized to use this command ::.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xA40000C8, "You must be in vehicle!");
    new currentveh = GetPlayerVehicleID(playerid);
    DestroyVehicle(currentveh);
    return 1;
}
You don't even use sscanf here.
Reply
#10

Yes, but when I use that cmd that sscanf msg comes up ..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)