SA-MP Forums Archive
File convertion - 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: File convertion (/showthread.php?tid=542306)



File convertion - Fjclip99 - 18.10.2014

Hi, So i have a lot of CcreateVehicle codes and i want to convert it so i can put it in my .ini files...
example:
CreateVehicle(400, 1786.7455, -2023.5853, 13.5134, 180.0000, 0, 0, 0);
and i want to convert it like this:
Код:
[Vehicle]
Model = 400
PosX = 1786.7455
PosY = -2023.5853
PosZ = 13.5134
Rotate = 180.0000
Color1 = 0
Color2 = 0
I have a lot of those files to convert... and it would take it for ever if i would need to do every sigle each of them...
is there any converters online, or maybe is it possible in Excel...?


Re: File convertion - austin070 - 18.10.2014

Just put your saving code in a loop to save it for every vehicle.

pawn Код:
for(new i=1; i<=MAX_VEHICLES; i++)
{
     SaveVehicleFunction(i);
     return 1;
}



Re: File convertion - Jefff - 18.10.2014

pawn Код:
new File:F = fopen("File_With_All_CreateVehicle.txt",io_read);
new vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay;
while(fread(F,str))
{
    sscanf(str,"p<,>iffffiip<)>i",vehicletype,x,y,z,rotation,color1,color2,respawn_delay);
    // ini open ini write ini close
}
fclose(F);