![]() |
#1 |
Huge Clucker
![]() ![]() ![]() Join Date: Aug 2010
Posts: 374
Reputation: 18
|
![]()
Hey guys,
I'm working on implementing an inventory system. I was wondering what would be the best way to structure it in my script and in my SQL database. Is this type of thing normally associated with the primary users table or would it be better to link a player inventory table to the users table through primary key? |
![]() |
![]() |
![]() |
#2 |
Huge Clucker
![]() ![]() ![]() Join Date: Aug 2016
Posts: 273
Reputation: 22
|
![]()
I would recommend to keep things separate.
the primary table only for important stuff like username, password, money, score... and another one for the inventory. As for code structure: This really just depends on preference. And creating a own table for the inventory could have some advantages, but that depends on what you want and how you want to do it. |
![]() |
![]() |
![]() |
#3 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Oct 2009
Posts: 2,071
Reputation: 188
|
![]()
Keep things separate. In fact i would make containers for items and reuse them for things like vehicle storage, boxes and other stuff.
|
![]() |
![]() |
![]() |
#4 |
Huge Clucker
![]() ![]() ![]() Join Date: Aug 2010
Posts: 374
Reputation: 18
|
![]()
I've seen this in the form of briefcases. I'm not entirely sure of the best way to code that, however. I went ahead and made a general inventory table, a weapons inventory table, and an ore inventory table. I definitely see how much easier that is than putting all of that information in a single table.
|
![]() |
![]() |
![]() |
#5 |
Huge Clucker
![]() ![]() ![]() Join Date: Apr 2012
Location: darkness
Posts: 291
Reputation: 80
|
![]()
You can go by making it separate, just like you do vehicles for example, make the same thing with inventory and load it from player username or a player row id.
|
![]() |
![]() |
![]() |
#6 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jan 2015
Location: Canada
Posts: 1,766
Reputation: 840
|
![]()
Here's how i would do it, so i am making this database schema based on your server has dynamic inventory items and item types.
Table: "ItemTypes"
Table: "Items"
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
![]() |
#7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Huge Clucker
![]() ![]() ![]() Join Date: Aug 2010
Posts: 374
Reputation: 18
|
![]() Quote:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
structure for inventory database | PeanutButter | Scripting Help | 6 | 14/01/2017 12:22 AM |
How many && can you use in a IF structure? | Lucky13 | Scripting Help | 10 | 29/01/2016 03:12 AM |
Need help with control structure | Jing_Chan | Scripting Help | 2 | 31/08/2014 11:02 PM |
Server structure help | Opptur | Scripting Help | 4 | 08/06/2014 02:10 PM |
Inventory issue [Cyanide's inventory.inc] | Devix | Scripting Help | 0 | 09/10/2012 09:14 PM |