As the thread title suggest, I'm getting the "Failed to load sound" error when I try call :EmitSound()
Clients are downloading the files when they join the server, but the error persists.
sv_taunt.lua (included only on server)
[lua]
for _, taunt in pairs(ph.HUNTER_TAUNTS) do resource.AddSingleFile("sound/"..taunt) end
for _, taunt in pairs(ph.PROP_TAUNTS) do resource.AddSingleFile("sound/"..taunt) end
// Precache taunt sounds when player enters the server.
// Called on GM:PlayerInitialSpawn
ph.initTaunt = function(pl)
for _, taunt in pairs(ph.HUNTER_TAUNTS) do
pl:SendLua('util.PrecacheSound("' .. taunt .. '")')
end
for _, taunt in pairs(ph.PROP_TAUNTS) do
pl:SendLua('util.PrecacheSound("' .. taunt .. '")')
end
end
// Play a taunt.
ph.playerTaunt = function(pl)
if !GAMEMODE:InRound() then return end
if !pl:IsPlayer() then return end
if !pl:Alive() then return end
if !(pl:Team() == ph.TEAM_HUNTERS or pl:Team() == ph.TEAM_PROPS) then return end
if pl.m_lastTauntTime + ph.TAUNT_DELAY <= CurTime() then
local tauntSnd
if pl:Team() == ph.TEAM_HUNTERS then
tauntSnd = table.Random(ph.HUNTER_TAUNTS)
elseif pl:Team() == ph.TEAM_PROPS then
tauntSnd = table.Random(ph.PROP_TAUNTS)
else return end
pl.m_lastTauntTime = CurTime()
pl:EmitSound(tauntSnd, 100, 100) // Errors clients with "Failed to load sound"
end
end
[/lua]
ph.HUNTER_TAUNTS and ph.PROP_TAUNTS are tables of strings, the strings being paths to the file names relative to the sound directory.
I'm pretty lost here, and I feel like I've tried everything.
And while I'm making a thread here, is the way I'm precaching sounds when players join acceptable? I feel like sending a bunch of Lua strings when a player joins is kind of hacky.
Thanks in advance.
Any help on this one? I still can't wrap my head around it.
Clients are downloading the files off of the server, but they still get the error;
[code]
Failed to load sound "taunts\hunter\15.wav", file probably missing from disk/repository
[/code]
Sorry, you need to Log In to post a reply to this thread.