• Help with sending Gamemode content
    1 replies, posted
Hi there, I'm currently having trouble getting gamemode content to download correctly on the client. For example, there are custom sounds in this gamemode that, although appearing to download when connecting to the server, are unable to be played on the client. If anyone has any help or pointers as to what I should do to get sounds working on the client I would really appreciate it. Gamemode Folder Setup: .../gamemodes/[I]gmName[/I]/content/sound/[I]gmName[/I]/round_start.mp3 .../gamemodes/[I]gmName[/I]/content/sound/[I]gmName[/I]/kill.mp3 [B]resources.lua[/B] [LUA] resource.AddFile("sound/gmName/round_start.mp3") SOUND = {} SOUND.roundStart = Sound("gmName/round_start.mp3") [/LUA] [B]init.lua[/B] [LUA] include("resources.lua") ... local function broadcastSound(msg) net.Start("net_playsound") net.WriteString(msg) net.Broadcast() end ... function ROUND:InRoundBegan() log("inround began") ROUND:Broadcast("In-Round Began") broadcastSound(SOUND.roundStart) // Play the starting sound end [/LUA] [B]cl_init.lua[/B] [LUA] net.Receive("net_playsound", function(len) surface.PlaySound(net.ReadString()) end) [/LUA] When this is ran and a round starts, the following is printed to the console on the client: [B]In-Round Began Create Stream Failed error 41 Failed to load sound "psycho\round_start.mp3", file probably missing from disk/repository T[/B] Is there a certain way the server needs to be setup in order for the gamemode to send sounds, or perhaps is a fastdl server necessary to test this? If so, are the sounds in the correct directory or should those be moved somewhere else? I'm not sure if this is more of a server problem or a coding problem, but either way if this bug can be sorted out I'd be very happy! If anyone has any help or suggestions please let me know.
I managed to fix the problem. It seems that when using [LUA]resource.AddFile(...)[/LUA] you start your paths at the server's garrysmod folder. It [B]does not[/B] start in the gamemode's content folder.
Sorry, you need to Log In to post a reply to this thread.