Loading houses problem (MySQL R33)
#1

Hey,

I have a small problem with my load house system, it's not loading the house and not printing a message to the console showing how many houses have been loaded. And yes, I have the LoadHouses(); under OnGameModeInit, after a connection between the server and the database has been established.

Here is the code:

Код:
forward LoadHouses();
public LoadHouses()
{
    for(new i=1; i<=MAX_HOUSES; i++)
    {
        new query[128];

        mysql_format(mysql, query, sizeof(query), "SELECT * FROM `"HouseTable"` WHERE `ID`='%i'", i);
   		mysql_tquery(mysql, query, "OnLoadHouses", "");
	}
}
Код:
forward OnLoadHouses();
public OnLoadHouses()
{
    for(new i=1; i<=MAX_HOUSES; i++)
    {
   		new
			savingstring[400],
			lString[500];


		cache_get_field_content(0, "ID", savingstring), hInfo[i][HID] = strval(savingstring);
		cache_get_field_content(0, "Owner", hInfo[i][HID], mysql);

		cache_get_field_content(0, "Owned", savingstring), hInfo[i][Owned] = strval(savingstring);
		cache_get_field_content(0, "Locked", savingstring), hInfo[i][Locked] = strval(savingstring);
		cache_get_field_content(0, "Price", savingstring), hInfo[i][Price] = strval(savingstring);

		cache_get_field_content(0, "OX", savingstring), hInfo[i][OX] = strval(savingstring);
		cache_get_field_content(0, "OY", savingstring), hInfo[i][OY] = strval(savingstring);
		cache_get_field_content(0, "OZ", savingstring), hInfo[i][OZ] = strval(savingstring);


		cache_get_field_content(0, "World", savingstring), hInfo[i][World] = strval(savingstring);
		cache_get_field_content(0, "OnSale", savingstring), hInfo[i][OnSale] = strval(savingstring);


		cache_get_field_content(0, "InteriorID", savingstring), hInfo[i][InteriorID] = strval(savingstring);

        if(hInfo[i][OnSale] == 0 )
		{
			switch(hInfo[i][Owned])
			{
				case 0:
    			{
    				format(lString, sizeof(lString), "House Owned: No\nHouse Owner: None\nHouse Price: $%i", hInfo[i][Price]);
    				hInfo[i][Label] = CreateDynamic3DTextLabel(lString, 0x00B9FFFF, hInfo[i][OX], hInfo[i][OY], hInfo[i][OZ]+0.5, 36.0);
   					hInfo[i][Icon] = CreateDynamicMapIcon(hInfo[i][OX], hInfo[i][OY], hInfo[i][OZ], 31, -1);
					hInfo[i][EnterPickup] = CreateDynamicPickup(1273, 23, hInfo[i][OX], hInfo[i][OY], hInfo[i][OZ], -1, -1, -1, 36.0);
				}
				case 1:
				{
					format(lString, sizeof(lString),"House Owned: Yes\nHouse Owner: %s\nHouse Locked: %s", hInfo[i][Owner], (hInfo[i][Locked] == 1) ? ("Yes") : ("No"));
 					hInfo[i][Label] = CreateDynamic3DTextLabel(lString, 0xFF0000FF, hInfo[i][OX], hInfo[i][OY], hInfo[i][OZ]+0.5, 36.0);
 					hInfo[i][EnterPickup] = CreateDynamicPickup(1273, 23, hInfo[i][OX],hInfo[i][OY], hInfo[i][OZ], -1, -1, -1, 36.0);
				}
			}
			CreatedHouses++;
		}
		if(hInfo[i][OnSale] == 1)
		{
			format(lString, sizeof(lString),"House Owned: Yes\nHouse Owner: %s\nHouse Price: $%i\nHouse On Sale: Yes", hInfo[i][Owner], hInfo[i][Price]);
			hInfo[i][Label] = CreateDynamic3DTextLabel(lString, 0xD65418FF, hInfo[i][OX], hInfo[i][OY], hInfo[i][OZ]+0.5, 36.0);
			hInfo[i][Icon] = CreateDynamicMapIcon(hInfo[i][OX], hInfo[i][OY], hInfo[i][OZ], 32, -1);
			hInfo[i][EnterPickup] = CreateDynamicPickup(1273, 23, hInfo[i][OX],hInfo[i][OY], hInfo[i][OZ], -1, -1, -1, 36.0);
  			CreatedHouses++;
		}
 	}
 	printf("[House System] %i houses were created...", CreatedHouses);
}
How am I able to solve this problem?

Thanks
Reply


Messages In This Thread
Loading houses problem (MySQL R33) - by FunnyBear - 23.02.2015, 19:08
Re: Loading houses problem (MySQL R33) - by PaulDinam - 23.02.2015, 19:14
Re: Loading houses problem (MySQL R33) - by FunnyBear - 23.02.2015, 19:19
Re: Loading houses problem (MySQL R33) - by M4D - 23.02.2015, 19:20
Re: Loading houses problem (MySQL R33) - by FunnyBear - 23.02.2015, 19:53

Forum Jump:


Users browsing this thread: 1 Guest(s)