Addon/Workshop retrival feature for server?

Ok, so one thing i have noticed when I join servers is this…

recieving info…

getting addon #12321312 (example)

mounting addons…

workshop complete.

sending info…

Now I actually appreciate this little mount and get addon feature, all the addons im getting are from the steam workshop, how do I address this with the server as a addon from the workshop… this only does this for ONE addon and not all of them… could anyone tell me how this is done and how edit or activate this feature for my DARKRP server that im currently developing…

Is this done through a collection or something… a thorough describtive answer or a redirect to another tutorial would be great! thanks

If you wanted to do only one big addon, then you’d have to extract all the addons you wanted and reupload them to the workshop, but there is a size limit. Currently, this mounting feature does not support collections, so there’s really no viable way of it just mounting one big addon.

No no, I wanted to upload all of the addons, and have them all separately downloaded at once
example…

retriving server info…

Getting addon #1232321
Getting addon #1233451234
Getting addon #09340123

Workshop complete…

Sending Client info…

What’s the problem? Use resource.AddWorkshop for each addon.

Oooo ok I got ya, how would I find the resource.AddWorkshop? is that in a file or something?

Find the addon I’m the workshop and look at the last digits in the URL. That’s the collection ID; it will say something like ?id=132976211

You can do it automatically. This code will break (or potentially has) if steam changes the way they display collection pages significantly, but you shouldn’t have to worry. This code takes your workshop collection ID and runs resource.addworkshop for each entry.

In some serverside file, such as lua/autorun/server/collectiondownload.lua

[lua]

local function GetWorkshopCollectionIDs(collectionid,callback)
if collectionid == nil || callback == nil then return end
http.Fetch(
http://steamcommunity.com/sharedfiles/filedetails/?id=”…collectionid,
function(source)
local source_ = string.Explode("<div class=“workshopItem”>",source)
local t = {}
for k, v in pairs(source_) do
local source__ = string.Explode(""><div",v)
local insert = string.Explode(“id=”,source__[1])[2]
table.insert(t,insert)
end
table.remove(t,1)
callback(t)
end,
function()
return false
end
)
end
GetWorkshopCollectionIDs(YOUR_COLLECTION_ID_NUMBER_HERE,function(ids)
for k, v in pairs(ids) do
resource.AddWorkshop(v)
end
end)
[/lua]

For a collection with a url of http://steamcommunity.com/sharedfiles/filedetails/?id=167549004 the YOUR_COLLECTION_ID_NUMBER_HERE is 167549004

[editline]24th September 2013[/editline]

to put it shortly, this makes it so that everything you add into your collection in steam is installed to the server AND your players

so don’t add anything to your collection that you want to remain private (such as a serverside script you pay someone to make for you)

if you DO want something private, you’ll have to edit the script to not resource.AddWorkshop anything in some blacklist table

Well that simplifies things. Never thought of a lua script to generate the entries…