[Resolved] Reading vehicles from files. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Resolved] Reading vehicles from files. (
/showthread.php?tid=73651)
[Resolved] Reading vehicles from files. -
pyrodave - 16.04.2009
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.