I'm running a server, but I dunno how to do forced downloads. Someone plz help??
[highlight](User was banned for this post ("Wrong forum" - Overv))[/highlight]
resource.AddFile("your/file/here")
[QUOTE=sniperlover;31456484]resource.AddFile("your/file/here")[/QUOTE]
What do you mean? Like, all the shit I run? O_O
[QUOTE=Kennyman1;31456496]What do you mean? Like, all the shit I run? O_O[/QUOTE]
I don't think server hosting is for you Kenny
What do you mean by forced downloads?
[QUOTE=Kennyman1;31456451]I'm running a server, but I dunno how to do forced downloads. Someone plz help??[/QUOTE]
function AddDir(dir) // recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("../"..dir.."/*")
for _, fdir in pairs(list) do
if fdir != ".svn" then // don't spam people with useless .svn folders
AddDir(fdir)
end
end
for k,v in pairs(file.Find("../"..dir.."/*")) do
resource.AddFile(dir.."/"..v)
end
end
//This will force the joining players to download everything in the addons folder of the server.
//replace addons with other folders or copy the code and insert the paths in the copiesi.
AddDir("addons")
//This will force the joining players to download certain files from were ever you want. The root folder is garrysmod/
//So if your downloading music you dont need to type garrysmod/sound/music.wav and can type sound/music.wav.
//NOTE that this function also downloads all the related files too. So if you want to get a model, then simply type models/model.mdl and
//it will include the .x80 .x90 etc files with it. If the files are missing it will give you error messages.
//If you want to add files this way simply type the file path in the quotations. copy and paste the code below and add the
//file paths you want in the copies.
resource.AddFile("")
double post
Right, for starters, I made a hamachi server.... but like, where do I put the directory file
[b][url=http://wiki.garrysmod.com/?title=Resource.AddFile]Resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
like this:
[lua]
resource.AddFile("materials/test.vmt");
[/lua]
It doesn't always work right, though, usually it works right.
Function seems semi-broken.
[QUOTE=_NewBee;31747496][b][url=http://wiki.garrysmod.com/?title=Resource.AddFile]Resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
like this:
[lua]
resource.AddFile("materials/test.vmt");
[/lua]
It doesn't always work right, though, usually it works right.
Function seems semi-broken.[/QUOTE]
I still don't know where to put it. I know how to do the Resource.Addfile thing, but I'm still confused
Place the code [b]serverside[/b], preferably in an autorun script:
[i]garrysmod/lua/autorun/server/somename.lua[/i]
For sending Lua scripts to clients, use [b][url=http://wiki.garrysmod.com/?title=G.AddCSLuaFile]AddCSLuaFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b].
[QUOTE=thefreeman193;31761404]Place the code [b]serverside[/b], preferably in an autorun script:
[i]garrysmod/lua/autorun/server/somename.lua[/i]
For sending Lua scripts to clients, use [b][url=http://wiki.garrysmod.com/?title=G.AddCSLuaFile]AddCSLuaFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b].[/QUOTE]
Is this right
serverside
end
resource.AddFile("models/DARKRPSERVERSTUFF")
resource.AddFile("models/batman/slow_pub_v2.dx80")
resource.AddFile("models/batman/slow_pub_v2.dx90")
resource.AddFile("models/batman/slow_pub_v2.mdl")
resource.AddFile("models/batman/slow_pub_v2.phy")
resource.AddFile("models/batman/slow_pub_v2.sw")
resource.AddFile("models/batman/slow_pub_v2.vvd")
resource.AddFile("models/batman/slow_pub_v2.xbox")
resource.AddFile("models/joker/slow_pub.dx80")
resource.AddFile("models/joker/slow_pub.dx90")
resource.AddFile("models/joker/slow_pub.phy")
resource.AddFile("models/joker/slow_pub.vvd")
resource.AddFile("models/joker/slow_pub.xbox")
resource.AddFile("models/joker/slow_pub.mdl")
resource.AddFile("models/joker/slow_pub.sw")
resource.AddFile("models/venom_wos/slow_v2.dx80")
resource.AddFile("models/venom_wos/slow_v2.dx90")
resource.AddFile("models/venom_wos/slow_v2.phy")
resource.AddFile("models/venom_wos/slow_v2.vvd")
resource.AddFile("models/venom_wos/slow_v2.xbox")
resource.AddFile("models/venom_wos/slow_v2.mdl")
resource.AddFile("models/venom_wos/slow_v2.sw")
resource.AddFile("models/robocop/slow.xbox")
resource.AddFile("models/robocop/slow.mdl")
resource.AddFile("models/robocop/slow.phy")
resource.AddFile("models/robocop/slow.vvd")
resource.AddFile("models/robocop/slow.sw")
resource.AddFile("models/robocop/slow.dx80")
resource.AddFile("models/robocop/slow.dx90")
resource.AddFile("models/spawn/slow.dx90")
resource.AddFile("models/spawn/slow.dx80")
resource.AddFile("models/spawn/slow.mdl")
resource.AddFile("models/spawn/slow.phy")
resource.AddFile("models/spawn/slow.sw")
resource.AddFile("models/spawn/slow.vvd")
resource.AddFile("models/spawn/slow.xbox")
resource.AddFile("models/Spiderman/spiderman.dx80")
resource.AddFile("models/Spiderman/spiderman.dx90")
resource.AddFile("models/Spiderman/spiderman.mdl")
resource.AddFile("models/Spiderman/spiderman.phy")
resource.AddFile("models/Spiderman/spiderman.sw")
resource.AddFile("models/Spiderman/spiderman.vvd")
end
With [I]resource.AddFile[/I], you don't need to include all of the files, it'll do most of them automatically. For models, just include the MDL file. Also, the first line is wrong, you cannot include a directory. To search for all the files in a directory and include them, see [url=http://wiki.garrysmod.com/?title=Resource.AddFile]this page[/url] and look at the 3rd example.
Also, he didn't mean to literally put the code
[lua]
serverside
end
[/lua]
He meant to put the code somewhere the server will see it, like garrysmod/lua/autorun/server/somename.lua (which you did).
You also have an extra
[lua]
end
[/lua]
at the end of the file that shouldn't be there.
The file should just have the resource.AddFile lines. Nothing else. (there's no technical reason you can't put other Lua code in there, but it will be easier for you if you just have resource.AddFile)
Alright guys, I downloaded this program called ULX, and I managed to add forced downloads quite easy actually...but thanks everyone for helping, I also used freemans method and it worked, but ULX has been bigger help. Thanks though, everyone
Sorry, you need to Log In to post a reply to this thread.