Save Car
#1

Hello. I have a problem with saving vehicles to the file. When you turn off your server gives me an error and cars are not sticking. Here's the code:
Code:
stock SaveCar(vehid)
{
new Float:HealthCar, FileString[255];
GetVehicleHealth(vehid, HealthCar);
while(vehid < MAX_CARS)
{
format(FileString, sizeof(FileString),"%d,%f,%f,%f,%f,%d,%d,%d,%s,%f,%d,%f,%f,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
CarInfo[vehid][cModel],
CarInfo[vehid][cX],
CarInfo[vehid][cY],
CarInfo[vehid][cZ],
CarInfo[vehid][cA],
CarInfo[vehid][cKolor],
CarInfo[vehid][cKolor2],
CarInfo[vehid][cFraction],
CarInfo[vehid][cOwner],
CarInfo[vehid][cFuel],
CarInfo[vehid][cLock],
CarInfo[vehid][cMileage],
HealthCar,
CarInfo[vehid][cAlarm],
CarInfo[vehid][cTune][0],
CarInfo[vehid][cTune][1],
CarInfo[vehid][cTune][2],
CarInfo[vehid][cTune][3],
CarInfo[vehid][cTune][5],
CarInfo[vehid][cTune][6],
CarInfo[vehid][cTune][7],
CarInfo[vehid][cTune][8],
CarInfo[vehid][cTune][9],
CarInfo[vehid][cTune][10],
CarInfo[vehid][cTune][11],
CarInfo[vehid][cTune][12],
CarInfo[vehid][cTune][13],
CarInfo[vehid][cPanels],
CarInfo[vehid][cDoors],
CarInfo[vehid][cLights],
CarInfo[vehid][cTires]);
}
new File: file;
file = fopen("auta.cfg", io_write);
fwrite(file, FileString);
fclose(file);
return 1;
}
in OnGameModeExit have:
Code:
for(new v = 0; v < MAX_CARS; v++)
{
SaveCar(v);
}
Please Help
// Edit:
And when it gets a record is created haunted lag
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)