Posts: 168
Threads: 57
Joined: Oct 2009
Reputation:
0
Hello
How should i save my house furniture in RP servers? I want to make that each people can own 20 furniture objects. But how i save them? Example please.
Larry
Posts: 162
Threads: 5
Joined: Oct 2012
Reputation:
0
Enum? Then that enum you need to save in MySQL.
Posts: 168
Threads: 57
Joined: Oct 2009
Reputation:
0
You think it`s better to make a new table for furniture and mark these with ID. So in house enum i put like this:
HouseInfo[houseID][FurnitureID] = FurnitureTableID;
?
Are you sure that`s better way than adding furniture stuff to house table?
--------------------------
And so i have to do enum like this:
FurnitureID,
FurnitureX,
FurnitureY,
FurnitureZ
And this 20x?
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
Furniture per player, or per house? That's a big difference.
Create a table 'furniture' with these columns: houseid, objectid, posx, posy, posz, rotx, roty, rotz, (interior, virtualworld, ...)
The houseid column is a foreign key and references the houseid column in the houses table. Full cascading. This means that if the house gets deleted, all furniture associated with it will also be deleted automatically. You can omit the foreign key but it will only pose more work and you can end up with orphaned rows.
I don't exactly see what the point is of loading all the data into variables in the script when that data is already present in the database. The only piece of information that may be of significant value in the script is how many pieces of furniture the house already has, to avoid lots of slow COUNT() queries.
Posts: 168
Threads: 57
Joined: Oct 2009
Reputation:
0
Furniture per house. So when i sell the house, the furniture won`t be deleted. So is that the only way, i have to make like 7*20 fields into mysql? And then on gm starting i load it into enum or how i load and edit them in game? I would be able to edit objects in ig - their position, and i would be able to delete them. Like in LS:RP.