• TTT Beginning Of Round Sounds
    0 replies, posted
Pretty much what I am trying to achieve here is that when the roles of the players are selected, if your a traitor then (these songs play) or if you are a detective (these songs play). But they play to each individual user. And not broadcast over the server. My issue is that It is detecting the songs, and the roles. But for instance I have 3 players online. Each one gets a different song. Well all three songs are broadcasted at one time to the to each player. Here is the code I have been working with: [CODE]if SERVER then AddCSLuaFile() return end -- Sounds played to the selected detectives. local SelectedDetectives = { "bormusic/detective/inspectorgadget.wav", "bormusic/detective/jamesbond.wav", "bormusic/detective/pinkpanther.wav" } -- Sounds played to the selected traitors. local SelectedTraitors = { "bormusic/traitor/mortalcombat.wav", "bormusic/traitor/smokeonthewater.wav" } -- Sounds played to the selected innocents. local SelectedInnocents = { "bormusic/innocent/copstheme.wav", "bormusic/innocent/drive.wav" } for k, v in pairs (SelectedDetectives) do resource.AddFile("sound/"..v) util.PrecacheSound("sound/"..v) end for k, v in pairs (SelectedTraitors) do resource.AddFile("sound/"..v) util.PrecacheSound("sound/"..v) end for k, v in pairs (SelectedInnocents) do resource.AddFile("sound/"..v) util.PrecacheSound("sound/"..v) end local function BeginRoundMusic(ply) if ply == IsDetective() then surface.PlaySound(SelectedDetectives[math.random(1, #SelectedDetectives)]) elseif ply == IsTraitor() then surface.PlaySound(SelectedTraitors[math.random(1, #SelectedTraitors)]) else surface.PlaySound(SelectedInnocents[math.random(1, #SelectedInnocents)]) end end hook.Add("TTTBeginRound", "BeginRoundMusic", BeginRoundMusic)[/CODE] [editline]13th August 2013[/editline] SOLVED
Sorry, you need to Log In to post a reply to this thread.