SA-MP Forums Archive
Mysql to y_ini - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql to y_ini (/showthread.php?tid=508324)



Mysql to y_ini - AroseKhanNiazi - 21.04.2014

Код:
stock LoadProperty(Houseid)
{
	new string[256] ,query[300];


	switch (CURRENT_GAMEMODE)
	{

		case LOS_SANTOS:
		{

    	format(query, sizeof(query), "SELECT * FROM lshousedata WHERE Houseid = '%d'", Houseid);
		//We only select the variables that we want to use.
		mysql_query(query); //Queries the result
		mysql_store_result(); //Store a result because it's a SELECT statement.

		if(mysql_num_rows() > 0) //If the houseid is found
		{

			while(mysql_retrieve_row()) //it will be running until there are no more rows to be retrieved
			{

			mysql_fetch_field_row(string, "OwnerName");
			strmid(HouseData[Houseid][h_OwnerName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_OwnerName] = strval(string);

			mysql_fetch_field_row(string, "OwnerID");
			HouseData[Houseid][h_OwnerID] = strval(string);

			mysql_fetch_field_row(string, "RenterName");
			strmid(HouseData[Houseid][h_RenterName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_RenterName] = strval(string);

			mysql_fetch_field_row(string, "RenterID");
			HouseData[Houseid][h_RenterID] = strval(string);

			mysql_fetch_field_row(string, "HouseName");
			strmid(HouseInfo[Houseid][h_HouseIntName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_HouseName] = strval(string);

			mysql_fetch_field_row(string, "Value");
			HouseData[Houseid][h_Value] = strval(string);

			mysql_fetch_field_row(string, "Rent");
			HouseData[Houseid][h_Rent] = strval(string);

			mysql_fetch_field_row(string, "ForSale");
			HouseData[Houseid][h_ForSale] = strval(string);

			mysql_fetch_field_row(string, "Alarm");
			HouseData[Houseid][h_Alarm] = strval(string);

			mysql_fetch_field_row(string, "Lock");
			HouseData[Houseid][h_Lock] = strval(string);

			mysql_fetch_field_row(string, "Money");
			HouseData[Houseid][h_Money] = strval(string);

			mysql_fetch_field_row(string, "Drugs");
			HouseData[Houseid][h_Drugs] = strval(string);

			mysql_fetch_field_row(string, "Condoms");
			HouseData[Houseid][h_Condoms] = strval(string);

			mysql_fetch_field_row(string, "Flowers");
			HouseData[Houseid][h_Flowers] = strval(string);

			mysql_fetch_field_row(string, "Robberies");
			HouseData[Houseid][h_Robberies] = strval(string);

			mysql_fetch_field_row(string, "Breakins");
			HouseData[Houseid][h_Breakins] = strval(string);

			mysql_fetch_field_row(string, "OwnerVisits");
			HouseData[Houseid][h_OwnerVisits] = strval(string);

			mysql_fetch_field_row(string, "OtherVisits");
			HouseData[Houseid][h_OtherVisits] = strval(string);

			mysql_fetch_field_row(string, "Purchasers");
			HouseData[Houseid][h_Purchasers] = strval(string);

			mysql_fetch_field_row(string, "Rented");
			HouseData[Houseid][h_Rented] = strval(string);
			}

  		}
		}

		case LAS_VENTURAS:
		{

    	format(query, sizeof(query), "SELECT * FROM lvhousedata WHERE Houseid = '%d'", Houseid);
		//We only select the variables that we want to use.
		mysql_query(query); //Queries the result
		mysql_store_result(); //Store a result because it's a SELECT statement.

		if(mysql_num_rows() > 0) //If the houseid is found
		{

			while(mysql_retrieve_row()) //it will be running until there are no more rows to be retrieved
			{

			mysql_fetch_field_row(string, "OwnerName");
			strmid(HouseData[Houseid][h_OwnerName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_OwnerName] = strval(string);

			mysql_fetch_field_row(string, "OwnerID");
			HouseData[Houseid][h_OwnerID] = strval(string);

			mysql_fetch_field_row(string, "RenterName");
			strmid(HouseData[Houseid][h_RenterName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_RenterName] = strval(string);

			mysql_fetch_field_row(string, "RenterID");
			HouseData[Houseid][h_RenterID] = strval(string);

			mysql_fetch_field_row(string, "HouseName");
			strmid(HouseInfo[Houseid][h_HouseIntName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_HouseName] = strval(string);

			mysql_fetch_field_row(string, "Value");
			HouseData[Houseid][h_Value] = strval(string);

			mysql_fetch_field_row(string, "Rent");
			HouseData[Houseid][h_Rent] = strval(string);

			mysql_fetch_field_row(string, "ForSale");
			HouseData[Houseid][h_ForSale] = strval(string);

			mysql_fetch_field_row(string, "Alarm");
			HouseData[Houseid][h_Alarm] = strval(string);

			mysql_fetch_field_row(string, "Lock");
			HouseData[Houseid][h_Lock] = strval(string);

			mysql_fetch_field_row(string, "Money");
			HouseData[Houseid][h_Money] = strval(string);

			mysql_fetch_field_row(string, "Drugs");
			HouseData[Houseid][h_Drugs] = strval(string);

			mysql_fetch_field_row(string, "Condoms");
			HouseData[Houseid][h_Condoms] = strval(string);

			mysql_fetch_field_row(string, "Flowers");
			HouseData[Houseid][h_Flowers] = strval(string);

			mysql_fetch_field_row(string, "Robberies");
			HouseData[Houseid][h_Robberies] = strval(string);

			mysql_fetch_field_row(string, "Breakins");
			HouseData[Houseid][h_Breakins] = strval(string);

			mysql_fetch_field_row(string, "OwnerVisits");
			HouseData[Houseid][h_OwnerVisits] = strval(string);

			mysql_fetch_field_row(string, "OtherVisits");
			HouseData[Houseid][h_OtherVisits] = strval(string);

			mysql_fetch_field_row(string, "Purchasers");
			HouseData[Houseid][h_Purchasers] = strval(string);

			mysql_fetch_field_row(string, "Rented");
			HouseData[Houseid][h_Rented] = strval(string);


			}

        }

		}

		case SAN_FIERRO:
		{

    	format(query, sizeof(query), "SELECT * FROM sfhousedata WHERE Houseid = '%d'", Houseid);
		//We only select the variables that we want to use.
		mysql_query(query); //Queries the result
		mysql_store_result(); //Store a result because it's a SELECT statement.

		if(mysql_num_rows() > 0) //If the houseid is found
		{

			while(mysql_retrieve_row()) //it will be running until there are no more rows to be retrieved
			{

			//We use while so that it does a single query, not multiple
			//Especially when we have more variables. If there is more
			//Variables, you should just split the line with sscanf. To
			//Make it easier.

			mysql_fetch_field_row(string, "OwnerName");
			strmid(HouseData[Houseid][h_OwnerName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_OwnerName] = strval(string);

			mysql_fetch_field_row(string, "OwnerID");
			HouseData[Houseid][h_OwnerID] = strval(string);

			mysql_fetch_field_row(string, "RenterName");
			strmid(HouseData[Houseid][h_RenterName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_RenterName] = strval(string);

			mysql_fetch_field_row(string, "RenterID");
			HouseData[Houseid][h_RenterID] = strval(string);

			mysql_fetch_field_row(string, "HouseName");
			strmid(HouseInfo[Houseid][h_HouseIntName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_HouseName] = strval(string);

			mysql_fetch_field_row(string, "Value");
			HouseData[Houseid][h_Value] = strval(string);

			mysql_fetch_field_row(string, "Rent");
			HouseData[Houseid][h_Rent] = strval(string);

			mysql_fetch_field_row(string, "ForSale");
			HouseData[Houseid][h_ForSale] = strval(string);

			mysql_fetch_field_row(string, "Alarm");
			HouseData[Houseid][h_Alarm] = strval(string);

			mysql_fetch_field_row(string, "Lock");
			HouseData[Houseid][h_Lock] = strval(string);

			mysql_fetch_field_row(string, "Money");
			HouseData[Houseid][h_Money] = strval(string);

			mysql_fetch_field_row(string, "Drugs");
			HouseData[Houseid][h_Drugs] = strval(string);

			mysql_fetch_field_row(string, "Condoms");
			HouseData[Houseid][h_Condoms] = strval(string);

			mysql_fetch_field_row(string, "Flowers");
			HouseData[Houseid][h_Flowers] = strval(string);

			mysql_fetch_field_row(string, "Robberies");
			HouseData[Houseid][h_Robberies] = strval(string);

			mysql_fetch_field_row(string, "Breakins");
			HouseData[Houseid][h_Breakins] = strval(string);

			mysql_fetch_field_row(string, "OwnerVisits");
			HouseData[Houseid][h_OwnerVisits] = strval(string);

			mysql_fetch_field_row(string, "OtherVisits");
			HouseData[Houseid][h_OtherVisits] = strval(string);

			mysql_fetch_field_row(string, "Purchasers");
			HouseData[Houseid][h_Purchasers] = strval(string);

			mysql_fetch_field_row(string, "Rented");
			HouseData[Houseid][h_Rented] = strval(string);


			//mysql_fetch_field_row requires a string.
			}

		}

		}




	}//End Of Switch

	mysql_free_result(); //We must always free a stored result
	return 1;
}
//==============================================================================
stock SaveProperty(Houseid)
{
	new query[300];

switch (CURRENT_GAMEMODE)
	{

		case LOS_SANTOS:
		{
		format(query, sizeof(query), "SELECT * FROM lshousedata WHERE Houseid = '%d'", Houseid);
		mysql_query(query); //Queries the result
		mysql_store_result(); //Store a result because it's a SELECT statement.

		if(mysql_num_rows() == 0) //If the houseid is not found
		{

		if (CREATE_PLAYER_DATABASE == 1)
		{

		format(query, sizeof(query), "INSERT INTO lshousedata (Houseid) VALUES ('%d')",Houseid); //Insert string
		mysql_query(query);

		}else{

		mysql_query("ALTER TABLE lshousedata ADD OwnerName VARCHAR(128) NOT NULL default 'The Bank'");
		mysql_query("ALTER TABLE lshousedata ADD OwnerID INT(11) NOT NULL default -1");
		mysql_query("ALTER TABLE lshousedata ADD RenterName VARCHAR(128) NOT NULL default 'None'");
		mysql_query("ALTER TABLE lshousedata ADD RenterID INT(11) NOT NULL default -1");
		mysql_query("ALTER TABLE lshousedata ADD HouseName VARCHAR(128) NOT NULL default 'House'");
		mysql_query("ALTER TABLE lshousedata ADD Value INT(11) NOT NULL default 200000");
		mysql_query("ALTER TABLE lshousedata ADD Rent INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD ForSale INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Alarm INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Lock INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Money INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Drugs INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Condoms INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Flowers INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Robberies INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Breakins INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD OwnerVisits INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD OtherVisits INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Purchasers INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Rented INT(11) NOT NULL default 0");

		}


		}else{


		format(query, sizeof(query), "UPDATE lshousedata SET OwnerName = '%s' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET OwnerID = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerID],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET RenterName = '%s' WHERE Houseid = '%d'",HouseData[Houseid][h_RenterName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET RenterID = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_RenterID],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET HouseName = '%s' WHERE Houseid = '%s'",HouseInfo[Houseid][h_HouseIntName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Value = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Value],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Rent = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Rent],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET ForSale = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_ForSale],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Alarm = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Alarm],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Lock = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Lock],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Money = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Money],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Drugs = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Drugs],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Condoms = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Condoms],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Flowers = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Flowers],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Robberies = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Robberies],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Breakins = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Breakins],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET OwnerVisits = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerVisits],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET OtherVisits = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OtherVisits],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Purchasers = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Purchasers],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Rented = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Rented],Houseid);
		mysql_query(query);

		}

		}


		case LAS_VENTURAS:
		{
		format(query, sizeof(query), "SELECT * FROM lvhousedata WHERE Houseid = '%d'", Houseid);
		mysql_query(query); //Queries the result
		mysql_store_result(); //Store a result because it's a SELECT statement.

		if(mysql_num_rows() == 0) //If the houseid is not found
		{

		if (CREATE_PLAYER_DATABASE == 1)
		{

		format(query, sizeof(query), "INSERT INTO lvhousedata (Houseid) VALUES ('%d')",Houseid); //Insert string
		mysql_query(query);

		}else{

		mysql_query("ALTER TABLE lvhousedata ADD OwnerName VARCHAR(128) NOT NULL default 'The Bank'");
		mysql_query("ALTER TABLE lvhousedata ADD OwnerID INT(11) NOT NULL default -1");
		mysql_query("ALTER TABLE lvhousedata ADD RenterName VARCHAR(128) NOT NULL default 'None'");
		mysql_query("ALTER TABLE lvhousedata ADD RenterID INT(11) NOT NULL default -1");
		mysql_query("ALTER TABLE lvhousedata ADD HouseName VARCHAR(128) NOT NULL default 'House'");
		mysql_query("ALTER TABLE lvhousedata ADD Value INT(11) NOT NULL default 200000");
		mysql_query("ALTER TABLE lvhousedata ADD Rent INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD ForSale INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Alarm INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Lock INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Money INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Drugs INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Condoms INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Flowers INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Robberies INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Breakins INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD OwnerVisits INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD OtherVisits INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Purchasers INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lvhousedata ADD Rented INT(11) NOT NULL default 0");

		}


		}else{

		format(query, sizeof(query), "UPDATE lvhousedata SET OwnerName = '%s' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET OwnerID = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerID],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET RenterName = '%s' WHERE Houseid = '%d'",HouseData[Houseid][h_RenterName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET RenterID = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_RenterID],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET HouseName = '%s' WHERE Houseid = '%s'",HouseInfo[Houseid][h_HouseIntName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Value = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Value],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Rent = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Rent],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET ForSale = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_ForSale],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Alarm = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Alarm],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Lock = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Lock],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Money = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Money],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Drugs = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Drugs],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Condoms = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Condoms],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Flowers = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Flowers],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Robberies = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Robberies],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Breakins = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Breakins],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET OwnerVisits = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerVisits],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET OtherVisits = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OtherVisits],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Purchasers = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Purchasers],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lvhousedata SET Rented = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Rented],Houseid);
		mysql_query(query);

		}

		}



		case SAN_FIERRO:
		{
		format(query, sizeof(query), "SELECT * FROM sfhousedata WHERE Houseid = '%d'", Houseid);
		mysql_query(query); //Queries the result
		mysql_store_result(); //Store a result because it's a SELECT statement.

		if(mysql_num_rows() == 0) //If the houseid is not found
		{


		if (CREATE_PLAYER_DATABASE == 1)
		{

		format(query, sizeof(query), "INSERT INTO sfhousedata (Houseid) VALUES ('%d')",Houseid); //Insert string
		mysql_query(query);

		}else{

		mysql_query("ALTER TABLE sfhousedata ADD OwnerName VARCHAR(128) NOT NULL default 'The Bank'");
		mysql_query("ALTER TABLE sfhousedata ADD OwnerID INT(11) NOT NULL default -1");
		mysql_query("ALTER TABLE sfhousedata ADD RenterName VARCHAR(128) NOT NULL default 'None'");
		mysql_query("ALTER TABLE sfhousedata ADD RenterID INT(11) NOT NULL default -1");
		mysql_query("ALTER TABLE sfhousedata ADD HouseName VARCHAR(128) NOT NULL default 'House'");
		mysql_query("ALTER TABLE sfhousedata ADD Value INT(11) NOT NULL default 200000");
		mysql_query("ALTER TABLE sfhousedata ADD Rent INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD ForSale INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Alarm INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Lock INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Money INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Drugs INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Condoms INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Flowers INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Robberies INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Breakins INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD OwnerVisits INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD OtherVisits INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Purchasers INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE sfhousedata ADD Rented INT(11) NOT NULL default 0");

		}

		}else{


		format(query, sizeof(query), "UPDATE sfhousedata SET OwnerName = '%s' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET OwnerID = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerID],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET RenterName = '%s' WHERE Houseid = '%d'",HouseData[Houseid][h_RenterName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET RenterID = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_RenterID],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET HouseName = '%s' WHERE Houseid = '%s'",HouseInfo[Houseid][h_HouseIntName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Value = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Value],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Rent = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Rent],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET ForSale = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_ForSale],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Alarm = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Alarm],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Lock = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Lock],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Money = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Money],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Drugs = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Drugs],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Condoms = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Condoms],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Flowers = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Flowers],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Robberies = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Robberies],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Breakins = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Breakins],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET OwnerVisits = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerVisits],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET OtherVisits = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OtherVisits],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Purchasers = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Purchasers],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE sfhousedata SET Rented = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Rented],Houseid);
		mysql_query(query);



		}

		}


	}//End Of Switch

	mysql_free_result(); //Frees the result

	return 1;
}
Can some one change to y_ini plz i know it's too much but i don't know anything about mysql
http://pastebin.com/EtyvKBaH


Re: Mysql to y_ini - AroseKhanNiazi - 21.04.2014

okay that's too long just this plz
Код:
stock LoadProperty(Houseid)
{
	new string[256] ,query[300];


    	format(query, sizeof(query), "SELECT * FROM lshousedata WHERE Houseid = '%d'", Houseid);
		//We only select the variables that we want to use.
		mysql_query(query); //Queries the result
		mysql_store_result(); //Store a result because it's a SELECT statement.

		if(mysql_num_rows() > 0) //If the houseid is found
		{

			while(mysql_retrieve_row()) //it will be running until there are no more rows to be retrieved
			{

			mysql_fetch_field_row(string, "OwnerName");
			strmid(HouseData[Houseid][h_OwnerName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_OwnerName] = strval(string);

			mysql_fetch_field_row(string, "OwnerID");
			HouseData[Houseid][h_OwnerID] = strval(string);

			mysql_fetch_field_row(string, "RenterName");
			strmid(HouseData[Houseid][h_RenterName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_RenterName] = strval(string);

			mysql_fetch_field_row(string, "RenterID");
			HouseData[Houseid][h_RenterID] = strval(string);

			mysql_fetch_field_row(string, "HouseName");
			strmid(HouseInfo[Houseid][h_HouseIntName], string, 0, strlen(string), 256);
			//HouseInfo[Houseid][h_HouseName] = strval(string);

			mysql_fetch_field_row(string, "Value");
			HouseData[Houseid][h_Value] = strval(string);

			mysql_fetch_field_row(string, "Rent");
			HouseData[Houseid][h_Rent] = strval(string);

			mysql_fetch_field_row(string, "ForSale");
			HouseData[Houseid][h_ForSale] = strval(string);

			mysql_fetch_field_row(string, "Alarm");
			HouseData[Houseid][h_Alarm] = strval(string);

			mysql_fetch_field_row(string, "Lock");
			HouseData[Houseid][h_Lock] = strval(string);

			mysql_fetch_field_row(string, "Money");
			HouseData[Houseid][h_Money] = strval(string);

			mysql_fetch_field_row(string, "Drugs");
			HouseData[Houseid][h_Drugs] = strval(string);

			mysql_fetch_field_row(string, "Condoms");
			HouseData[Houseid][h_Condoms] = strval(string);

			mysql_fetch_field_row(string, "Flowers");
			HouseData[Houseid][h_Flowers] = strval(string);

			mysql_fetch_field_row(string, "Robberies");
			HouseData[Houseid][h_Robberies] = strval(string);

			mysql_fetch_field_row(string, "Breakins");
			HouseData[Houseid][h_Breakins] = strval(string);

			mysql_fetch_field_row(string, "OwnerVisits");
			HouseData[Houseid][h_OwnerVisits] = strval(string);

			mysql_fetch_field_row(string, "OtherVisits");
			HouseData[Houseid][h_OtherVisits] = strval(string);

			mysql_fetch_field_row(string, "Purchasers");
			HouseData[Houseid][h_Purchasers] = strval(string);

			mysql_fetch_field_row(string, "Rented");
			HouseData[Houseid][h_Rented] = strval(string);
			}

  		}
	mysql_free_result(); //We must always free a stored result
	return 1;
}
//==============================================================================
stock SaveProperty(Houseid)
{
	new query[300];
		format(query, sizeof(query), "SELECT * FROM lshousedata WHERE Houseid = '%d'", Houseid);
		mysql_query(query); //Queries the result
		mysql_store_result(); //Store a result because it's a SELECT statement.

		if(mysql_num_rows() == 0) //If the houseid is not found
		{

		if (CREATE_PLAYER_DATABASE == 1)
		{

		format(query, sizeof(query), "INSERT INTO lshousedata (Houseid) VALUES ('%d')",Houseid); //Insert string
		mysql_query(query);

		}else{

		mysql_query("ALTER TABLE lshousedata ADD OwnerName VARCHAR(128) NOT NULL default 'The Bank'");
		mysql_query("ALTER TABLE lshousedata ADD OwnerID INT(11) NOT NULL default -1");
		mysql_query("ALTER TABLE lshousedata ADD RenterName VARCHAR(128) NOT NULL default 'None'");
		mysql_query("ALTER TABLE lshousedata ADD RenterID INT(11) NOT NULL default -1");
		mysql_query("ALTER TABLE lshousedata ADD HouseName VARCHAR(128) NOT NULL default 'House'");
		mysql_query("ALTER TABLE lshousedata ADD Value INT(11) NOT NULL default 200000");
		mysql_query("ALTER TABLE lshousedata ADD Rent INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD ForSale INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Alarm INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Lock INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Money INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Drugs INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Condoms INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Flowers INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Robberies INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Breakins INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD OwnerVisits INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD OtherVisits INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Purchasers INT(11) NOT NULL default 0");
		mysql_query("ALTER TABLE lshousedata ADD Rented INT(11) NOT NULL default 0");

		}


		}else{


		format(query, sizeof(query), "UPDATE lshousedata SET OwnerName = '%s' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET OwnerID = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerID],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET RenterName = '%s' WHERE Houseid = '%d'",HouseData[Houseid][h_RenterName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET RenterID = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_RenterID],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET HouseName = '%s' WHERE Houseid = '%s'",HouseInfo[Houseid][h_HouseIntName],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Value = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Value],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Rent = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Rent],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET ForSale = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_ForSale],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Alarm = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Alarm],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Lock = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Lock],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Money = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Money],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Drugs = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Drugs],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Condoms = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Condoms],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Flowers = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Flowers],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Robberies = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Robberies],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Breakins = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Breakins],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET OwnerVisits = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OwnerVisits],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET OtherVisits = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_OtherVisits],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Purchasers = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Purchasers],Houseid);
		mysql_query(query);

		format(query, sizeof(query), "UPDATE lshousedata SET Rented = '%d' WHERE Houseid = '%d'",HouseData[Houseid][h_Rented],Houseid);
		mysql_query(query);

		}

	mysql_free_result(); //Frees the result

	return 1;
}



Re: Mysql to y_ini - gtakillerIV - 21.04.2014

I'd suggest you to learn how to use y_ini and then use your brain to convert it.


Re: Mysql to y_ini - AroseKhanNiazi - 21.04.2014

i can use y_ini in simple saving system but i don't know how will it work with the dynamic housing system saving


Re: Mysql to y_ini - Baltazar - 21.04.2014

Quote:
Originally Posted by AroseKhanNaizi
Посмотреть сообщение
i can use y_ini in simple saving system but i don't know how will it work with the dynamic housing system saving
Use - your - brain. Because now, as you are using your ass, you are going nowhere


Re: Mysql to y_ini - AroseKhanNiazi - 22.04.2014

i can't do it i tried i don't know what function does this do in Mysql So anyone Please