Carbonik Posted November 9, 2010 Share Posted November 9, 2010 Hi i have problem, who can give me function to play sound when i use bind and when i use again (OFF function) then sound stop play. Examle: I press "x" , function starts operation and play sound. I press again "x" for stop function operation and the sound stops playing I thought that onStart or something Link to comment
knash94 Posted November 9, 2010 Share Posted November 9, 2010 local sound = false function onClientPressX (key, keyState) if sound then destroyElement(sound) sound = false else sound = playSound("song.mp3") end end bindKey("X", "down", onClientPressX) Remember, this is a client side script and the sounds should be added into the meta. Link to comment
Discord Moderators Zango Posted November 9, 2010 Discord Moderators Share Posted November 9, 2010 you can also compensate the variable sound with isElement, I think Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now