Creating a loadout system

I’m working on a gamemode, in this gamemode you gain money throughout the rounds, and I want to have a menu at the beginning of every round that allows you to buy only one primary, secondary, and misc weapon/ability, similar to CS:S. Now the problem I have is how would I go about making it so the player can only have one of each slot, bear in mind I plan on having different “abilities” for the misc slot, not weapons. I fear if I use a console command people would be able to buy more than one of each slot.

This is a Fretta derived gamemode.

You could just use concommands like “buy_primary”, and when they buy a primary say player:SetNWBool(“HasBoughtPrimary”,true) and prevent them from buying again.

I made a CS:S buymenu for a gamemode I’m working on now, and I only used one function.

Snippets:
[lua] for k,v in pairs(GMD.Weapons) do
if k == wep then
wepdat = v
end
end
[/lua]

[lua] if ply:GetSWeapon(wepdat.Type) and not wepdat.Type == “Equips” then
ply:StripWeapon(ply:GetSWeapon(wepdat.Type):GetClass()) // The function goes on as normal after this.
end
[/lua]

GetSWeapon:
[lua]
local meta = FindMetaTable(“Player”)

local function meta:GetSWeapon(type)
for _,v in pairs(self:GetWeapons()) do
if table.HasValue(GMD[type], v:GetClass()) then
return v
end
end
end
[/lua]

And what your table would look like if you used this:
[lua]
GMD.Primary = {“weapon_m4”, “weapon_ak47”} // etc.
[/lua]

And lastly, the weapon as it would be inserted into the table:
[lua]
GMD.Weapons[“M4A1”] = {}
GMD.Weapons[“M4A1”].Class = “weapon_m4”
GMD.Weapons[“M4A1”].Cost = 3100
GMD.Weapons[“M4A1”].Type = “Primary”
GMD.Weapons[“M4A1”].Ammo = 200
GMD.Weapons[“M4A1”].AmmoType = “smg1”
[/lua]

I liked the loadout system in Geoforts that had 3d weapons.

Was win.

Thanks guys, I’ll try some of this now.