Furniture mysql - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Furniture mysql (
/showthread.php?tid=401564)
Furniture mysql -
Larry123 - 23.12.2012
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
Re: Furniture mysql -
B-Matt - 23.12.2012
Enum? Then that enum you need to save in MySQL.
Re: Furniture mysql -
Larry123 - 23.12.2012
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?
Re: Furniture mysql -
Vince - 23.12.2012
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.
Re: Furniture mysql -
Larry123 - 23.12.2012
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.