29.03.2014, 00:08
I am making a save function for my vehicle system and i get the line too long error.
here is the code
Please help
here is the code
Код:
stock SaveCar()
{
if(!fexist("car.cfg")) fcreate("car.cfg");
new idx = 1, File:file;
new string[500];
while(idx < MAX_CAR)
{
format(string, sizeof(string), "%d|%d|%s|%f|%f|%f|%f|%d|%d|%d|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\r\n", CarInfo[idx][cStatus], CarInfo[idx][cDealership], CarInfo[idx][cOwner], CarInfo[idx][cX], CarInfo[idx][cY], CarInfo[idx][cZ], CarInfo[idx][cAngle], CarInfo[idx][cModel], CarInfo[idx][cColor1], CarInfo[idx][cColor2], CarInfo[idx][cCost], CarInfo[idx][cLicensePlate], CarInfo[idx][cMod1], CarInfo[idx][cMod2], CarInfo[idx][cMod3], CarInfo[idx][cMod4], CarInfo[idx][cMod5], CarInfo[idx][cMod6], CarInfo[idx][cMod7], CarInfo[idx][cMod8], CarInfo[idx][cMod9], CarInfo[idx][cMod10]);
if(idx == 1)
{
file = fopen("car.cfg", io_write);
}
else
{
file = fopen("car.cfg", io_append);
}
fwrite(file, string);
fclose(file);
idx++;
}
print("Cars saved successfully.");
}

