24.11.2012, 19:58
(
Последний раз редактировалось Fernado Samuel; 04.10.2013 в 18:15.
)
Removed
stock LoadHouses()
{
new rows, idx = 1, string[256], query[256], query2[200], lines;
format(query, sizeof(query), "SELECT * FROM houses");
mysql_query(query);
mysql_store_result();
lines = mysql_num_rows();
mysql_free_result();
for(new i = 1; i < lines; i++)
{
format(query2, sizeof(query2), "SELECT * FROM houses WHERE id = %i", i);
mysql_query(query2);
mysql_store_result();
while(mysql_fetch_row_format(query2, "|"))
{
mysql_fetch_field_row(HouseInfo[i][hPrice], "houseprice");
mysql_fetch_field_row(HouseInfo[i][hStatus], "housestatus");
mysql_fetch_field_row(HouseInfo[i][hOwner], "houseowner");
mysql_fetch_field_row(HouseInfo[i][hX], "housex");
mysql_fetch_field_row(HouseInfo[i][hY], "housey");
mysql_fetch_field_row(HouseInfo[i][hZ], "housez");
HouseInfo[i][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ], 0);
if(!strcmp("trapstar2020", HouseInfo[i][hOwner]))
{
format(string, sizeof(string), "ID: %d\nOwner: %s\nStatus: For Sale\nPrice: $%d", i, HouseInfo[i][hOwner], HouseInfo[i][hPrice]);
}
else format(string, sizeof(string), "ID: %d\nOwner: %s\nStatus: %s", i, HouseInfo[i][hOwner], hlock(i));
{
HouseInfo[i][hText] = CreateDynamic3DTextLabel(string, COLOR_PURPLE, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]+0.3, 15);
}
idx++;
mysql_free_result();
}
printf("[Script] %d Houses were loaded.", idx);
}
return 1;
}
100% untested but if you know the basis on MySQL this should be easy for you.
PHP код:
|