SA-MP Forums Archive
sscanf warning: Format specifier does not match parameter count. - 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: Format specifier does not match parameter count. (/showthread.php?tid=365913)



sscanf warning: Format specifier does not match parameter count. - Camacorn - 04.08.2012

This is the query,

pawn Код:
sscanf(query, "p<|>iiffffii>", VehicleData[id][vID],
VehicleData[id][Model],VehicleData[id][VehX],VehicleData[id][VehY],VehicleData[id][VehZ],
VehicleData[id][VehA],VehicleData[id][Color1],VehicleData[id][Color2]);
Thank you for any help you can give.


Re: sscanf warning: Format specifier does not match parameter count. - Vince - 04.08.2012

Remove the angular bracket at the end, for starters.


Re: sscanf warning: Format specifier does not match parameter count. - Camacorn - 04.08.2012

Problem still persists.


Re: sscanf warning: Format specifier does not match parameter count. - Misiur - 04.08.2012

Could you do printf("%s", query)?


Re: sscanf warning: Format specifier does not match parameter count. - Camacorn - 04.08.2012

Here is the query:
pawn Код:
SELECT * FROM `Cars` WHERE vID='%i'
Here is the entire stock:
pawn Код:
stock LoadCars()
{
    Loop(id, MAX_CARS)
    {
        new query[256];
        format(query, sizeof(query), "SELECT * FROM `Cars` WHERE vID='%i'", id);
        mysql_query(query);
        mysql_store_result();

        sscanf(query, "p<|>iiffffii", VehicleData[id][vID],
        VehicleData[id][Model],VehicleData[id][VehX],VehicleData[id][VehY],VehicleData[id][VehZ],
        VehicleData[id][VehA],VehicleData[id][Color1],VehicleData[id][Color2]);
        printf("%s", query);
        if(VehicleData[id][vID] > 0)
        {
            VehicleData[id][vID] = CreateVehicle(VehicleData[id][Model], VehicleData[id][VehX], VehicleData[id][VehY], VehicleData[id][VehZ], VehicleData[id][VehA], VehicleData[id][Color1], VehicleData[id][Color2], 60);
            printf("Vehicle ID:%i Has Been Loaded From The Database!", id);
            VehicleCount=VehicleCount+1;
        }
    }
    return 1;
}



Re: sscanf warning: Format specifier does not match parameter count. - Kindred - 04.08.2012

Is this why?

pawn Код:
p<|>iiffffii // 9 here, if my counting is correct, I am sleepy

//yet...
VehicleData[id][vID], VehicleData[id][Model],VehicleData[id][VehX],VehicleData[id][VehY],VehicleData[id][VehZ], VehicleData[id][VehA],VehicleData[id][Color1],VehicleData[id][Color2]//8



Re: sscanf warning: Format specifier does not match parameter count. - Camacorn - 04.08.2012

Quote:
Originally Posted by Kindred
Посмотреть сообщение
Is this why?

pawn Код:
p<|>iiffffii // 9 here, if my counting is correct, I am sleepy

//yet...
VehicleData[id][vID], VehicleData[id][Model],VehicleData[id][VehX],VehicleData[id][VehY],VehicleData[id][VehZ], VehicleData[id][VehA],VehicleData[id][Color1],VehicleData[id][Color2]//8
To the best of my knowledge, the query itself is fine.


Re: sscanf warning: Format specifier does not match parameter count. - Vince - 04.08.2012

Quote:
Originally Posted by Camacorn
Посмотреть сообщение
pawn Код:
format(query, sizeof(query), "SELECT * FROM `Cars` WHERE vID='%i'", id);
Oh no, not again this retarded loading method! Please, please, tell me who teaches this kind of stuff? Doing this effectively ruins the whole point of using MySQL. You can use just one (1!) query to fetch ALL rows AT ONCE!


Re: sscanf warning: Format specifier does not match parameter count. - Camacorn - 04.08.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
Oh no, not again this retarded loading method! Please, please, tell me who teaches this kind of stuff? Doing this effectively ruins the whole point of using MySQL. You can use just one (1!) query to fetch ALL rows AT ONCE!
Then instead of complaining about it, why not teach people the better way.


Re: sscanf warning: Format specifier does not match parameter count. - Ranama - 05.08.2012

Edit:understood wrong

But I should know how to do what he said if you are using cache functions from R7 :S