General > Developers Corner
Download current map from workshop
Chiller252:
Here's the system I've been using:
--- Code: ---maplist = {}
maplist["gm_trainconstruct2"] = "161015436"
maplist["gm_freespace_13"] = "115510325"
maplist["gm_citylimits_day_v1"] = "106750883"
maplist["gm_citylimits_v2"] = "104674256"
maplist["gm_bluehills_test3"] = "243902601"
maplist["gm_excess_islands"] = "115250988"
maplist["gm_bigcity"] = "105982362"
maplist["gm_fork"] = "326332456"
maplist["gm_Lair"] = "104488112"
maplist["gm_carcon_ws"] = "206869955"
maplist["gm_flatgrass_airport"] = "108420002"
maplist["gm_flatgrass_classic"] = "104609986"
maplist["rp_chaos_city_v33x_03"] = "296403366","296391343","296396662","296399858"
maplist["gm_megacity"] = "457749390"
maplist["gm_flatbuild_2015_dev"] = "432484761"
maplist["gm_flatgrass_abs_v3c"] = "213888400"
maplist["gm_valley"] = "104483504"
maplist["GM_City25"] = "523367894"
maplist["gm_construct_flatgrass_v6-2"] = "104468359"
maplist["gm_mobenix_v3_final"] = "140618773"
--add new maps down here with the same syntax
--------------------------------------------------
local map = game.GetMap() -- Get's the current map name
local workshopid = maplist[map]
-- Finds the workshop ID for the current map name from the table above
if( workshopid != nil )then
--If the map is in the table above, add it through workshop
print( "[WORKSHOP] Setting up maps. " ..map.. " workshop ID: " ..workshopid )
resource.AddWorkshop( workshopid )
else
--If not, ) then hope the server has FastDL or the client has the map
print( "[WORKSHOP] Not available for current map. Using FastDL instead hopefully..." )
end
--- End code ---
There are a couple tricks when using this code:
The map name must be exactly the same map name as it appears on the file
The workshop id must be valid for the maps
This can go in the bottom of your resource.addworkshop file if you have one otherwise it goes in garrysmod\lua\autorun\server
Navigation
[0] Message Index
[*] Previous page
Go to full version