09.03.2014, 15:46
I'm posting this in a new thread because although its the same issue my weapon system had, I think its a different cause, this time its not assigning the values correctly. I just implemented a car system and it has the exact same problem, the file for the car isn't being created unless I shut the server down while I am ingame, and when they are, they aren't receiving any names for the cars, (its meant to be "%d.ini(in the case of id 0 = 0.ini) But its just being saved as .ini)
Its just not saving the vehicle correctly, I'm pretty sure it'll load fine when it saves, but it just refuses to save correctly, but produces no errors, any advice would be helpful, thanks.
Код:
stock VehicleGet(vehicleID) { GetVehiclePos(VehicleInfo[vehicleID][vID], VehicleInfo[vehicleID][vX], VehicleInfo[vehicleID][vY], VehicleInfo[vehicleID][vZ]); GetVehicleZAngle(VehicleInfo[vehicleID][vID], VehicleInfo[vehicleID][vA]); } stock VehicleLoad(vehicleID, file[]) { INI_ParseFile(file, "LoadVehicleData", .bExtra = true, .extra = vehicleID); VehicleCreate(VehicleInfo[vehicleID][vModel], VehicleInfo[vehicleID][vX], VehicleInfo[vehicleID][vY], VehicleInfo[vehicleID][vZ], VehicleInfo[vehicleID][vA], VehicleInfo[vehicleID][vColor1], VehicleInfo[vehicleID][vColor2], VehicleInfo[vehicleID][vRespawn], VehicleInfo[vehicleID][vOwner]); } forward LoadVehicleData(vehicleID, name[], value[]); public LoadVehicleData(vehicleID, name[], value[]) { INI_Int("model", VehicleInfo[vehicleID][vModel]); INI_Float("xloc", VehicleInfo[vehicleID][vX]); INI_Float("yloc", VehicleInfo[vehicleID][vY]); INI_Float("zloc", VehicleInfo[vehicleID][vZ]); INI_Float("aloc", VehicleInfo[vehicleID][vA]); INI_Int("color1", VehicleInfo[vehicleID][vColor1]); INI_Int("color2", VehicleInfo[vehicleID][vColor2]); INI_Int("respawn", VehicleInfo[vehicleID][vRespawn]); INI_String("owner", VehicleInfo[vehicleID][vOwner], MAX_PLAYER_NAME); return 1; } stock VehicleSave(vehicleID) { new INI:dFile = INI_Open(VehiclePath(vehicleID)); INI_WriteInt(dFile, "model", VehicleInfo[vehicleID][vModel]); INI_WriteFloat(dFile, "xloc", VehicleInfo[vehicleID][vX]); INI_WriteFloat(dFile, "yloc", VehicleInfo[vehicleID][vY]); INI_WriteFloat(dFile, "zloc", VehicleInfo[vehicleID][vZ]); INI_WriteFloat(dFile, "aloc", VehicleInfo[vehicleID][vA]); INI_WriteInt(dFile, "color1", VehicleInfo[vehicleID][vColor1]); INI_WriteInt(dFile, "color2", VehicleInfo[vehicleID][vColor2]); INI_WriteInt(dFile, "respawn", VehicleInfo[vehicleID][vRespawn]); INI_WriteString(dFile, "owner", VehicleInfo[vehicleID][vOwner]); INI_Close(dFile); return 1; } stock VehicleLoadAll() { new index = 0; while(fexist(VehiclePath(index))) { VehicleLoad(index, VehiclePath(index)); index++; } printf("Vehicles Loaded: %d", index); } stock VehicleSaveAll() { new index = 0; for(new i = 0; i < MAX_VEHICLES; i++) { if(vCreated[i]) { VehicleGet(index); VehicleSave(index); index++; } } printf("Vehicles Saved: %d", index); }