Problem with sscanf warnings.
#1

Hello.

When I delete my LoadBusinesses(); from OnGameModeInIt I get no sscanf warnings: Format specifier does not match parameter count.

But when I add it once again, I get them.

I have been looking over the code and I can't really see the problem. Also my friend gave it to me so I can't really know whats wrong.. Anyway can anyone of you see the problem in this code..

pawn Код:
LoadBusinesses() {

    if(!fexist("businesses.cfg")) return 1;

    new
        szFileStr[1024],
        File: iFileHandle = fopen("businesses.cfg", io_read),
        iIndex;

    while(iIndex < sizeof(BizInfo) && fread(iFileHandle, szFileStr)) {
        sscanf(szFileStr, "p<|>iiis[128]s[24]ffffffffiiiff",
            BizInfo[iIndex][bOwned],
            BizInfo[iIndex][bLevel],
            BizInfo[iIndex][bHInteriorWorld],
            BizInfo[iIndex][bDescription],
            BizInfo[iIndex][bOwner],
            BizInfo[iIndex][bExteriorX],
            BizInfo[iIndex][bExteriorY],
            BizInfo[iIndex][bExteriorZ],
            BizInfo[iIndex][bExteriorR],
            BizInfo[iIndex][bInteriorX],
            BizInfo[iIndex][bInteriorY],
            BizInfo[iIndex][bInteriorZ],
            BizInfo[iIndex][bInteriorR],
            BizInfo[iIndex][bValue],
            BizInfo[iIndex][bPickupID],
            BizInfo[iIndex][bCustomInterior],
            BizInfo[iIndex][bCustomExterior],
            BizInfo[iIndex][bExteriorA],
            BizInfo[iIndex][bInteriorA]
        );

        if(BizInfo[iIndex][bOwned]) {
            format(szFileStr, sizeof(szFileStr), "%s\n[Owner: %s]\nLevel: %d\nID: %d",BizInfo[iIndex][bDescription],BizInfo[iIndex][bOwner],BizInfo[iIndex][bLevel],iIndex);

            DestroyDynamicPickup(BizInfo[iIndex][bPickupID]);
            BizInfo[iIndex][bPickupID] = CreateDynamicPickup(1274, 23, BizInfo[iIndex][bExteriorX], BizInfo[iIndex][bExteriorY], BizInfo[iIndex][bExteriorZ]);
        }
        else format(szFileStr, sizeof(szFileStr), "%s\n[Owner: None]\nCost: $%d\n Level: %d\nID: %d\nTo buy this business type /buybiz",BizInfo[iIndex][bDescription],BizInfo[iIndex][bValue],BizInfo[iIndex][bLevel],iIndex);

        DestroyDynamicPickup(BizInfo[iIndex][bPickupID]);
        BizInfo[iIndex][bPickupID] = CreateDynamicPickup(1274, 23, BizInfo[iIndex][bExteriorX], BizInfo[iIndex][bExteriorY], BizInfo[iIndex][bExteriorZ]);
        BizInfo[iIndex][bTextID] = CreateDynamic3DTextLabel(szFileStr, COLOR_LIGHTBLUE, BizInfo[iIndex][bExteriorX], BizInfo[iIndex][bExteriorY], BizInfo[iIndex][bExteriorZ]+0.5,30.0, .testlos = 1, .streamdistance = 30.0);
        ++iIndex;
    }
    return fclose(iFileHandle);
}
All help appreciated.
Reply
#2

PHP код:
p<|>iiis[128]s[24]ffffffffiiiff
i                BizInfo
[iIndex][bOwned],
i                BizInfo[iIndex][bLevel],
i                BizInfo[iIndex][bHInteriorWorld],
s[128]        BizInfo[iIndex][bDescription],
s[24]          BizInfo[iIndex][bOwner],
f[1]            BizInfo[iIndex][bExteriorX],
f[2]            BizInfo[iIndex][bExteriorY],
f[3]            BizInfo[iIndex][bExteriorZ],
f[4]            BizInfo[iIndex][bExteriorR],
f[5]            BizInfo[iIndex][bInteriorX],
f[6]            BizInfo[iIndex][bInteriorY],
f[7]            BizInfo[iIndex][bInteriorZ],
f[8]            BizInfo[iIndex][bInteriorR],
i[1]            BizInfo[iIndex][bValue],
i[2]            BizInfo[iIndex][bPickupID],
i[3]            BizInfo[iIndex][bCustomInterior],
f[1]            BizInfo[iIndex][bCustomExterior],
f[2]            BizInfo[iIndex][bExteriorA],
??              
BizInfo[iIndex][bInteriorA
Reply
#3

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
PHP код:
p<|>iiis[128]s[24]ffffffffiiiff
i                BizInfo
[iIndex][bOwned],
i                BizInfo[iIndex][bLevel],
i                BizInfo[iIndex][bHInteriorWorld],
s[128]        BizInfo[iIndex][bDescription],
s[24]          BizInfo[iIndex][bOwner],
f[1]            BizInfo[iIndex][bExteriorX],
f[2]            BizInfo[iIndex][bExteriorY],
f[3]            BizInfo[iIndex][bExteriorZ],
f[4]            BizInfo[iIndex][bExteriorR],
f[5]            BizInfo[iIndex][bInteriorX],
f[6]            BizInfo[iIndex][bInteriorY],
f[7]            BizInfo[iIndex][bInteriorZ],
f[8]            BizInfo[iIndex][bInteriorR],
i[1]            BizInfo[iIndex][bValue],
i[2]            BizInfo[iIndex][bPickupID],
i[3]            BizInfo[iIndex][bCustomInterior],
f[1]            BizInfo[iIndex][bCustomExterior],
f[2]            BizInfo[iIndex][bExteriorA],
??              
BizInfo[iIndex][bInteriorA
What does the p stand for? And what should I change to fix it?
Reply
#4

p will change the delimiter
so instead of exploding the text by space, it will explode by |
PHP код:
sscanf("1,2,3","p<,>iii"var0var1var2);
// var0 = 1
// var1 = 2
// var3 = 3 
My guess would be "BizInfo[iIndex][bInteriorA]" is the facing angle, and so add "f" at the end.
Reply
#5

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
p will change the delimiter
so instead of exploding the text by space, it will explode by |
PHP код:
sscanf("1,2,3","p<,>iii"var0var1var2);
// var0 = 1
// var1 = 2
// var3 = 3 
My guess would be "BizInfo[iIndex][bInteriorA]" is the facing angle, and so add "f" at the end.
Thank you so much! +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)