Setting up a fastdl for my server.

Hello, today I decided to switch my server from using the slow WorkshopDL to using fastdl. To start off with I have began to “attempt” to fastdl my models but I have encountered some problems which I will list below:

For reference here is my fastdl.lua file located in (lua/autorun/server): http://pastie.org/10234730
Here is where my model files are located (Not sure if this will help at all): “materials/” folder http://i.imgur.com/f7kZGDE.png || “models/” folder http://i.imgur.com/AmI4Bmh.png
My sv_downloadurl is “http://162.255.209.131/162.255.209.131-27015/” That is my servers ip and port (Thats how Xenonservers fastdl system works)
I have spoken to their support and they aren’t really that much help tbh. So I though I would try Facepunch before continuing with them.

Now what I have provided to you above only gives texture to a few models. Here is a pic http://i.imgur.com/NyEvTVV.png

I am sure the problem lies within the fastdl.lua file.

Any help is appreciated! If you need anymore info please ask.

Try this script:


local AddWhitelist = {
	[ "ogg" ] = true,
	[ "mp3" ] = true,
	[ "wav" ] = true,
	[ "png" ] = true,
	[ "jpg" ] = true,
	[ "vtf" ] = true,
	[ "vmt" ] = true,
	[ "mdl" ] = true,
	[ "ttf" ] = true,
	[ "otf" ] = true
}

local DisabledDirectories = {

}

local DisabledFiles = {

}

local vtfs = {}
local vmts = {}

function resource.AddDirectory( directory )
	
	local files, directories = file.Find( directory .. "/*", "MOD" )

	for _, NewFile in ipairs( files ) do
		local FullFile = directory .. "/" .. NewFile
		if DisabledFiles[ FullFile ] then continue end
		
		local name = string.Explode( ".", NewFile, false )[1]
		local extension = string.GetExtensionFromFilename( NewFile )
		
		if ( not AddWhitelist[ extension ] ) then continue end
		
		
		if ( extension == "vmt" ) then 
			vmts[ name ] = true 
		elseif ( extension == "vtf" ) then
			table.insert( vtfs, name )
			continue
		end
		
		resource.AddFile( FullFile )
	end
	
	for _, vtf in ipairs( vtfs ) do
		if ( vmts[ vtf ] ) then
			continue
		else
			resource.AddFile( directory .. "/" .. vtf .. ".vtf" )
		end
	end

	for _, NewDirectory in ipairs( directories ) do
		local FullDirectory = directory .. "/" .. NewDirectory
		if DisabledDirectories[ FullDirectory ] then continue end
		
		resource.AddDirectory( directory .. "/" .. NewDirectory )
	end
end

MsgN( "[FastDL] Adding sounds" )
resource.AddDirectory( "sound" )

MsgN( "[FastDL] Adding materials" )
resource.AddDirectory( "materials" )

MsgN( "[FastDL] Adding models" )
resource.AddDirectory( "models" )

MsgN( "[FastDL] Adding fonts" )
resource.AddDirectory( "resource/fonts" )

Note that it will not add addon folders due to the nature of file.Find and the fact that it would cause insane amounts of things from mounted games to be added. On your sv_downloadurl – since it is obfuscated and I cannot view it, are all the files in .bz2 format?

Yes, they are all .bz2 files.

Start up GMod, join the server, and post any HTML/download errors you get here.

I added the code you told me to into the fastdl.lua file located in lua/autorun/server. Now the server isn’t starting up. Here is some log I took from the console http://pastie.org/private/o4lecswv9b70ulat9i9fsg

Is it crashing? It will take a long time if you have a lot of materials to add.

[editline]10th June 2015[/editline]

You can try adding this to the DisabledDirectories:

[ “materials/spawnicons” ] = true

That didn’t seem to change anything. I did add the “[ “materials/spawnicons” ] = true” into the whitelist and I was able to join my server, but still the same with the model textures and etc…

Did the server fully start up?

Yes but the model textures remained the same.

Edit: Forget what I said above when I said it worked when I put [ “materials/spawnicons” ] = true in the Whitelist. Turns out I forgot to put a , in the listing above it.

Can you post a clientside console log as you join?

That’s the thing, I cannot join my server. When I use the script you gave me my server seems to loop when starting up and I cannot join it because it isn’t able to start up.