07.03.2015, 17:59
Hey,
I'm trying to fix a problem which I've had for atleast a month now. It's a problem with the load house function, and the houses do not load, however it does print how many houses have been found in the database to the console. I use MySQL R33.
Here is the loadhouse function,
I have tried so many different ways to fix this, but I just can't seem to do it. Thanks
I'm trying to fix a problem which I've had for atleast a month now. It's a problem with the load house function, and the houses do not load, however it does print how many houses have been found in the database to the console. I use MySQL R33.
Here is the loadhouse function,
Код:
forward LoadHouses(); public LoadHouses() { mysql_tquery(mysql, "SELECT * FROM `"HouseTable"`", "OnLoadHouses", ""); return 1; } forward OnLoadHouses(); public OnLoadHouses() { for(new i = 1; i <= cache_get_row_count(); i++) { new savingstring[400]; 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); new lString[500]; if(hInfo[i][OnSale] == 0 ) { switch(hInfo[i][Owned]) { case 0: { format(lString, sizeof(lString), "House Owned: No\nHouse Owner: No one\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); return 1; }