Hi everyone, I was wondering, What functions would I use to have like randomly, or at a certian time, some of the Combine Overwatch voice play through out the map?
[lua]
--init.lua
timer.Create("EmitSound",math.random(50,80),0,function()
for _,v in pairs(player.GetAll()) do
umsg.Start("emitSound",v)
umsg.String(-Put your sound here-)
umsg.End()
end
end)
--cl_init.lua
usermessage.Hook("emitSound",function(msg)
surface.PlaySound(msg:ReadString())
end)
[/lua]
So you would just like throw this into a Gamemodes Cl_init and Init and it should randomly everynow and thne play?
should, yes.
Just to make sure, I put [lua]umsg.String(-Put your sound here-)[/lua] In Parenthesis right?
In quotations, it's a string, it's a filepath so it requires "soundpath/here" type crap.
Thats what I thought, So how often does it play? Just random?
Random between 50 and 80 seconds.
Sorry, you need to Log In to post a reply to this thread.