Simple Music Script Trouble

Over the past few weeks I’ve been trying my hardest to learn lua. Below is my first attempt at my own script. Problems are arising for me though. I’ve tested it within garrys mod and used the console to look for bugs. But my problem is that the sounds are not being called. Any help would be appreciated and I’m only really looking to be pointed in the right direction.

http://pastebin.com/nrahCqTA

Thanks for taking the time to read this post!

Try this:



function EndOfRoundMusic()
        local inno = Sound("dramatic.wav")
        local trait = Sound("dramatic.wav")
        local time = Sound("dramatic.wav")
        if client then
                if TTTEndRound == WIN_INNOCENT then
                        surface.PlaySound(inno)
                elseif TTTEndRound == WIN_TRAITOR then
                        surface.PlaySound(trait)
                elseif TTTEndRound == WIN_TIMELIMIT then
                        surface.PlaySound(time)
                end
        end
end

hook.Add ("TTTEndRound", "EndOfRoundMusic", EndOfRoundMusic)


Apologies for the late response. Still a no go. I’m extremely confused as to why it isn’t working. Maybe it is it’s position within autorun, might it have to be placed in the client folder? Gah! Thank you anyway kind stranger!

Here’s one I give away to help people learn: https://dl.dropboxusercontent.com/u/26074909/acecool_ttt_end_round.rar – Feel free to learn from it and use it! Your home-work goal: Create a shared file, with the list of songs. This way you can send a shorter amount of data to the client ( ie the win_type and the index of the song, instead of the full song name ).

Enjoy!

Here’s a kill notifier to learn from as well: https://dl.dropboxusercontent.com/u/26074909/acecool_ttt_kill_notifier.rar