I have this lua code in ‘./garrysmod/lua/autorun/’ folder for my server:
-- You can add up to 3 sounds for this. Add or delete resource.addfile as you need
resource.AddFile("sound/cakeisgone.mp3")
-- Remember to change the name of the sounds to the sound you want from above
function PlayMusic(wintype)
BroadcastLua('surface.PlaySound("cakeisgone.mp3")')
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)
Every time I join my server it downloads cakeisgone.mp3 and then I can’t find it anywhere in MY garrysmod files.
Why won’t it download properly and reuse it?
Then I go into to my server and after the round ends, no music it played and in the console it says it can’t find the cakeisgone.mp3.
I think the problem is that it cannot download the file? Any ideas would help! Thanks.
I did a look up of FastDL:
So what I did was I didn’t realize that I had a site already set up with my host and was already set up in the server.cfg file. Added cakeisgone.mp3 to a folder called sound on the site and now it downloads the song and doesn’t ask for it again
But it still doesn’t play the song and say the same error again above in picture 2.
Then put this
[lua]
local function PlayMusic(wintype)
– Play sounds when a team wins
if wintype != WIN_TRAITOR then
BroadcastLua(‘surface.PlaySound(“sound/cakeisgone.mp3”)’)
else
BroadcastLua(‘surface.PlaySound(“sound/cakeisgone.mp3”)’)
end
end
hook.Add(“TTTEndRound”, “MyMusic”, PlayMusic)
[/lua]
I might be totally misreading the problem here though…