• resource.AddFile Issue
    24 replies, posted
Hello! Currently making a hud for my build server. And the hud is basicly complete now. But i wanted to make a change and remove text such as "Health" and replace it with icons insted. For example a heart for health... You get it. And i need a way so clients can download the png images for the hud and i heard that resource.AddFile does this. But when doing that it dosent let the client download the icons. Im using this method to get all the images in the "materials/mbhud/" folder: local mbhud_materials = "materials/mbhud/" local materials = file.Find( mbhud_materials .. "*", "GAME" ) for _, material in pairs( materials ) do resource.AddFile( mbhud_materials .. material ) end I even printed out the result and it should work normally. I tried simply using: resource.AddFile( "materials/mbhud/health.png" ) But it still refuses to download. No errors or anything is displayed in the console. What am i doing wrong here?
Make sure that in settings of your GMod you allow downloading files from server
Yeah sv_allowdownload is 1
No, there's a client conVar, check GMod settings and clock last tab
Yeah its set to allow all custom files from server.
Ok. File is in YourServerRoot/garrysmod/materials/mbhud/ ? Maybe try this resource.AddSingleFile For now I can't find exact problem, so I'm trying to ask more questions. Maybe someone will help you after.
sv_allowdownload is not for FastDL - you need a webserver and set your sv_downloadurl.
I do have a fastdl for my server. I check my downloads folder in but nothing shows up. I did also try the AddSingleFile but with no success.:(
Can you post your sv_downloadurl?
Will leak all my addons. i got private wip addons etc. But is it the fastdl thats spooking?
Unless you put all your Lua files onto your webserver, nothing will be "leaked".
The fastdl provided does this. nothing i can do
Of course you can, only put resource stuff (models, materials, fonts, sounds), and keep Lua away from it.
But where? im confused
On your fastdl, who is your host?
I'm not sure why a single specified file does not download, however I know from recent experience that resource.AddFile() and resource.AddSingleFile() dont seem to like you concatenating strings inside them I tore my hair out for hours trying to work out why some sound files weren't downloading for an addon I was making. When I joined my test server, I could even see in the loading progress that it was downloading the file, but I couldn't find it in my download folder. I did however worked if i used a local variable to concatenate the strings first. try this local mbhud_materials = "materials/mbhud/" local materials = file.Find( mbhud_materials .. "*", "GAME" ) for _, material in pairs( materials ) do local dl = mbhud_materials .. material resource.AddFile( dl ) end the single file that you tested with may not have downloaded if it was already in your local gmod files, thats the only thing I can think of there.
Tried your method but it didnt work sadly:/
Send me your server details I’ll connect and see if I download anything
145.239.234.65:27015 i really hope this dosent count as advertising
should be fine, it was a direct request for details
I can see that the hud materials are being downloaded while joining my server with this solution. But if i check the download folder and materials theres no mbhud folder or anything. If i rejoin my server it will try to download it again but nothing appears.
Yeh that's the issue I was seeing with the sounds I was trying to download. this is the exact code that I got to work for _, v in ipairs(file.Find("sound/ps2_taunts/*.*", "GAME")) do local taunt = "sound/ps2_taunts/" .. v resource.AddSingleFile(taunt) end
So i did this: resource.AddSingleFile("materials/mbhud/Memory.png") on a dedicated server insted of my real server. Worked out just fine on the dedicated server but it dosent on my server. Could this be because of the FastDL thats on my server? I really hope its not. :/
Hows the file structure of your fastdl? If it downloads from the server and not fastdl, I would suspect your fastdl is perhaps not quite set up right i have a folder on my webserver called fastdl (it's in the www root dir for my website). within that i have a folder per gamemode, and within there i have materials,model,sounds,maps etc so then my download url becomes "www.website.com/fastdl/<gamemode>"
Well it made a copy of all the addons in the addons folder and made it into and file extension. Cant remember what it was. And i used the sv_downloadurl thing on the fastdl web adress. But now after i disabled it i noticed that i don't really need a fastdl. I don't run a heavy darkrp server with a tons of playermodels etc. I run a sandbox build server. The loading time was the exact same without fastdl so i don't need it. Saved myself some bucks so i could increase the player slots :^).
Sorry, you need to Log In to post a reply to this thread.