Use resource.AddWorkshop depending on the map.

Hello,

I’m looking for a solution so all my maps will not be downloaded at the same time on my server…

For example I would like to have it so

resource.AddWorkshop( “blahablah” ) only triggers if the map = “gm_flatgrass”

I’d seen this somewhere before and used it, but lost the thread. Was wondering if anyone had any ideas…

Thank you!


local tMaps = {
   gm_blah = "1234567",
   de_blah = "1234567",
}

local sMap = game.GetMap()

if ( tMaps[sMap] ) then
   resource.AddWorkshop( tMaps[sMap] )
end

The current map is automatically added if it is loaded from a gma, so you don’t need a script to do this.

As long as it is in the server’s workshop collection*