[QUOTE=Busymonkey;19038893][HIGHLIGHT][I]Re-done entire thread; learned stuff by reading the replies[/I][/HIGHLIGHT]
[B]The Wiki: [B][URL="http://wiki.garrysmod.com/?title=Resource.AddFile"]Resource.AddFile [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG][/URL][/B][/B]
--->
In this thread, I'll be covering, how you make players who connect to your server, download stuff if they dont have it :eng101:
[HIGHLIGHT]1 - Lets Get Started[/HIGHLIGHT]
Navigate to your garrysmod/garrysmod/lua/autorun/server folder (Incase you dont have the "autorun" or the "server" folder, simply create those), right click and make a new text document.
[HIGHLIGHT]2 - The Coding[/HIGHLIGHT]
The coding, or whatever you want to call it, is extremely easy to do here, simply write:
[code]resource.AddFile ("the/path/of/model.mdl")[/code]Forexample:
[code]resource.AddFile ("models/barney.mdl")[/code]If the player, who connected to your server, doesent have the barney.mdl file, he will download it automaticly + the materials for it (.vtf files).
You can make people models, materials, lua files and all kinds of stuff, including maps.
[HIGHLIGHT]3 - Saving The File[/HIGHLIGHT]
Hit "Save as..." and name it resource.lua, and put it into your garrysmod/lua/autorun/server folder.
[HIGHLIGHT]4 - Done![/HIGHLIGHT]
That's actually it! Just restart your server and whenever people connect to your server, without having the barney model, they will download all the 6 model files + the materials for him.
[I]Just for the record, you can add multiple things to the file, so you dont have to make resource1.lua, resource2.lua...[/I]
[HIGHLIGHT]5 - Addition[/HIGHLIGHT]
You can also use the [URL="http://wiki.garrysmod.com/?title=Resource.AddFile"]AddDir Command[/URL], which makes them download the whole directory.
I'm sorry, but I'm not able to explain what it does, cause I... well, cant :doh:
[HIGHLIGHT]Useful Replies[/HIGHLIGHT]
[B]Remember:[/B][/QUOTE]
It doesn't automatically send the materials, only the dx90, dx80 etc files.
Gah.
You didnt have to quote the whole OP.
[QUOTE=Dragge;21508609]The client can just turn off the download function if they dont want to download all the shit..
[img]http://dl.dropbox.com/u/3684498/TurnOff.jpg[/img][/QUOTE]
Won't that prevent them from downloading the essential lua files as well?
it will
Oh, I really read.
I thought he meant every file
Well this is a good tutorial for some newcomers, gratz :dance:
*bump* Seeing more threads asking about this :/
could someone bump this? :) seeing new threads
[editline]04:05PM[/editline]
oh, okay - automerge broke
It didn't break, it just times out after a few hours.
Ah, I see :)
-snip-
Fuck. Pressed "Reply" instead of Edit in OP :/
This should work fine, where did you put the code/file?
[code]resource.AddFile ("models/weapons/v_minigun.mdl")
resource.AddFile ("models/weapons/w_minigun.mdl")
resource.AddFile ("materials/weapons/weapon_mad_minigun.vtf")
resource.AddFile ("materials/weapons/weapon_mad_minigun.vmt")
resource.AddFile ("materials/models/weapons/jb_chaingun.vmt")
resource.AddFile ("materials/models/weapons/jb_chaingun.vtf")
resource.AddFile ("materials/models/weapons/jb_chaingun_normal.vtf")
resource.AddFile ("materials/models/weapons/jb_chaingun_spec.vtf")
resource.AddFile ("sound/weapons/minigun/mini-1.wav")
resource.AddFile ("sound/weapons/universal/iron_out.wav")
resource.AddFile ("sound/weapons/universal/iron_in.wav")
[/code]This is only downloading the models, not the materials. I think the materials are corrupted anyway.
Fixed!
[QUOTE=Music;23003568]Why doesn't it force them to download models? I tried downloading via server it I saw my models as errors.
[/QUOTE]
Make sure you put the file in "lua/autorun/server", in your [b]Server's folder[/b] ofcourse.
[QUOTE=commander204;23013110]This should work fine, where did you put the code/file?[/QUOTE]
Autorun/server/ and it wont make them download it because the players are still errors to me :>
[QUOTE=Busymonkey;23058006]Make sure you put the file in "lua/autorun/server", in your [b]Server's folder[/b] ofcourse.[/QUOTE]
Still not making users download it.
Well then you did something wrong.
[editline]09:32PM[/editline]
800th post :toot:
Bumping for more views.
Ugh, I followed your guide and it didn't work...I tested it on my server, put the lua file in lua/autorun/server and removed my models from my computer to test if I could download/see them, what happened was I downloaded the model files, everything except the dx80 and dx90 files...I think, I'll check which files I downloaded later, but the main thing is, it added files to download. But when I looked at the player model, it still was an error >.< here is the code:
resource.AddFile("models/humans/billymays.mdl")
resource.AddFile("models/player/billymays.mdl")
resource.AddFile("materials/models/BILLYMAYS/arms.vtf")
resource.AddFile("materials/models/BILLYMAYS/citizen_sheet.vtf")
resource.AddFile("materials/models/BILLYMAYS/ted_facemap.vtf")
resource.AddFile("materials/models/player/Billy/arms.vtf")
resource.AddFile("materials/models/player/Billy/citizen_sheet.vtf")
resource.AddFile("materials/models/player/Billy/ted_facemap.vtf")
[QUOTE=iRzilla;24653230]Resource != resource[/QUOTE]
i used a generator ; [url]http://www.facepunch.com/showthread.php?p=20586411[/url]
S: lol
[QUOTE=iRzilla;24653302]You messed it up then.[/QUOTE]
nah it wus like that when i used it first time but i just replaced them all with notepad++
thanks :)
[editline]12:00AM[/editline]
wait this is weird, so i added this :
resource.AddFile( "addons/Master Chief Playermodel/models/peterboi/masterchief/masterchief.mdl" )
it should take care of the others, It does
but when it try to download those ( when i join my own server )
its stuck at files such as :
.vvd :( it dont come any farther
it first look likes it download it like the balk loads right..
but after that it still says :
blabla.vvd
and it wont download / nothing happening
Shouldn't it be
[lua]resource.AddFile("models/peterboi/materchief/masterchief.mdl")[/lua]
[QUOTE=Banana Lord.;24655921]Shouldn't it be
[lua]resource.AddFile("models/peterboi/materchief/masterchief.mdl")[/lua][/QUOTE]
it is in the addon folder
and how els can he locate to addon folder :S?
resource.AddFile("models/peterboi/materchief/masterchief.mdl")
then it should be in models directory ?
[QUOTE=Siemz;24663997]it is in the addon folder
and how els can he locate to addon folder :S?
resource.AddFile("models/peterboi/materchief/masterchief.mdl")
then it should be in models directory ?[/QUOTE]
Nope, all folders inside addons are automatically added into their respective folders in the garrysmod folder...
Which means that it should be: [code]resource.AddFile("models/peterboi/materchief/masterchief.mdl") [/code] even though that the model is in an addon folder.
So I win. Cool.
But how to do this with files that are in the addons folder?
[QUOTE=Siemz;25314069]But how to do this with files that are in the addons folder?[/QUOTE]
If the model is in "addons/SomeModels/models/MyModel/model.mdl" then you would write "models/MyModel/model.mdl".
Sorry, you need to Log In to post a reply to this thread.