24.04.2014, 22:23
Hi.
Nice work.
I would have done
And set default values for other fields in MySQL (also set hID as AUTO_INCREMENT)
And
is really simple, but if you have 200 houses, saving will take time for (200 * 12 = ) 2400 requests.
Try to format your string into one query. And I also used this:
Nice work.
I would have done
PHP Code:
// But maybe I'm wrong
stock CreateNewHouse(Float:posX, Float:posY, Float:posZ)
{
new query[250];
format (query, sizeof(query), "INSERT INTO `houseinfo` (outX, outY, outZ) VALUES (%f, %f, %f);", posX, posY, posZ);
mysql_query(query);
ReloadHouse(mysql_insert_id());
return 1; // And maybe return a new house id (taken from mysql_insert_id())
}
And
PHP Code:
stock SaveHouses(h) // Saved every variable sepratly. - More simple.
{
...
}
Try to format your string into one query. And I also used this:
PHP Code:
// to enum iHouse
{
// ...
bool:Touched,
// ...
}
// each time, when something changed in house data
iHouse[houseId][Touched] = true;
// and in SaveHouses():
{
if (House[h][Touched])
{
mysql_query(...);
House[h][Touched] = false;
}
}