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

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.
Reply
#2

Remove the angular bracket at the end, for starters.
Reply
#3

Problem still persists.
Reply
#4

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

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;
}
Reply
#6

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
Reply
#7

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.
Reply
#8

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!
Reply
#9

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.
Reply
#10

Edit:understood wrong

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


Forum Jump:


Users browsing this thread: 1 Guest(s)