09.05.2016, 20:01
(
Последний раз редактировалось Konstantinos; 10.05.2016 в 12:09.
)
I wouldn't use a child table at all.
The main table for houses should have the primary key to its house ID so it can be able to update data whenever you want and have a column like "Owner" that is set to 0 if no owner or the user ID if it is owned.
EDIT: On second tought, this way is better.
When a player connects to the server and after logging, sending a query such (an example):
would select all the house IDs that player owns.
No need to have per-player variables. Have the Owner (user ID or 0) stored in a variable and then comparing would be really easy.
The main table for houses should have the primary key to its house ID so it can be able to update data whenever you want and have a column like "Owner" that is set to 0 if no owner or the user ID if it is owned.
EDIT: On second tought, this way is better.
When a player connects to the server and after logging, sending a query such (an example):
pawn Код:
"SELECT houseid FROM houses WHERE Owner=%i"
No need to have per-player variables. Have the Owner (user ID or 0) stored in a variable and then comparing would be really easy.