So I'm using shadow's Deathrun gamemode and I tried to setup sounds, that play when a new round starts.
I edited the init.lua and put the following in:
[code]
local List = {}
List[1] = "track.mp3"
List[2] = "track1.mp3"
List[3] = "track2.mp3"
List[4] = "track3.mp3"
List[5] = "track4.mp3"
List[6] = "track5.mp3"
List[7] = "track6.mp3"
List[8] = "track7.mp3"
local function PlayMusic()
BroadcastLua('surface.PlaySound("'..List[math.random(1,#List)]..'")')
end
hook.Add("GM:OnPlayerSpawn", "SpawnMusic", PlayMusic)
[/code]
I added the local function and the hook at the very bottom and the list at the top.
Buuuuut it doesn't work. No errors it simply doesn't work :c
Take out the "GM:" in the hook name parameter.
Oh, forget to mention that I tried it without the "GM:".. Still didn't work
[QUOTE=JayTheSheep;41871860]Oh, forget to mention that I tried it without the "GM:".. Still didn't work[/QUOTE]
Is "OnPlayerSpawn" an actual hook in Deathrun? If not it should be "PlayerSpawn".
I wouldn't advise using a sound to play when a player spawns either because it will spam the sound for as many players there are on the server.
Sorry, you need to Log In to post a reply to this thread.