Starting an inventory system

I’m wanting to start an inventory system for my money system and NPC shop for buying, selling, using, etc. The problem is, I don’t know where to start for the serverside/network side. Any examples will help.

What I do always, is starting off with the clientside. I start by making a HUD and some of the required functions. After the HUD/VGUI works, I go to the next step, which is networking. Try to use some pre-set items, network that, and see if it works.

If that all works, you are going to look in the connection. Client <-> Server, and see if you can make it all work: Buy, sell and stuff. If this works, you store the data in the player’s database/row/table.

Just start with the database or how its going to be stored.

Maybe in this order:

Database / Storage method
Networking the data from client to server
Loading the data
Saving the data
Displaying the data in a VGUI.

Before you ask facepunch for networking help you should really look into tutorials to answer silly things like how to network. It’d be useless to give you an example unless you understand locality and even more detrimental to your health if you used it improperly.

Look, there’s even a nice wiki page explaining in detail the net library usage(http://wiki.garrysmod.com/page/Net_Library_Usage). I’m also a nice guy so I’ll even try and get you started:

[lua]//some_Shared_that_you_included_in_some_gamemode.lua
local _DATA = {Players = {}};
local _MODIFIER = {
Unique = “buttse”,
Player = {
Setup = {
Inventory = {},
Modifier = false --writing this for the lols atm.
}
};
};

if !SERVER then
return;
end

local function InitializeSpawn(steamid)
if !_DATA.Players[steamid] then
_DATA.Players[steamid] = table.Copy(_MODIFIER.Player.Setup);–eventually network this and perform handshakes when you need to pee.
end
end

–lets setup us some vars for our player
hook.Add(“PlayerInitialSpawn”, _MODIFIER.Unique, function(ply)
InitializeSpawn(ply);
end);
[/lua]

I know how to use it, I just don’t know how I would set it up right.