Здравствуйте!
После рестарта слетают дома. Записи в houses.cfg появляются, сохраняются, но не загружаются..
Без рестарта все работает отлично.
Вот стоки загрузки и сохранения домов, помогите:
PHP код:
stock LoadHouses() //загрузка домов
{
new File = ini_openFile("House/config.ini");
ini_getInteger(File,"Houses",AllHouse);
ini_closeFile(File);
new arrCoords[10][64];
new strFromFile2[256];
new File: file = fopen("House/houses.cfg", io_read);
if(file)
{
new idx;
while (idx < AllHouse)
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
HousesInfo[idx][hOwned] = strval(arrCoords[0]);
strmid(HousesInfo[idx][hOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
HousesInfo[idx][hX] = floatstr(arrCoords[2]);
HousesInfo[idx][hY] = floatstr(arrCoords[3]);
HousesInfo[idx][hZ] = floatstr(arrCoords[4]);
HousesInfo[idx][hInterior] = strval(arrCoords[5]);
HousesInfo[idx][hVirtWorld] = strval(arrCoords[6]);
HousesInfo[idx][hPrice] = strval(arrCoords[7]);
HousesInfo[idx][hLock] = strval(arrCoords[8]);
HousesInfo[idx][hLevel] = strval(arrCoords[9]);
idx++;
}
printf("[ Загрузка ... ] Дома загружены - %d",idx);
fclose(file);
}
return true;
}
stock SaveHouses()//Сохранение домов
{
new File = ini_openFile("House/config.ini");
ini_setInteger(File,"Houses",AllHouse);
ini_closeFile(File);
new idx;
new File: file2;
while(idx < AllHouse)
{
new coordsstring[300];
format(coordsstring, sizeof(coordsstring), "%d,%s,%f,%f,%f,%d,%d,%d,%d,%d\n",
HousesInfo[idx][hOwned],
HousesInfo[idx][hOwner],
HousesInfo[idx][hX],
HousesInfo[idx][hY],
HousesInfo[idx][hZ],
HousesInfo[idx][hInterior],
HousesInfo[idx][hVirtWorld],
HousesInfo[idx][hPrice],
HousesInfo[idx][hLock],
HousesInfo[idx][hLevel]);
if(!idx) file2 = fopen("House/houses.cfg", io_write);
else file2 = fopen("House/houses.cfg", io_append);
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return true;
И при заходе на сервер после рестарта, спавнит в каком-то интерьере, из которого нельзя выйти.. хотя "дома загружены = 0".
PHP код:
new hh = PlayerInfo[playerid][pHouse];
if(hh != 255)//Дом есть. Будет спавнится в своём доме.
{
SetPlayerInterior(playerid, HInts[HousesInfo[hh][hInterior]][hiInt]);
SetPlayerPos(playerid, HInts[HousesInfo[hh][hInterior]][hiX], HInts[HousesInfo[hh][hInterior]][hiY], HInts[HousesInfo[hh][hInterior]][hiZ]);
SetPlayerVirtualWorld(playerid, HousesInfo[hh][hVirtWorld]);
return true;
}
if(hh == 255)//Дома нету.
{
SetPlayerPos(playerid,1757.6338,-1895.7892,13.5561);
SetPlayerFacingAngle(playerid, 270.8289);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid,0);
В чем может быть дело?