Furniture mysql
#1

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
Reply
#2

Enum? Then that enum you need to save in MySQL.
Reply
#3

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?
Reply
#4

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.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)