[Resolved] Reading vehicles from files.
#1

Ok, i have this, and i cant see why it doesnt work the way i want it to:

pawn Код:
for(new id; id<TotalVehicles; id++)
        {
            fread(carfile, carstr);
           
        sscanf(carstr,"p(sp,ssssssss",type,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7]);
           
           
            printf("|%s|",type);

           //more stuff here (not relevant)
(all the variables are daclared etc etc, i only pasted the piece of code which is relevant)

This reads from a file containing these lines:

Код:
CreateVehicle(400,1,2,3,4,5,6,7);
CreateVehicle(400,1,2,3,4,5,6,7);
AddStaticVehicle(400,1,2,3,4,5,6);
AddStaticVehicleEx(400,1,2,3,4,5,6,7);
NonExistantVehicleThing(400,1,2,3,4,5,6,7);
It should print out this:

Код:
|CreateVehicle|
|CreateVehicle|
|AddStaticVehicle|
|AddStaticVehicleEx|
|NonExistantVehicleThing|
but instead, it prints this:

Код:
||
||
|AddStaticVehicle|
||
|NonExistantVehicleThing|
I have no idea why it doesn't work properly and some parts work fine

If anyone could help me i would be very grateful

Thanks

David

EDIT: Ok i found the problem, the sscanf was failing due to too many params for AddStaticVehicle.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)