12.07.2014, 17:05
Hey guys i have this code but my houses didnt load if u can pls help
Код:
forward LoadHouses(); public LoadHouses() { for(new i=0; i<=MAX_HOUSES; i++) { mysql_format(SQL, query, sizeof(query),"SELECT * FROM `"Houses_Table"` WHERE `ID` = '%i'", i); mysql_tquery(SQL, query, "", ""); mysql_store_result(); if(mysql_num_rows() == 0) break; else if(mysql_num_rows() != 0) { mysql_fetch_row_format(query); sscanf(query, "e<p<|>is[25]iiiiiffffff>", HouseInfo[i]); new lString[256]; switch(HouseInfo[i][Owned]) { case 0: { format(lString, sizeof(lString), "House Owned: No\nHouse Owner: None\nHouse Price: $%i", HouseInfo[i][Price]); HouseInfo[i][Label] = CreateDynamic3DTextLabel(lString, -1, HouseInfo[i][OX], HouseInfo[i][OY], HouseInfo[i][OZ]+0.5, 20.0); HouseInfo[i][Icon] = CreateDynamicMapIcon(HouseInfo[i][OX], HouseInfo[i][OY], HouseInfo[i][OZ], 31, -1); HouseInfo[i][EnterPickup] = CreateDynamicPickup(1273, 23, HouseInfo[i][OX], HouseInfo[i][OY], HouseInfo[i][OZ], -1, -1, -1, 20.0); HouseInfo[i][ExitPickup] = CreateDynamicPickup(1273, 23, HouseInfo[i][IX], HouseInfo[i][IY], HouseInfo[i][IZ], -1, -1, -1, 20.0); } case 1: { format(lString, sizeof(lString),"House Owned: Yes\nHouse Owner: %s\nHouse Price: $%i\nHouse Locked: %s", HouseInfo[i][Owner], HouseInfo[i][Price], (HouseInfo[i][Locked] == 1) ? ("Yes") : ("No")); HouseInfo[i][Label] = CreateDynamic3DTextLabel(lString, -1, HouseInfo[i][OX], HouseInfo[i][OY], HouseInfo[i][OZ]+0.5, 20.0); HouseInfo[i][Icon] = CreateDynamicMapIcon(HouseInfo[i][OX], HouseInfo[i][OY], HouseInfo[i][OZ], 32, -1); HouseInfo[i][EnterPickup] = CreateDynamicPickup(1273, 23, HouseInfo[i][OX],HouseInfo[i][OY], HouseInfo[i][OZ], -1, -1, -1, 20.0); HouseInfo[i][ExitPickup] = CreateDynamicPickup(1273, 23, HouseInfo[i][IX], HouseInfo[i][IY], HouseInfo[i][IZ], -1, -1, -1, 20.0); } } CreatedHouses++; } } mysql_free_result(); printf("[House System] %i houses were retrieved..", CreatedHouses); return 1; }