21.07.2016, 00:24
Tengo el siguiente problema; saque y adapte un sistema de guardado de tuning a la mнa, ahora el problema es que no me guarda nada ademбs de no crear lo que seria donde se guardan las cosas es decir "Tuneos/tuning.mods" si coloca llantas o hidrбulica u otra cosa no la guarda al reiniciar el servidor, ademбs de no crear lo que ya he dicho.
Esto es lo que tengo:
OnGameModeInit
resto del codigo:
Y aquн una parte del codigo de algunas funciones:
Espero que me ayuden, estoy perdiendo la cabeza con esto
Esto es lo que tengo:
Код:
enum cInfo { cSpoiler, // Aleron cHood, // Capу cRoof, // Techo cSideskirt, // Faldones cNitro, // N20 cLamps, // Luces Delanteras cExhaust, // Tubo Escape cWheel, // Llantas cHydraulics, // Hidrбulica cPaintjob, // Stereo cFrontBumper, // Par. Delantero cRearBumper, // Par. Trasero cVents, // Respiraderos };
Код:
Starting(); LoadCar(); LoadMods();
Код:
public Starting() { for(new v = 0; v < TOTAL_VEH; v++) { LoadComponents(v); } } public LoadComponents(vehicleid) { AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][0]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][1]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][2]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][3]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][4]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][5]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][6]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][7]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][8]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][9]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][10]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][11]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][12]); AddVehicleComponent(vehicleid,VehiclesMod[vehicleid][13]); } public LoadMods() { new arrCoords[16][64]; new strFromFile2[256]; new File: file = fopen("Tuneos/tuning.mods", io_read); if (file) { new idx; while((idx < TOTAL_VEH)) { fread(file, strFromFile2); split(strFromFile2, arrCoords, '|'); VehiclesMod[idx][0] = strval(arrCoords[0]); VehiclesMod[idx][1] = strval(arrCoords[1]); VehiclesMod[idx][2] = strval(arrCoords[2]); VehiclesMod[idx][3] = strval(arrCoords[3]); VehiclesMod[idx][4] = strval(arrCoords[4]); VehiclesMod[idx][5] = strval(arrCoords[5]); VehiclesMod[idx][6] = strval(arrCoords[6]); VehiclesMod[idx][7] = strval(arrCoords[7]); VehiclesMod[idx][8] = strval(arrCoords[8]); VehiclesMod[idx][9] = strval(arrCoords[9]); VehiclesMod[idx][10] = strval(arrCoords[10]); VehiclesMod[idx][11] = strval(arrCoords[11]); VehiclesMod[idx][12] = strval(arrCoords[12]); VehiclesMod[idx][13] = strval(arrCoords[13]); AddVehicleComponent(idx,VehiclesMod[idx][0]); AddVehicleComponent(idx,VehiclesMod[idx][1]); AddVehicleComponent(idx,VehiclesMod[idx][2]); AddVehicleComponent(idx,VehiclesMod[idx][3]); AddVehicleComponent(idx,VehiclesMod[idx][4]); AddVehicleComponent(idx,VehiclesMod[idx][5]); AddVehicleComponent(idx,VehiclesMod[idx][6]); AddVehicleComponent(idx,VehiclesMod[idx][7]); AddVehicleComponent(idx,VehiclesMod[idx][8]); AddVehicleComponent(idx,VehiclesMod[idx][9]); AddVehicleComponent(idx,VehiclesMod[idx][10]); AddVehicleComponent(idx,VehiclesMod[idx][11]); AddVehicleComponent(idx,VehiclesMod[idx][12]); AddVehicleComponent(idx,VehiclesMod[idx][13]); idx++; } fclose(file); } return 1; } public SaveMods() { new idx; new File: file2; while((idx < TOTAL_VEH)) { VehiclesMod[idx][0] = GetVehicleComponentInSlot(idx,0); VehiclesMod[idx][1] = GetVehicleComponentInSlot(idx,1); VehiclesMod[idx][2] = GetVehicleComponentInSlot(idx,2); VehiclesMod[idx][3] = GetVehicleComponentInSlot(idx,3); VehiclesMod[idx][4] = GetVehicleComponentInSlot(idx,4); VehiclesMod[idx][5] = GetVehicleComponentInSlot(idx,5); VehiclesMod[idx][6] = GetVehicleComponentInSlot(idx,6); VehiclesMod[idx][7] = GetVehicleComponentInSlot(idx,7); VehiclesMod[idx][8] = GetVehicleComponentInSlot(idx,8); VehiclesMod[idx][9] = GetVehicleComponentInSlot(idx,9); VehiclesMod[idx][10] = GetVehicleComponentInSlot(idx,10); VehiclesMod[idx][11] = GetVehicleComponentInSlot(idx,11); VehiclesMod[idx][12] = GetVehicleComponentInSlot(idx,12); VehiclesMod[idx][13] = GetVehicleComponentInSlot(idx,13); new coordsstring[256]; format(coordsstring, sizeof(coordsstring), "%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d ", VehiclesMod[idx][0], VehiclesMod[idx][1], VehiclesMod[idx][2], VehiclesMod[idx][3], VehiclesMod[idx][4], VehiclesMod[idx][5], VehiclesMod[idx][6], VehiclesMod[idx][7], VehiclesMod[idx][8], VehiclesMod[idx][9], VehiclesMod[idx][10], VehiclesMod[idx][11], VehiclesMod[idx][12], VehiclesMod[idx][13]); //VehiclesMod[idx][14] //VehiclesMod[idx][15]); if(idx == 0) { file2 = fopen("Tuneos/tuning.mods", io_write); } else { file2 = fopen("Tuneos/tuning.mods", io_append); } fwrite(file2, coordsstring); idx++; fclose(file2); } return 1; }
Код:
else if(listitem == 1) { PlayerPlaySound(playerid, 1133, 0, 0, 0); SendClientMessage(playerid, COLOR_GREY,"{48CFD7}» {FFFFFF}Hidraulica Agregada. PUTP."); CarInfo[idcar][cHydraulics] = 1087; AddVehicleComponent(idcar, CarInfo[idcar][cHydraulics]); return 1; }