• Уважаемый Гость.
    - Прежде чем создать свою тему, пожалуйста, попробуй воспользоваться этим -> ПОИСКОМ !!!
    - После решения Вашего вопроса (проблемы) - нажмите "Лучший ответ", на сообщении, которое его решило. За игнорирование этого действия - Вы получите соответствующее предупреждение. Мы - стараемся Вам помочь. Уделите 10 секунд - чтобы нажать кнопку. (Если у Вас нет такой возможности - укажите в последнем своем сообщении какой ответ Вы считаете лучшим. Наши модераторы сделают это за Вас)
    ЗАПРЕЩЕНО:
    - Cоздавать темы с названиями "Помогите", "Плиз", "Ошибка", "Не могу найти", "Хелп" и тому подобное;
    - Cоздавать темы без детального описания того, что нужно исправить.
    - Cоздавать темы из одного скриншота.
    За игнор правил форума - Ваша тема будет удалена, а Вы получите системное предупреждение.

Загадка с домами

Статус
В этой теме нельзя размещать новые ответы.

セルゲイ

Начинающий
Пользователь
Регистрация
2 Янв 2019
Сообщения
58
Лучшие ответы
0
Репутация
7
Весёлая карусель с домами которая не даёт покоя, в общем, ошибок в mysql.log не наблюдал.
Захожу на сервер, покупаю дом - сохранение есть, смотрел в таблице house, а так-же в аккаунтах в определенном поле ид дома правильный, делал проверку через printf при покупке дома чтобы выводил id дома - выводит валидный.
Делаю рестарт, дом слетает с аккаунта, но в таблице с домами есть - ибо нету при слете дома обновления в бд, только в таблице с аккаунтами. Я могу продавать и делать стандартные действия с домом, кроме проверок на дом из таблицы с аккаунтами.
Дом на карте зелёный и его можно ещё раз купить.

