sscanf warning
#1

Hello,

I've a problem with sscanf and strings:

Quote:

[23:37:04] sscanf warning: No default value found.
[23:37:04] sscanf warning: Unknown format specifier '[', skipping.
[23:37:04] sscanf warning: Unknown format specifier '1', skipping.
[23:37:04] sscanf warning: Unknown format specifier '2', skipping.
[23:37:04] sscanf warning: Unknown format specifier '4', skipping.
[23:37:04] sscanf warning: Unknown format specifier ']', skipping.
[23:37:04] sscanf warning: Format specifier does not match parameter count.

PHP код:
new tmp[10], auxParams[124];
if(
sscanf(params"s[10]S[124]"tmpauxParams))
{
    
SendClientMessage(playerid, -1"[Commande] /admin [Choix]");
    
SendClientMessage(playerid, -1"[Usage] Nom disponible: slap, kick");
    return 
1;

Sorry for my bad english
Reply
#2

there was a similar problem with sscanf time ago, but its fixed in the current version, are you running it ?
also it could be from code above or try use lower case "s"
Reply
#3

pawn Код:
new tmp[10], auxParams[124];
if(sscanf(params, "s[10]s[124]", tmp, auxParams))
{
    SendClientMessage(playerid, -1, "[Commande] /admin [Choix]");
    SendClientMessage(playerid, -1, "[Usage] Nom disponible: slap, kick");
    return 1;
}
try this :/
Reply
#4

Update sscanf include and plugin..
Reply
#5

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
there was a similar problem with sscanf time ago, but its fixed in the current version, are you running it ?
also it could be from code above or try use lower case "s"
No "s", i want to use "S", because it's a optional param

Quote:
Originally Posted by erminpr0
Посмотреть сообщение
Update sscanf include and plugin..
I've downloaded sscanf there one week, but i will try again..
Reply
#6

what if you don't specify the size of the string ?
see what it says then
Reply
#7

When using "S" for optional param, you must specify the string like:
pawn Код:
s[10]S(Optional)[124]
Reply
#8

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
what if you don't specify the size of the string ?
see what it says then
It's by default 32.

---

I actually run an example of your code:
pawn Код:
public OnFilterScriptInit( )
{
    new
        tmp[ 10 ],
        auxParams[ 124 ]
    ;
   
    sscanf( "commands blablablabla....", "s[10]S[124]", tmp, auxParams );

    printf( "1: \"%s\" & 2: \"%s\"", tmp, auxParams );
    return 1;
}
and I got:
pawn Код:
[22:07:54] sscanf warning: No default value found.
[22:07:54] 1: "commands" & 2: "blablablabla...."
Not what you got (those warnings). And by adding a default value, it doesn't give any sscanf warning.

pawn Код:
public OnFilterScriptInit( )
{
    new
        tmp[ 10 ],
        auxParams[ 124 ]
    ;
   
    sscanf( "commands", "s[10]S(Optional string)[124]", tmp, auxParams );

    printf( "1: \"%s\" & 2: \"%s\"", tmp, auxParams );
    return 1;
}
---

So I suggest you to post your problem in the sscanf's thread (since it's related to that) and you may get your answer faster than from this section.
Reply
#9

The optional variable u want is this way sir:
pawn Код:
if(sscanf(params, "s[10]S(124)", tmp, auxParams))
//or
if(sscanf(params, "s[10]S[124](124)", tmp, auxParams))
using "()" these type of brackets, that's how i believe it was at least
Reply
#10

I don't work..

I test (124), etc, etc .. No result

PHP код:
YCMD:admin(playeridparams[], help)
{
    new 
tmp[32], auxParams[128];
    if(
sscanf(params"s[10]S[124]"tmpauxParams))
    {
        return 
SendClientMessage(playerid, -1"{9DEB00}Usage: /admin [Choix]");
    }
    else
    {
        if(
strcmp(tmp"slap"true) == 0)
        {
            new 
useridraison[50];
            if(
sscanf(auxParams"uS[50]"useridraison)) return SendClientMessage(playerid, -1"[Commande] /admin slap [ID/Partie du Nom] [Raison (facultatif)]");
            else
            {
                if(
InvalidPlayerID(playeriduserid)) return 1;
                
GetPlayerPos(useridPOS_[0], POS_[1], POS_[2]);
                
SetPlayerPos(useridPOS_[0], POS_[1], POS_[2]+5);
                if(
strlen(raison) > 0)
                       
SendClientMessageToAllEx(-1"[ADMIN] L'admin %s a slap %s. Raison: %s"returnNameEx(playerid), returnNameEx(userid), raison);
                else
                    
SendClientMessageToAllEx(-1"[ADMIN] L'admin %s a slap %s."returnNameEx(playerid), returnNameEx(userid));
            }
        }
        else 
SendClientDialog(playerid3000"Cette sous commande n'existe pas.");
    }
    return 
1;

Quote:

[19:23:45] sscanf warning: No default value found.
[19:23:45] sscanf warning: Unknown format specifier '[', skipping.
[19:23:45] sscanf warning: Unknown format specifier '1', skipping.
[19:23:45] sscanf warning: Unknown format specifier '2', skipping.
[19:23:45] sscanf warning: Unknown format specifier '4', skipping.
[19:23:45] sscanf warning: Unknown format specifier ']', skipping.
[19:23:45] sscanf warning: Format specifier does not match parameter count.
[19:23:51] sscanf warning: No default value found.
[19:23:51] sscanf warning: No default value found.
[19:23:51] sscanf warning: Unknown format specifier '[', skipping.
[19:23:51] sscanf warning: Unknown format specifier '5', skipping.
[19:23:51] sscanf warning: Unknown format specifier '0', skipping.
[19:23:51] sscanf warning: Unknown format specifier ']', skipping.
[19:23:51] sscanf warning: Format specifier does not match parameter count.
[19:23:53] sscanf warning: No default value found.
[19:23:53] sscanf warning: No default value found.
[19:23:56] sscanf warning: No default value found.
[19:23:56] sscanf warning: No default value found.
[19:23:59] sscanf warning: No default value found.
...
...
..

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)