07.08.2017, 18:19
Hey guys,
So basically this code is not saving properly. Like it saves but not in the correct order, messing up the id's when loading after that. If it doesnt save properly, each variable will start belonging to another vehicle, and i dont want that. The code seems fine to me, could u guys take a look at it?
So basically this code is not saving properly. Like it saves but not in the correct order, messing up the id's when loading after that. If it doesnt save properly, each variable will start belonging to another vehicle, and i dont want that. The code seems fine to me, could u guys take a look at it?
Код:
public:SaveDynamicCarsObjects() { new idx; new File: file2; while (idx < sizeof(DynamicCarsObjects)) { new coordsstring[512]; format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%f|%f|%d|%f|%f|%f|%f|%f|%f|%d|%f|%f|%f|%f|%f|%f|%d|%f|%f|%f|%f|%f|%f|%d|%f|%f|%f|%f|%f|%f\n", DynamicCarsObjects[idx][cObject1Model], DynamicCarsObjects[idx][cObject1PosX], DynamicCarsObjects[idx][cObject1PosY], DynamicCarsObjects[idx][cObject1PosZ], DynamicCarsObjects[idx][cObject1RotX], DynamicCarsObjects[idx][cObject1RotY], DynamicCarsObjects[idx][cObject1RotZ], DynamicCarsObjects[idx][cObject2Model], DynamicCarsObjects[idx][cObject2PosX], DynamicCarsObjects[idx][cObject2PosY], DynamicCarsObjects[idx][cObject2PosZ], DynamicCarsObjects[idx][cObject2RotX], DynamicCarsObjects[idx][cObject2RotY], DynamicCarsObjects[idx][cObject2RotZ], DynamicCarsObjects[idx][cObject3Model], DynamicCarsObjects[idx][cObject3PosX], DynamicCarsObjects[idx][cObject3PosY], DynamicCarsObjects[idx][cObject3PosZ], DynamicCarsObjects[idx][cObject3RotX], DynamicCarsObjects[idx][cObject3RotY], DynamicCarsObjects[idx][cObject3RotZ], DynamicCarsObjects[idx][cObject4Model], DynamicCarsObjects[idx][cObject4PosX], DynamicCarsObjects[idx][cObject4PosY], DynamicCarsObjects[idx][cObject4PosZ], DynamicCarsObjects[idx][cObject4RotX], DynamicCarsObjects[idx][cObject4RotY], DynamicCarsObjects[idx][cObject4RotZ], DynamicCarsObjects[idx][cObject5Model], DynamicCarsObjects[idx][cObject5PosX], DynamicCarsObjects[idx][cObject5PosY], DynamicCarsObjects[idx][cObject5PosZ], DynamicCarsObjects[idx][cObject5RotX], DynamicCarsObjects[idx][cObject5RotY], DynamicCarsObjects[idx][cObject5RotZ]); if(idx == 0) { file2 = fopen("CRP_Scriptfiles/Cars/carobjects.cfg", io_write); } else { file2 = fopen("CRP_Scriptfiles/Cars/carobjects.cfg", io_append); } fwrite(file2, coordsstring); idx++; fclose(file2); } return 1; }