16.07.2013, 14:46
For some reason, once every few restarts, a few random houses gets their data all blank.
First is load, second is save. Keep in mind that things like position, exit and design don't change, so I don't save them (pointless to do so)
First is load, second is save. Keep in mind that things like position, exit and design don't change, so I don't save them (pointless to do so)
Код:
for (new i; i != MAX_HOUSES ; i++){ hOwnerName[i] = " "; if(fexist(hPath(i))){ INI_ParseFile(hPath(i),"loadhouses_%s", .bExtra = true, .extra = i); hInfo[i][hPickup] = CreateDynamicPickup(hInfo[i][owned] ? 1273 : 1272, 1, hInfo[i][hPickX], hInfo[i][hPickY], hInfo[i][hPickZ]); } } public loadhouses_house(houseid, name[], value[]) //load houses function { INI_Int("ID", hInfo[houseid][hID]); //House ID /* House Pickups and Exits */ INI_Float("PickX", hInfo[houseid][hPickX]); INI_Float("PickY", hInfo[houseid][hPickY]); INI_Float("PickZ", hInfo[houseid][hPickZ]); INI_Int("Design", hInfo[houseid][hDesign]); INI_Int("Price", hInfo[houseid][hPrice]); INI_Bool("Owned", hInfo[houseid][owned]); INI_String("Owner", hOwnerName[houseid], MAX_PLAYER_NAME); INI_Float("ExitX", hInfo[houseid][hExitX]); INI_Float("ExitY", hInfo[houseid][hExitY]); INI_Float("ExitZ", hInfo[houseid][hExitZ]); return 1; } public OnGameModeExit() { for (new i; i != MAX_HOUSES; i++){ if (!fexist(hPath(i))) continue; new INI:file = INI_Open(hPath(i)); //will open their file INI_SetTag(file,"House Data"); INI_WriteBool(file,"Owned", hInfo[i][owned]); INI_WriteString(file,"Owner", hOwnerName[i]); INI_Close(file); } print("Gamemode ended."); return 1; }