• Can't seem to make clients download my custom gamemode sounds
    21 replies, posted
I can hear the custom sounds of my gamemode in singleplayer, but when I start a multiplayer P2P session via steam, my friends nor myself can hear the sounds, though for some reason I can hear a few of them. I've tried using "resource.AddFile" and "resource.AddSingleFile" but to no success. cl_init file: resource.AddFile("sound/jump02.wav") resource.AddFile("sound/jump03.wav") resource.AddFile("sound/jump04.wav")
resouce.AddFile and resource.AddSingleFile are serverside the file must exist https://wiki.garrysmod.com/page/resource/AddFile details the use of these functions
I know for certain that the files exist and I tried to put them in the init.lua but that still didn't work.
Bump. This is a really annoying issue and I cant seem to find a fix anywhere
What is the file path of the file in which you have the resource.AddFiles?
I've tried putting them in multiple files (init.lua, cl_init.lua, shared.lua, "force_download.lua", but right now they're just in init.lua. Tried putting them at the start and inside the GM:PlayerConnect function. As for the actual .wavs, they're in mygamemode/content/sound
Okay first of all, that's not the file path I needed. Secondly, you shouldn't put them in the PlayerConnect function. You should put the AddFiles all in their own file, then use include("file") on the server.
whoops, sorry. I'm guessing you meant the force_download.lua filepath. It's in the same folder as the init.lua and cl_init, etc. Should it be in the sound folder?
I can hear the custom music now for some reason, but others still can't. This is really frustrating.
I've had this same problem with mine as well. I've resorted to just using gmod sounds. sounds: /myGamemode/content/sound lua: resource.AddFile("sound/custom_noise.wav") I've also tried resource.AddFile("myGamemode/sound/custom_noise.wav") resource.AddFile("custom_noise.wav") I think it's Garry's Mod.
Really? That can't be true unless it's a recent bug; that'd be ridiculous
It's not, there's just something neither of you are doing right. Please post the FULL path of all files involved. No one wants "the same place as <this file>," because that doesn't help if <this file> is also in the wrong place. Also post some code of your resource.AddFile stuff with everything that's surrounding them. Hooks, functions, conditionals, loops, everything. It can all make a big difference. Finally, make sure you and others are TRULY hearing the same thing. That means you clean up a bit and make sure you have the EXACT same files the clients you're testing with have. No left over sound files in your personal garrysmod/sound, and make sure your players have file downloading on.
I apologise for my amateurishness; I'm borderline new to Lua (and scripting in general) so I sometimes I just fail to see what it is that I'm doing incorrectly. Anyways, the file path for the sounds I want (from the "common" folder) is: common\GarrysMod\garrysmod\gamemodes\testgamemode\content\sound Screenshots of my code (init.lua and force_download.lua): https://files.facepunch.com/forum/upload/250290/4fb40e00-9b99-43b3-b3a8-f32dd0a7fe34/resource.addfiles.png https://files.facepunch.com/forum/upload/250290/d6f95de4-101a-4f9d-ac5f-e4276ad5e126/init.png
Try to add the sounds to the root of your server and test it
Try calling util.PrecacheSound after resource.AddFile and if that doesn't work then try changing it to mp3. Also check the console for errors on the clients that are not receiving it.
UPDATE: Somehow this seems to have solved itself at some point, oblivious to myself. It might have been because of this code I implemented last night. Thank you for all your help regardless! for k,v in pairs(file.Find("sound/*.wav","THIRDPARTY")) do resource.AddFile(v) end
Right now this is getting strange. Clients can hear some sounds I added a few days ago but cannot hear any of the new sounds.
Do you have any net based settings in your server.cfg like allow upload or download?
I'm hosting the server through steam; it's not a dedicated server. It's still bizaare though, one of my friends said they saw the server download sounds, then they could hear it, but now they cant download anymore. Some can't hear any custom sounds at all and they all have "Allow custom files from server" enabled.
Issue now seems to not be solely tied to sounds; models and fonts also don't seem to be downloaded. Is anyone else having this problem?
Bump Nothing's changed for days. Nobody can hear any sounds since and it's incredibly awkward and boring with silence.
Now people can't even hear sounds they could previously hear. I don't even know what's happening anymore.
Sorry, you need to Log In to post a reply to this thread.