• Timed Sound Script
    3 replies, posted
Hey there, So I made a sound for my server. (simple background tannoy noise whilst on board a ship) and I've been trying to look for a solution to have this sound play at random intervals or at a certain amount of time. Let's say every twenty minutes or so. Do you have any recommendations on how I could do this? I'm also interested in finding out if there is a way to force a bind server side to all players, or would I have to create a script
[CODE] local PlayNextSound = CurTime() + 500 hook.Add("Think", "Playambients", function() if CurTime() >= PlayNextSound then surface.PlaySound( linktoyourfile ) PlayNextSound = CurTime() + math.random( 500, 2500 ) end end) [/CODE] the numbers are in seconds.
[QUOTE=Obey_;52082454]I'm also interested in finding out if there is a way to force a bind server side to all players, or would I have to create a script[/QUOTE] You are not able to bind players keys as it could be done maliciously.
[QUOTE=Obey_;52082454] I'm also interested in finding out if there is a way to force a bind server side to all players, or would I have to create a script[/QUOTE] You're able to make your own sorta binds by grabbing key inputs and then calling a function or functions. Ex (Client): [code] if input.IsKeyDown(KEY_F) then print("hello w-aids") end [/code] See: ply:KeyPressed() for a server equivalent. I'm sure there's other ways but I can't think of them off of the top of my head. Maybe a lua equivalent for cmd->buttons.
Sorry, you need to Log In to post a reply to this thread.