Загрузка домов:
Код:
publics: LoadProperty()
{
	new fields;

	cache_get_data(TOTAL_HOUSE,fields,connects);
	
	new h_online, h_online_arendator[2];
	
	if(--TOTAL_HOUSE <= 0)
		return printf("Дома не загружены.");
	
	string[0] = EOS;

	for(new he; he <= TOTAL_HOUSE; he++)
	{
		HouseInfo[he][hID] = cache_get_field_content_int(he, "hID", connects);

		HouseInfo[he][hEnter][0] = cache_get_field_content_float(he, "hEntrancex", connects);
		HouseInfo[he][hEnter][1] = cache_get_field_content_float(he, "hEntrancey", connects);
		HouseInfo[he][hEnter][2] = cache_get_field_content_float(he, "hEntrancez", connects);

		HouseInfo[he][hExit][0] = cache_get_field_content_float(he, "hExitx", connects);
		HouseInfo[he][hExit][1] = cache_get_field_content_float(he, "hExity", connects);
		HouseInfo[he][hExit][2] = cache_get_field_content_float(he, "hExitz", connects);

		cache_get_field_content(he, "hOwner", HouseInfo[he][hOwner], connects, strlen(HouseInfo[he][hOwner]));

		HouseInfo[he][hValue] = cache_get_field_content_int(he, "hValue", connects);
		HouseInfo[he][hHel] = cache_get_field_content_int(he, "hHel", connects);
		HouseInfo[he][hInt] = cache_get_field_content_int(he, "hInt", connects);
		HouseInfo[he][hLock] = cache_get_field_content_int(he, "hLock", connects);
		HouseInfo[he][hOwned] = cache_get_field_content_int(he, "hOwned", connects);
		HouseInfo[he][hKlass] = cache_get_field_content_int(he, "hKlass", connects);
		HouseInfo[he][hVehSost] = cache_get_field_content_int(he, "hVehSost", connects);

		HouseInfo[he][hCar][0] = cache_get_field_content_float(he, "hCarx", connects);
		HouseInfo[he][hCar][1] = cache_get_field_content_float(he, "hCary", connects);
		HouseInfo[he][hCar][2] = cache_get_field_content_float(he, "hCarz", connects);
		HouseInfo[he][hCar][3] = cache_get_field_content_float(he, "hCarc", connects);

		HouseInfo[he][hStyle] = cache_get_field_content_int(he, "hStyle", connects);
		HouseInfo[he][hSafe] = cache_get_field_content_int(he, "hSafe", connects);
		HouseInfo[he][hNarko] = cache_get_field_content_int(he, "hNarko", connects);

		HouseInfo[he][hGun][0] = cache_get_field_content_int(he, "hGun1", connects);
		HouseInfo[he][hGun][1] = cache_get_field_content_int(he, "hGun2", connects);
		HouseInfo[he][hGun][2] = cache_get_field_content_int(he, "hGun3", connects);
		HouseInfo[he][hGun][3] = cache_get_field_content_int(he, "hGun4", connects);
		HouseInfo[he][hGun][4] = cache_get_field_content_int(he, "hGun5", connects);

		HouseInfo[he][hGunAmmo][0] = cache_get_field_content_int(he, "hGunAmmo1", connects);
		HouseInfo[he][hGunAmmo][1] = cache_get_field_content_int(he, "hGunAmmo2", connects);
		HouseInfo[he][hGunAmmo][2] = cache_get_field_content_int(he, "hGunAmmo3", connects);
		HouseInfo[he][hGunAmmo][3] = cache_get_field_content_int(he, "hGunAmmo4", connects);
		HouseInfo[he][hGunAmmo][4] = cache_get_field_content_int(he, "hGunAmmo5", connects);

		HouseInfo[he][hGarage]  = cache_get_field_content_int(he, "hGarage", connects);
		HouseInfo[he][hSubsidions]  = cache_get_field_content_int(he, "hSubsidions", connects);

		HouseInfo[he][hEat][0]  = cache_get_field_content_int(he, "hEat1", connects);
		HouseInfo[he][hEat][1]  = cache_get_field_content_int(he, "hEat2", connects);
		HouseInfo[he][hEat][2]  = cache_get_field_content_int(he, "hEat3", connects);
		HouseInfo[he][hEat][3]  = cache_get_field_content_int(he, "hEat4", connects);
		HouseInfo[he][hEat][4]  = cache_get_field_content_int(he, "hEat5", connects);

		cache_get_field_content(he, "hRent", HouseInfo[he][hRent], connects, strlen(HouseInfo[he][hRent]));
		cache_get_field_content(he, "hRent1", HouseInfo[he][hRent1], connects, strlen(HouseInfo[he][hRent1]));
		HouseInfo[he][hRentHouse] = cache_get_field_content_int(he, "hRentHouse", connects);

		switch(HouseInfo[he][hKlass])
		{
			case 0: HouseInfo[he][hValue] = House_Fare_Class[0];
			case 1: HouseInfo[he][hValue] = House_Fare_Class[1];
			case 2: HouseInfo[he][hValue] = House_Fare_Class[2];
			case 3: HouseInfo[he][hValue] = House_Fare_Class[3];
			case 4: HouseInfo[he][hValue] = House_Fare_Class[4];
			case 5: HouseInfo[he][hValue] = House_Fare_Class[5];
		}

		h_online = cache_get_field_content_int(he, "h_online", connects);
		h_online_arendator[0] = cache_get_field_content_int(he, "h_online_arendator", connects);
		h_online_arendator[1] = cache_get_field_content_int(he, "h_online_arendator_1", connects);

        CreateDynamicPickup(1318, 23, HouseInfo[he][hExit][0], HouseInfo[he][hExit][1], HouseInfo[he][hExit][2]);

		if(h_online_arendator[0] && strcmp(HouseInfo[he][hRent], "-", true) && getdate() >= h_online_arendator[0]+3)
		{
			mysql_format(connects,string,164,"UPDATE `accounts` SET `pArendaHouse` = '-1',`pText` = '2' WHERE `Name` = '%s'",HouseInfo[he][hRent]);
			mysql_empty(connects, string);
			mysql_format(connects,string,126,"UPDATE `house` SET `h_online_arendator` = '0' WHERE `hID` = '%i'",HouseInfo[he][hID]);
			mysql_empty(connects, string);
		}
		else if(h_online_arendator[1] && strcmp(HouseInfo[he][hRent1], "-", true) && getdate() >= h_online_arendator[1]+3)
		{
			mysql_format(connects,string,164,"UPDATE `accounts` SET `pArendaHouse` = '-1',`pText` = '2' WHERE `Name` = '%s'",HouseInfo[he][hRent1]);
			mysql_empty(connects, string);
			mysql_format(connects,string,126,"UPDATE `house` SET `h_online_arendator_1` = '0' WHERE `hID` = '%i'",HouseInfo[he][hID]);
			mysql_empty(connects, string);
		}
		else if( h_online > 0 && HouseInfo[he][hOwned] && getdate() >= h_online + (HouseInfo[he][hSubsidions] ? (7) : (3)) )
		{
			mysql_format(connects,string,164,"UPDATE `accounts` SET `pPhousekey` = '-1',`pText` = '1' WHERE `Name` = '%s'",HouseInfo[he][hOwner]);
			mysql_empty(connects, string);
			strmid(HouseInfo[he][hOwner], "The State", 0, strlen("The State"), 255);
			HouseInfo[he][hHel] = 0;
			HouseInfo[he][hLock] = 1;
			HouseInfo[he][hOwned] = 0;
			HouseInfo[he][hVehSost] = 0;
			HouseInfo[he][hStyle] = 0;
			HouseInfo[he][hGarage] = 0;
			HouseInfo[he][hSubsidions] = 0;
			for(new d = 0; d != 5; d++) HouseInfo[he][hGun][d] = 0, HouseInfo[he][hGunAmmo][d] = 0;
			HouseInfo[he][hSafe] = 0;
			mysql_format(connects,string,126,"UPDATE `house` SET `h_online` = '0' WHERE `hID` = '%i'",HouseInfo[he][hID]);
			mysql_empty(connects, string);
			printf("[HOUSE №%i] %i:%i. Дом был продан государству.",HouseInfo[he][hID],h_online,getdate());
		}
		HouseInfo[he][LabelText][0] = CreateDynamic3DTextLabel("Выход из дома\nКлавиша: "SERVER"''ALT''", -1,HouseInfo[he][hExit][0],HouseInfo[he][hExit][1],HouseInfo[he][hExit][2]+1,9.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,HouseInfo[he][hInt],he+50);

		if(!HouseInfo[he][hOwned])
		{
			HouseInfo[he][hPickup] = CreateDynamicPickup(1273, 23, HouseInfo[he][hEnter][0], HouseInfo[he][hEnter][1], HouseInfo[he][hEnter][2]);
			HouseInfo[he][hMIcon] = CreateDynamicMapIcon(HouseInfo[he][hEnter][0], HouseInfo[he][hEnter][1], HouseInfo[he][hEnter][2], 31, COLOR_WHITE, 0, -1, -1, 200.0);
		}
		else
		{
			HouseInfo[he][hPickup] = CreateDynamicPickup(19522, 23, HouseInfo[he][hEnter][0], HouseInfo[he][hEnter][1], HouseInfo[he][hEnter][2]);
			HouseInfo[he][hMIcon] = CreateDynamicMapIcon(HouseInfo[he][hEnter][0], HouseInfo[he][hEnter][1], HouseInfo[he][hEnter][2], 32, COLOR_WHITE, 0, -1, -1, 200.0);
		}
	}
	printf("-> LoadProperty | Загружено %d",TOTAL_HOUSE);

	mysql_tquery(connects,"SELECT * FROM `inviters`", "LoadFractions","");
	return 1;
}
Покупка дома:
Код:
			if(!response) return 1;
			if(PlayerInfo[playerid][pArendaHouse] != -1) return 1;
			for(new h = 0; h <= TOTAL_HOUSE; h++)
			{
				if(!PlayerToPoint(2.0, playerid, HouseInfo[h][hEnter][0], HouseInfo[h][hEnter][1], HouseInfo[h][hEnter][2]) || HouseInfo[h][hOwned]) continue;
				if(PlayerInfo[playerid][pHouse] != -1 && !strcmp(PlayerInfo[playerid][pNames], HouseInfo[PlayerInfo[playerid][pHouse]][hOwner], true))
				{
     				SendClientMessage(playerid, COLOR_YELLOW, "У вас уже есть квартира...");
					return 1;
				}
				if(PlayerInfo[playerid][pCash] < HouseInfo[h][hValue]) return SendClientMessage(playerid, COLOR_WHITE, "У вас нет столько денег на руках!");
				PlayerInfo[playerid][pHouse] = h;
				UpdatePlayerData (playerid, "pPhousekey", PlayerInfo[playerid][pHouse]);
				HouseInfo[h][hOwned] = 1;
				HouseInfo[h][hHel] = 0;
				HouseInfo[h][hSafe] = 0;
				strmid(HouseInfo[h][hOwner], PlayerInfo[playerid][pNames], 0, strlen(PlayerInfo[playerid][pNames]), 255);
				mysql_format(connects,string,MAX_STR,"UPDATE `house` SET `h_online` = '%i' WHERE `hID` = '%i'",getdate(),HouseInfo[h][hID]);
				mysql_empty(connects, string);
				Hook_GivePlayerMoney(playerid, -HouseInfo[h][hValue]);
				SetPlayerInterior(playerid,HouseInfo[h][hInt]);
				FreezePlayer(playerid, (GetPlayerPing(playerid) > 100 ? (2000) : (1500)));
				SetPlayerPos(playerid,HouseInfo[h][hExit][0],HouseInfo[h][hExit][1],HouseInfo[h][hExit][2]);
				SetPlayerVirtualWorld(playerid,h+50);
				SetPVarInt(playerid, "HouseID", h);
				SendClientMessage(playerid, COLOR_WHITE, "Поздравляем с покупкой!");
				PlayerInfo[playerid][pSpawn] = 1;
				UpdatePlayerData(playerid,"pSpawn",PlayerInfo[playerid][pSpawn]);
				if(PlayerInfo[playerid][pCar][0] < 401) PlayerInfo[playerid][pCar][0] = 462, UpdatePlayerData(playerid, "pCar", 462);
				if(PlayerInfo[playerid][pCar][1] < 401) PlayerInfo[playerid][pCar][1] = 462, UpdatePlayerData(playerid, "pCar2", 462);
				if(PlayerInfo[playerid][pCar][2] < 401) PlayerInfo[playerid][pCar][2] = 462, UpdatePlayerData(playerid, "pCar3", 462);
				LoadCarPlayer(playerid, 1);
				SaveHouse(h);
				UpdateIconHouse(h);
				printf("house id: %d", h);
			}
			return 1;
		}
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу