• Force Client To Download Models + Etc!
    67 replies, posted
[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 :/
Why doesn't it force them to download models? I tried downloading via server it I saw my models as errors. [lua] resource.AddFile( "materials/models/humans/jackntie/art_facemap.vmt" ) resource.AddFile( "materials/models/humans/jackntie/art_facemap.vtf" ) resource.AddFile( "materials/models/humans/jackntie/breen_sheeb.vmt" ) resource.AddFile( "materials/models/humans/jackntie/breen_sheeb.vtf" ) resource.AddFile( "materials/models/humans/jackntie/breen_sheet.vmt" ) resource.AddFile( "materials/models/humans/jackntie/breen_sheet.vtf" ) resource.AddFile( "materials/models/humans/jackntie/breen_sheet_normal.vtf" ) resource.AddFile( "materials/models/humans/jackntie/breen_sheet_normal.vtf" ) resource.AddFile( "materials/models/humans/jackntie/citizen_sheet.vmt" ) resource.AddFile( "materials/models/humans/jackntie/citizen_sheet.vtf" ) resource.AddFile( "materials/models/humans/jackntie/erdim_cylmap.vmt" ) resource.AddFile( "materials/models/humans/jackntie/erdim_cylmap.vtf" ) resource.AddFile( "materials/models/humans/jackntie/eric_facemap.vmt" ) resource.AddFile( "materials/models/humans/jackntie/eric_facemap.vtf" ) resource.AddFile( "materials/models/humans/jackntie/joe_facemap.vtf" ) resource.AddFile( "materials/models/humans/jackntie/joe_facemap.vmt" ) resource.AddFile( "materials/models/humans/jackntie/mike_facemap.vmt" ) resource.AddFile( "materials/models/humans/jackntie/mike_facemap.vtf" ) resource.AddFile( "materials/models/humans/jackntie/sandro_facemap.vmt" ) resource.AddFile( "materials/models/humans/jackntie/sandro_facemap.vtf" ) resource.AddFile( "materials/models/humans/jackntie/ted_facemap.vmt" ) resource.AddFile( "materials/models/humans/jackntie/ted_facemap.vtf" ) resource.AddFile( "materials/models/humans/jackntie/van_facemap.vmt" ) resource.AddFile( "materials/models/humans/jackntie/van_facemap.vtf" ) resource.AddFile( "materials/models/humans/jackntie/vance_facemap.vmt" ) resource.AddFile( "materials/models/humans/jackntie/vance_fancemap.vtf" ) resource.AddFile( "models/player/suits/male_07.dx80.vtx" ) resource.AddFile( "models/player/suits/male_07.dx90.vtx" ) resource.AddFile( "models/player/suits/male_07.mdl" ) resource.AddFile( "models/player/suits/male_07.phy" ) resource.AddFile( "models/player/suits/male_07.sw.vtx" ) resource.AddFile( "models/player/suits/male_07.vvd" ) resource.AddFile( "models/player/suits/male_07.xbox.vtx" ) resource.AddFile( "models/Tatical_Rebel.dx80.vtx" ) resource.AddFile( "models/Tatical_Rebel.dx90.vtx" ) resource.AddFile( "models/Tatical_Rebel.mdl" ) resource.AddFile( "models/Tatical_Rebel.phy" ) resource.AddFile( "models/Tatical_Rebel.sw.vtx" ) resource.AddFile( "models/Tatical_Rebel.vvd" ) resource.AddFile( "materials/models/gasmask/tac_rbe/citizen_sheet.vmt" ) resource.AddFile( "materials/models/gasmask/tac_rbe/citizen_sheet.vtf" ) resource.AddFile( "materials/models/gasmask/tac_rbe/citizen_sheet_normal.vtf" ) resource.AddFile( "materials/models/gasmask/tac_rbe/ct_sas.vmt" ) resource.AddFile( "materials/models/gasmask/tac_rbe/ct_sas.vtf" ) resource.AddFile( "materials/models/gasmask/tac_rbe/eric_facemap.vmt" ) resource.AddFile( "materials/models/gasmask/tac_rbe/eric_facemap.vtf" ) [/lua]
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")
Try adding all the model files manually.
can some 1 tell me whats rong with this , [code]if (SERVER) then Resource.AddSingleFile( "Trails/materials/trails/angry.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/angry.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/arrow.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/arrow.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/ben.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/ben.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/carebear.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/carebear.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/dennis.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/dennis.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/epiclulz.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/epiclulz.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/handy.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/handy.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/happy.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/happy.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/litfuse.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/litfuse.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/rainbow.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/rainbow.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/smouch.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/smouch.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/star.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/star.vtf" ) Resource.AddSingleFile( "Trails/materials/trails/wots.vmt" ) Resource.AddSingleFile( "Trails/materials/trails/wots.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/models/player/tinkywinky_hl2mp_player/tinkywinky_hl2mp_player.mdl" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/models/player/po_hl2mp_player/po_hl2mp_player.mdl" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/models/player/laalaa_hl2mp_player/laalaa_hl2mp_player.mdl" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/models/player/dipsy_hl2mp_player/dipsy_hl2mp_player.mdl" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/models/humans/tinkywinky_hl2mp_human/tinkywinky_hl2mp_human.mdl" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/models/humans/po_hl2mp_human/po_hl2mp_human.mdl" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/models/humans/laalaa_hl2mp_human/laalaa_hl2mp_human.mdl" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/models/humans/dipsy_hl2mp_human/dipsy_hl2mp_human.mdl" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/vgui/entities/dipsy_hl2mp.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/vgui/entities/dipsy_hl2mp.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/vgui/entities/laalaa_hl2mp.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/vgui/entities/laalaa_hl2mp.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/vgui/entities/po_hl2mp.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/vgui/entities/po_hl2mp.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/vgui/entities/tinkywinky_hl2mp.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/vgui/entities/tinkywinky_hl2mp.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/ear.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/ear.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/face.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/face.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/plantar.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/plantar.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/purple.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/purple.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/TV.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/tinkywinky_hl2mp/TV.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/ear.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/ear.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/face.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/face.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/plantar.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/plantar.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/red.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/red.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/TV.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/po_hl2mp/TV.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/ear.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/ear.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/face.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/face.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/plantar.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/plantar.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/TV.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/TV.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/yellow.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/laalaa_hl2mp/yellow.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/ear.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/ear.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/face.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/face.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/green.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/green.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/plantar.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/plantar.vtf" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/TV.vmt" ) Resource.AddSingleFile( "teletubbies_npc_player_v2/materials/models/player/dipsy_hl2mp/TV.vtf" ) Resource.AddSingleFile( "models/peterboi/masterchief/masterchief.mdl" ) Resource.AddSingleFile( "models/peterboi/masterchief/Master Chief Playermodel/models/peterboi/masterchief/masterchief.mdl" ) Resource.AddSingleFile( "models/peterboi/masterchief/Master Chief Playermodel/materials/models/peterboi/masterchief/Masterchief_Armor.vmt" ) Resource.AddSingleFile( "models/peterboi/masterchief/Master Chief Playermodel/materials/models/peterboi/masterchief/Masterchief_Armor.vtf" ) Resource.AddSingleFile( "models/peterboi/masterchief/Master Chief Playermodel/materials/models/peterboi/masterchief/Masterchief_Armor_normal.vtf" ) Resource.AddSingleFile( "models/peterboi/masterchief/Master Chief Playermodel/materials/models/peterboi/masterchief/Masterchief_Clothes.vmt" ) Resource.AddSingleFile( "models/peterboi/masterchief/Master Chief Playermodel/materials
[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.