FSXTim Posted May 22, 2012 Share Posted May 22, 2012 Hello, the script doesn't set the volume of the running songs to '0', what's wrong? addEventHandler ( "playTheSound2", root, function () local sounds = getElementsByType ( "sound" ) setSoundVolume ( sounds, 0 ) song = playSound ( "music/party.mp3", false ) setSoundVolume ( song, 2 ) end ) I hope you can help me. Greets Link to comment
myonlake Posted May 22, 2012 Share Posted May 22, 2012 addEventHandler("playTheSound2", root, function() for i,v in ipairs(getElementsByType("sound")) do setSoundVolume(v, 0.0) end song = playSound("music/party.mp3", false) setSoundVolume(song, 1.0) end ) Link to comment
FSXTim Posted May 22, 2012 Author Share Posted May 22, 2012 Thanks, that works! Greets Link to comment
Kenix Posted May 22, 2012 Share Posted May 22, 2012 (edited) getElementsByType - return table with elements. In your case it's sounds elements. Edited May 22, 2012 by Guest Link to comment
FSXTim Posted May 22, 2012 Author Share Posted May 22, 2012 Okay, I see, thank you! Greets 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