11.09.2015, 21:59
(
Последний раз редактировалось DizZykeee; 24.09.2015 в 04:33.
)
ISSUE STATUS: SOLVED!!
Hi there, I have made a script with a vehicle system which ALMOST works 100%.
I can create and remove vehicles while in-game and the info will be saved and loaded succesfully on respawns and such. But now if I restart my server the vehicles get loaded on their saved Modelid and Color1 + Color2 but not the X, Y, Z, & A.
I am using Y_INI as my saving system since I never had trouble with saving/loading INI files.
My Enums XYZA are with "Float:" in front of it. Aswell in Saving stats and Loading stats its INI_WriteFloat and INI_Float so that should be good in my opnion.
Here is my Loader:
I Have solved the issue by:
Changing the loader and saver a bit..
From:
to:
Hi there, I have made a script with a vehicle system which ALMOST works 100%.
I can create and remove vehicles while in-game and the info will be saved and loaded succesfully on respawns and such. But now if I restart my server the vehicles get loaded on their saved Modelid and Color1 + Color2 but not the X, Y, Z, & A.
I am using Y_INI as my saving system since I never had trouble with saving/loading INI files.
My Enums XYZA are with "Float:" in front of it. Aswell in Saving stats and Loading stats its INI_WriteFloat and INI_Float so that should be good in my opnion.
Here is my Loader:
Код:
//------------------------------------------------------------[ VEHICLE LOADER ] { for(new v = 0; v < sizeof(VehicleInfo); v++) //loop { new vFile[128]; format(vFile, 50, VEHICLE_FOLDER ,v); if(fexist(vFile)) { INI_ParseFile(dFile, "LoadVehicle", .bExtra = true, .extra = v); if(VehicleInfo[v][vModel] != 0) { VehicleInfo[v][vID] = AddStaticVehicleEx(VehicleInfo[v][vModel], VehicleInfo[v][vX], VehicleInfo[v][vY], VehicleInfo[v][vZ], VehicleInfo[v][vA],VehicleInfo[v][vColor1],VehicleInfo[v][vColor2], 0); } } } } //------------------------------------------------------------[ VEHICLE LOADER ]
Changing the loader and saver a bit..
From:
Код:
//SAVING VEHICLES forward SaveVehicle(fileid); public SaveVehicle(fileid) { new vFile[128]; format(vFile, sizeof(vFile),VEHICLE_FOLDER,fileid); new INI:File = INI_Open(vFile); INI_WriteInt(File,"vID",VehicleInfo[fileid][vID]); INI_WriteInt(File,"Model",VehicleInfo[fileid][vModel]); INI_WriteFloat(File,"X",VehicleInfo[fileid][vX]); INI_WriteFloat(File,"Y",VehicleInfo[fileid][vY]); INI_WriteFloat(File,"Z",VehicleInfo[fileid][vZ]); INI_WriteFloat(File,"A",VehicleInfo[fileid][vA]); INI_WriteInt(File,"Color1",VehicleInfo[fileid][vColor1]); INI_WriteInt(File,"Color2",VehicleInfo[fileid][vColor2]); INI_WriteInt(File,"Type",VehicleInfo[fileid][vType]); INI_WriteInt(File,"Owner",VehicleInfo[fileid][vOwner]); INI_Close(File); return 1; } //SAVING VEHICLES ^ ////////////////// //LOADING VEHICLES forward LoadVehicle(fileid, name[], value[]); public LoadVehicle(fileid, name[], value[]) { INI_Int("vID",VehicleInfo[fileid][vID]); INI_Int("Model",VehicleInfo[fileid][vModel]); INI_Float("X",VehicleInfo[fileid][vX]); INI_Float("Y",VehicleInfo[fileid][vY]); INI_Float("Z",VehicleInfo[fileid][vZ]); INI_Float("A",VehicleInfo[fileid][vA]); INI_Int("Color1",VehicleInfo[fileid][vColor1]); INI_Int("Color2",VehicleInfo[fileid][vColor2]); INI_Int("Type",VehicleInfo[fileid][vType]); INI_Int("Owner",VehicleInfo[fileid][vOwner]); return 1; } //LOADING VEHICLES ^
Код:
//SAVING VEHICLES forward SaveVehicle(fileid); public SaveVehicle(fileid) { new vFile[128]; format(vFile, sizeof(vFile),VEHICLE_FOLDER,fileid); new INI:File = INI_Open(vFile); INI_WriteInt(File,"vID",VehicleInfo[fileid][vID]); INI_WriteInt(File,"vModel",VehicleInfo[fileid][vModel]); INI_WriteFloat(File,"vX",VehicleInfo[fileid][vX]); INI_WriteFloat(File,"vY",VehicleInfo[fileid][vY]); INI_WriteFloat(File,"vZ",VehicleInfo[fileid][vZ]); INI_WriteFloat(File,"vA",VehicleInfo[fileid][vA]); INI_WriteInt(File,"vColor1",VehicleInfo[fileid][vColor1]); INI_WriteInt(File,"vColor2",VehicleInfo[fileid][vColor2]); INI_WriteInt(File,"vType",VehicleInfo[fileid][vType]); INI_WriteInt(File,"vOwner",VehicleInfo[fileid][vOwner]); INI_Close(File); return 1; } //SAVING VEHICLES ^ ////////////////// //LOADING VEHICLES forward LoadVehicle(fileid, name[], value[]); public LoadVehicle(fileid, name[], value[]) { INI_Int("vID",VehicleInfo[fileid][vID]); INI_Int("vModel",VehicleInfo[fileid][vModel]); INI_Float("vX",VehicleInfo[fileid][vX]); INI_Float("vY",VehicleInfo[fileid][vY]); INI_Float("vZ",VehicleInfo[fileid][vZ]); INI_Float("vA",VehicleInfo[fileid][vA]); INI_Int("vColor1",VehicleInfo[fileid][vColor1]); INI_Int("vColor2",VehicleInfo[fileid][vColor2]); INI_Int("vType",VehicleInfo[fileid][vType]); INI_Int("vOwner",VehicleInfo[fileid][vOwner]); return 1; } //LOADING VEHICLES ^