local materials = { "Copper", "Iron", "Tech", "Silver", "Gold", "Steel", "Platinum", } local parts = { "Helmet", "Platebody", "Platelegs", "Boots", } if(SERVER) then util.AddNetworkString( "gms_equip" ) end local equip_server = function(ln,player) tbl = net.ReadTable() t = net.ReadString( 32 ) player:DecResource( tbl.Item, 1 ) player:SendMessage( tbl.Type.." Equipped!", 3, Color( 10, 200, 10, 255 ) ) bool = net.ReadBool() sName = net.ReadString( 32 ) if !bool then return end player:SendMessage( sName, 3, Color( 10, 200, 10, 255 ) ) player:IncResource( sName, 1 ) end net.Receive( "gms_equip", equip_server ) for k,v in pairs(parts) do for o,p in pairs(materials) do local ITEM = {} ITEM.Name = p.." "..v ITEM.Description = v.." that will protect you." ITEM.Icon = "test.png" ITEM.Type = v ITEM.UniqueData = false ITEM.Actions = {} genericMakeDroppable(ITEM) ITEM.Actions["Equip"] = function() local tbl = { Item = ITEM.Name, Icon = ITEM.Icon, Type = ITEM.Type, Description = ITEM.Description } local sName = "-" for g,h in pairs(GMS.Equipped) do if h['Type'] == tbl.Type then tbl2 = table.remove(GMS.Equipped,g) sName = tbl2.Item break end end table.insert( GMS.Equipped, tbl ) net.Start("gms_equip") net.WriteTable( tbl ) net.WriteString( v, 32 ) if sName != "-" then net.WriteBool( true ) else net.WriteBool( false ) end net.WriteString( sName, 32 ) net.SendToServer() end GMS.RegisterResource(ITEM) end end