14.10.2016, 13:57
Hello, yesterday I have added that admins are able to add street names but they aren't saving/loading
See house load:
added the f
see house save:
added %f
They aren't saving or loading I don't see what is wrong here..
See house load:
Код:
stock LoadHouses() { if(!fexist("houses.cfg")) return 1; new szFileStr[1024], File: iFileHandle = fopen("houses.cfg", io_read), iIndex; while(iIndex < sizeof(HouseInfo) && fread(iFileHandle, szFileStr)) { sscanf(szFileStr, "p<|>iiis[24]ffffffffiiiiiiiiiiiiiiiiifff", HouseInfo[iIndex][hOwned], HouseInfo[iIndex][hLevel], HouseInfo[iIndex][hHInteriorWorld], //HouseInfo[iIndex][hDescription], HouseInfo[iIndex][hOwner], HouseInfo[iIndex][hExteriorX], HouseInfo[iIndex][hExteriorY], HouseInfo[iIndex][hExteriorZ], HouseInfo[iIndex][hExteriorR], HouseInfo[iIndex][hInteriorX], HouseInfo[iIndex][hInteriorY], HouseInfo[iIndex][hInteriorZ], HouseInfo[iIndex][hInteriorR], HouseInfo[iIndex][hLock], HouseInfo[iIndex][hRentable], HouseInfo[iIndex][hRentFee], HouseInfo[iIndex][hValue], HouseInfo[iIndex][hSafeMoney], HouseInfo[iIndex][hPot], HouseInfo[iIndex][hCrack], HouseInfo[iIndex][hMaterials], HouseInfo[iIndex][hWeapons][0], HouseInfo[iIndex][hWeapons][1], HouseInfo[iIndex][hWeapons][2], HouseInfo[iIndex][hWeapons][3], HouseInfo[iIndex][hWeapons][4], HouseInfo[iIndex][hGLUpgrade], HouseInfo[iIndex][hPickupID], HouseInfo[iIndex][hCustomInterior], HouseInfo[iIndex][hCustomExterior], HouseInfo[iIndex][hExteriorA], HouseInfo[iIndex][hInteriorA], HouseInfo[iIndex][hAddress] ); if(HouseInfo[iIndex][hLevel] != 0) { if(HouseInfo[iIndex][hOwned]) { if(HouseInfo[iIndex][hRentable] == 0) format(szFileStr, sizeof(szFileStr), "House owner: %s\nLevel: %d\nHouse number: %d\n Street name: %s",HouseInfo[iIndex][hOwner],HouseInfo[iIndex][hLevel],iIndex,HouseInfo[iIndex][hAddress]); else format(szFileStr, sizeof(szFileStr), "House owner: %s\nLevel: %d\nHouse number: %d\n Street name: %s\nRent: $%d\nType /rentroom to rent a room",HouseInfo[iIndex][hOwner],HouseInfo[iIndex][hLevel],iIndex,HouseInfo[iIndex][hAddress],HouseInfo[iIndex][hRentFee]); } else format(szFileStr, sizeof(szFileStr), "This house is for sale!\n Level: %d\nHouse number: %d\n Street name: %s\nPrice: $%d\nTo buy this house type /buyhouse",HouseInfo[iIndex][hLevel],iIndex,HouseInfo[iIndex][hAddress],HouseInfo[iIndex][hValue]); HouseInfo[iIndex][hPickupID] = CreatePickup(19524, 23, HouseInfo[iIndex][hExteriorX], HouseInfo[iIndex][hExteriorY], HouseInfo[iIndex][hExteriorZ], -1); HouseInfo[iIndex][hTextID] = CreateDynamic3DTextLabel(szFileStr, COLOR_HOUSEGREEN, HouseInfo[iIndex][hExteriorX], HouseInfo[iIndex][hExteriorY], HouseInfo[iIndex][hExteriorZ]+0.5,20.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 10.0); } ++iIndex; } print("Houses successfully loaded[No Mysql]"); return fclose(iFileHandle); }
see house save:
Код:
stock SaveHouses() { new szFileStr[1024], File: fHandle = fopen("houses.cfg", io_write); for(new iIndex; iIndex < MAX_HOUSES; iIndex++) { format(szFileStr, sizeof(szFileStr), "%d|%d|%d|%s|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%f|%f\r\n", HouseInfo[iIndex][hOwned], HouseInfo[iIndex][hLevel], HouseInfo[iIndex][hHInteriorWorld], //HouseInfo[iIndex][hDescription], HouseInfo[iIndex][hOwner], HouseInfo[iIndex][hExteriorX], HouseInfo[iIndex][hExteriorY], HouseInfo[iIndex][hExteriorZ], HouseInfo[iIndex][hExteriorR], HouseInfo[iIndex][hInteriorX], HouseInfo[iIndex][hInteriorY], HouseInfo[iIndex][hInteriorZ], HouseInfo[iIndex][hInteriorR], HouseInfo[iIndex][hLock], HouseInfo[iIndex][hRentable], HouseInfo[iIndex][hRentFee], HouseInfo[iIndex][hValue], HouseInfo[iIndex][hSafeMoney], HouseInfo[iIndex][hPot], HouseInfo[iIndex][hCrack], HouseInfo[iIndex][hMaterials], HouseInfo[iIndex][hWeapons][0], HouseInfo[iIndex][hWeapons][1], HouseInfo[iIndex][hWeapons][2], HouseInfo[iIndex][hWeapons][3], HouseInfo[iIndex][hWeapons][4], HouseInfo[iIndex][hGLUpgrade], HouseInfo[iIndex][hPickupID], HouseInfo[iIndex][hCustomInterior], HouseInfo[iIndex][hCustomExterior], HouseInfo[iIndex][hExteriorA], HouseInfo[iIndex][hInteriorA], HouseInfo[iIndex][hAddress] ); fwrite(fHandle, szFileStr); } return fclose(fHandle); }
They aren't saving or loading I don't see what is wrong here..