13.01.2012, 07:10
So i have a housing script but the floats for it are actually too big for it.... So it misses some numbers wich make them pretty badly misplaced.... Anyone an idea?
LoadHouses()
{
print("Houses are being loaded");
mysql_query("SELECT NULL FROM Houses");
mysql_store_result();
new rows = mysql_num_rows();
mysql_free_result();
CheckMySQL();
for(new i; i < rows; i++)
{
new string[128], string2[128];
format(string, sizeof(string), "SELECT * FROM Houses WHERE HouseID = '%d'", i);
mysql_query(string);
mysql_store_result();
new row[128];
new field[11][24];
mysql_fetch_row_format(row, "|");
explode(row, field, "|");
mysql_free_result();
AHouseData[i][ID] = strval(field[0]);
AHouseData[i][price] = strval(field[1]);
format(AHouseData[i][Owner], 24, "%s", field[2]);
AHouseData[i][HouseX] = strval(field[3]);
AHouseData[i][HouseY] = strval(field[4]);
AHouseData[i][HouseZ] = strval(field[5]);
if(strlen(AHouseData[i][Owner]) > 0)
{
CreatePickup(1272, 1, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ] + 0.5, -1);
format(string2, sizeof(string2), "This house is owned by:\n%s", AHouseData[i][Owner]);
}
else
{
CreatePickup(1273, 1, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ] + 0.5, -1);
format(string2, sizeof(string2), "This house is for sale!\nPrice: %i\n Type /buyhouse to buy", AHouseData[i][price]);
}
CreateDynamic3DTextLabel(string2, 0x008080FF, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ] + 1.5, 40.0);
printf("House %d created", i);
}
print("Loading finished");
}
AHouseData[i][HouseY] = floatstr(result)
new row[128];
new field[11][24];
mysql_fetch_row_format(row, "|");
explode(row, field, "|");
-> mysql_free_result();
AHouseData[i][ID] = strval(field[0]);
AHouseData[i][price] = strval(field[1]);
format(AHouseData[i][Owner], 24, "%s", field[2]);
AHouseData[i][HouseX] = strval(field[3]);
AHouseData[i][HouseY] = strval(field[4]);
AHouseData[i][HouseZ] = strval(field[5]);
new row[128];
new field[11][24];
mysql_fetch_row_format(row, "|");
explode(row, field, "|");
AHouseData[i][ID] = strval(field[0]);
AHouseData[i][price] = strval(field[1]);
format(AHouseData[i][Owner], 24, "%s", field[2]);
AHouseData[i][HouseX] = strval(field[3]);
AHouseData[i][HouseY] = strval(field[4]);
AHouseData[i][HouseZ] = strval(field[5]);
mysql_free_result();