function LoadHouseData() { new h, h_id; new resultline[600]; mysql_store_result(); while(mysql_fetch_row_format(resultline)) { sscanf(resultline, "p<|>is[80]s[25]s[80]s[25]fffffffiiiii", h_id, hInfo[h][HouseName], hInfo[h][HouseOwner], hInfo[h][HouseLocation], hInfo[h][HousePassword], hInfo[h][SpawnOutX], hInfo[h][SpawnOutY], hInfo[h][SpawnOutZ], hInfo[h][SpawnOutAngle], hInfo[h][CPOutX], hInfo[h][CPOutY], hInfo[h][CPOutZ], hInfo[h][HouseValue], hInfo[h][HouseStorage], hInfo[h][HouseInterior], hInfo[h][HousePrivacy], hInfo[h][HouseForSale]); //printf("House Owner: %s, House Location: %s House Price: %d House ID: %d", hInfo[h][HouseOwner], hInfo[h][HouseLocation], hInfo[h][HouseValue], h); // Create House Pickup CreateCorrectHouseExitCP(h_id); new labeltext[300]; if(!strcmp(hInfo[h_id][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE)) { format(labeltext, sizeof(labeltext), LABELTEXT1, hInfo[h_id][HouseName], ToCurrency(hInfo[h_id][HouseValue]), h_id); HouseMIcon[h_id] = CreateDynamicMapIcon(hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], 31, -1, -1, -1, -1, MICON_VD); HousePickupOut[h_id] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], -1, -1, -1, 30.0); } else if(strcmp(hInfo[h_id][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE)) { if(hInfo[h][HouseForSale] != 0) { format(labeltext, sizeof(labeltext), LABELTEXT3, hInfo[h_id][HouseName], hInfo[h_id][HouseOwner], ToCurrency(hInfo[h_id][HouseValue]), Answer(hInfo[h_id][HousePrivacy], "Open", "Closed"), h_id, ToCurrency(hInfo[h][HouseForSale])); HouseMIcon[h_id] = CreateDynamicMapIcon(hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], 31, -1, -1, -1, -1, MICON_VD); HousePickupOut[h_id] = CreateDynamicPickup(19524, PICKUP_TYPE, hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], -1, -1, -1, 30.0); } else { format(labeltext, sizeof(labeltext), LABELTEXT2, hInfo[h_id][HouseName], hInfo[h_id][HouseOwner], ToCurrency(hInfo[h_id][HouseValue]), Answer(hInfo[h_id][HousePrivacy], "Open", "Closed"), h_id); HouseMIcon[h_id] = CreateDynamicMapIcon(hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], 32, -1, -1, -1, -1, MICON_VD); HousePickupOut[h_id] = CreateDynamicPickup(19522, PICKUP_TYPE, hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], -1, -1, -1, 30.0); } } HouseLabel[h_id] = CreateDynamic3DTextLabel(labeltext, COLOR_GREEN, hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ]+0.7, TEXTLABEL_DISTANCE, .testlos = 1); Iter_Add(Houses, h); h++; } mysql_free_result(); // DEBUG printf("Number of houses loaded: %d", h); return 1; }
stock LoadHouses() { mysql_function_query(g_SQL_handle, "SELECT int_name,intx,inty,intz,inta,cpx,cpy,cpz,interior,value FROM interiors", true, "LoadHouseInteriorData", ""); mysql_function_query(g_SQL_handle, "SELECT house_id,hname,howner,hlocation,hpass,x,y,z,a,cpx,cpy,cpz,hvalue,hstorage,hint,hprivacy,hforsale FROM houses ORDER BY house_id", true, "LoadHouseData", ""); }
stock LoadHouses() { mysql_function_query(g_SQL_handle, "SELECT `int_name`,`intx`,`inty`,`intz`,`inta`,`cpx`,`cpy`,`cpz`,`interior`,`value` FROM `interiors`", true, "LoadHouseInteriorData", ""); mysql_function_query(g_SQL_handle, "SELECT `house_id`,`hname`,`howner`,`hlocation`,`hpass`,`x`,`y`,`z`,`a`,`cpx`,`cpy`,`cpz`,`hvalue`,`hstorage`,`hint`,`hprivacy`,`hforsale` FROM `houses` ORDER BY `house_id`", true, "LoadHouseData", ""); }
You guys have problems in your sql syntax cuz you forget the apostrophes
Код:
stock LoadHouses() { mysql_function_query(g_SQL_handle, "SELECT `int_name`,`intx`,`inty`,`intz`,`inta`,`cpx`,`cpy`,`cpz`,`interior`,`value` FROM `interiors`", true, "LoadHouseInteriorData", ""); mysql_function_query(g_SQL_handle, "SELECT `house_id`,`hname`,`howner`,`hlocation`,`hpass`,`x`,`y`,`z`,`a`,`cpx`,`cpy`,`cpz`,`hvalue`,`hstorage`,`hint`,`hprivacy`,`hforsale` FROM `houses` ORDER BY `house_id`", true, "LoadHouseData", ""); } |