Scripting Help
#1

I am using GarHouse system for house system, But in example i have a house for 100millions, when i sell it i will get only 80 millions, but when i sell it, the house value will be changed to 80 millions, i want it not to be changed.
Reply
#2

Help?
Reply
#3

Your /sellhouse and /buyhouse code please.
Reply
#4

Код:
//------------------------------------------------------------------------------
//                               House Sale
//------------------------------------------------------------------------------
	if(dialogid == HOUSEMENU+3 && response)
	{
		if(GetOwnedHouses(playerid) == 0) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_NO_HOUSES_OWNED);
		else
		{
		    new procent = ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT);
			GivePlayerMoney(playerid, procent);
			if(hInfo[h][HouseStorage] >= 1)
			{
			    CMDSString = "";
				format(_tmpstring, sizeof(_tmpstring), I_SELL_HOUSE1_1, procent);
				strcat(CMDSString, _tmpstring);
				format(_tmpstring, sizeof(_tmpstring), I_SELL_HOUSE1_2, (hInfo[h][HouseValue] - procent), hInfo[h][HouseStorage]);
				strcat(CMDSString, _tmpstring);
   				ShowInfoBoxEx(playerid, COLOUR_INFO, CMDSString);
				GivePlayerMoney(playerid, hInfo[h][HouseStorage]);
			}
			if(hInfo[h][HouseStorage] == 0)
			{
			    ShowInfoBox(playerid, I_SELL_HOUSE2, hInfo[h][HouseName], procent, (hInfo[h][HouseValue] - procent));
			}
			format(hInfo[h][HouseName], MAX_HOUSE_NAME, "%s", DEFAULT_HOUSE_NAME);
   			format(hInfo[h][HouseOwner], MAX_PLAYER_NAME, "%s", INVALID_HOWNER_NAME);
		    hInfo[h][HousePassword] = udb_hash("INVALID_HOUSE_PASSWORD");
		    hInfo[h][HouseStorage] = hInfo[h][HouseAlarm] = hInfo[h][HouseDog] = hInfo[h][HouseCamera] = hInfo[h][UpgradedLock] = 0;
		    hInfo[h][HouseValue] = ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT);
			file = INI_Open(filename);
			INI_WriteInt(file, "HouseValue", hInfo[h][HouseValue]);
			INI_WriteString(file, "HouseOwner", INVALID_HOWNER_NAME);
			INI_WriteInt(file, "HousePassword", hInfo[h][HousePassword]);
			INI_WriteString(file, "HouseName", DEFAULT_HOUSE_NAME);
			INI_WriteInt(file, "HouseStorage", 0);
			INI_Close(file);
			foreach(Houses, h2)
			{
				if(IsHouseInRangeOfHouse(h, h2, RANGE_BETWEEN_HOUSES) && h2 != h)
				{
			   		hInfo[h2][HouseValue] = (hInfo[h2][HouseValue] - ReturnProcent(hInfo[h2][HouseValue], HOUSE_SELLING_PROCENT2));
			   		file = INI_Open(HouseFile(h2));
					INI_WriteInt(file, "HouseValue", hInfo[h2][HouseValue]);
					INI_Close(file);
                    UpdateHouseText(h2);
				}
			}
			foreach(Player, i)
			{
			    if(IsPlayerInHouse(i, h))
			    {
			        ExitHouse(i, h);
					ShowInfoBoxEx(i, COLOUR_INFO, I_TO_PLAYERS_HSOLD);
			    }
			}
			#if GH_USE_MAPICONS == true
				DestroyDynamicMapIcon(HouseMIcon[h]);
				HouseMIcon[h] = CreateDynamicMapIcon(hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], 31, -1, hInfo[h][SpawnWorld], hInfo[h][SpawnInterior], -1, MICON_VD);
			#endif
			UpdateHouseText(h);
		}
		return 1;
	}
Код:
//------------------------------------------------------------------------------
//                          Selling House
//------------------------------------------------------------------------------
	if(dialogid == HOUSEMENU+19 && response)
	{
  		switch(listitem)
		{
		    case 0: ShowPlayerDialog(playerid, HOUSEMENU+20, DIALOG_STYLE_INPUT, INFORMATION_HEADER, HMENU_SELL_HOUSE2, "Select", "Cancel");
		    case 1: ShowPlayerDialog(playerid, HOUSEMENU+21, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, HMENU_HSALE_CANCEL, "Remove", "Cancel");
		    case 2:
		    {
		    	format(string, sizeof(string), HMENU_SELL_HOUSE, hInfo[h][HouseName], ReturnProcent(hInfo[h][HouseValue], HOUSE_SELLING_PROCENT));
				ShowPlayerDialog(playerid, HOUSEMENU+3, DIALOG_STYLE_MSGBOX, INFORMATION_HEADER, string, "Sell", "Cancel");
			}
		}
		return 1;
	}
//------------------------------------------------------------------------------
//                          Selling House
//------------------------------------------------------------------------------
	if(dialogid == HOUSEMENU+20 && response)
	{
		if(amount < MIN_HOUSE_VALUE || amount > MAX_HOUSE_VALUE) return ShowInfoBoxEx(playerid, COLOUR_SYSTEM, E_INVALID_HSELL_AMOUNT);
		else
		{
 	        hInfo[h][ForSalePrice] = amount;
		    hInfo[h][ForSale] = 1;
		    file = INI_Open(filename);
			INI_WriteInt(file, "ForSale", 1);
			INI_WriteInt(file, "ForSalePrice", amount);
			INI_Close(file);
			ShowInfoBox(playerid, I_H_SET_FOR_SALE, hInfo[h][HouseName], amount);
			UpdateHouseText(h);
		}
		return 1;
	}
Reply
#5

HELP?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)