Server workshop maps?

So if I’m correct, you put the maps in your workshop server list. Then once you pick the map, it should load up for everybody, regardless if they have it downloaded personally. But I added a couple of ttt_maps and switched a map and it said I was missing the map, but the server itself switched.

Here’s the code you need. Place it in a file called whatever_you_want.lua in /lua/autorun/server



--Map Setup
maplist = {}

maplist["ttt_minecraft_b5"] = "159321088"
maplist["ttt_minecraftcity_v4"] = "186842624"
--add more maps here
-- Usage: maplist["name_of_map_excluding_.bsp"] = "WorkshopID"
-- To find the WorkshopID, simply go to the map in Workshop and right click and press "Copy Page URL", and the numbers after the &id=123123123 are the WorkshopID... Example below
-- Example: http://steamcommunity.com/sharedfiles/filedetails/?id=159321088 <---- Those numbers


local map = game.GetMap() -- Get's the current map name
local id = maplist[map] 
-- Finds the workshop ID for the current map name from the table above

if( id != nil )then
	--If the map is in the table above, add it through workshop
	print( "[MapDL] Setting up maps. " ..map )
	resource.AddWorkshop( id )
end


If I’m correct, do I still need to add the maps via Workshop list?

If you mean a collection, then yes. You need to use +host_workshop_collection with his code. One hosts the map on your server and the other sends them to the client.

Do you mean directly inside the lua file or can I just leave it in my start up line?

Startup line.