'LinKin Posted March 22, 2014 Share Posted March 22, 2014 Hello, I've a GUI. Some checkbox to toggle on/off the sounds in-game. (For example when someone dies I play a .mp3) So, I was wondering how to toggle them off.. Maybe setting it's volume to 0 ? For example this situation: I'm playing a 1min long sound, at the beginning the player has it's checkbox unselected, so the sound will not be heard by him. But in the middle of the sound (sec 30) he selects this checkbox. So he would be hearing the sound at sec 30. I'm thinking about working with the volume.. hm, but maybe is there any other way? Thanks. Link to comment
Dealman Posted March 23, 2014 Share Posted March 23, 2014 Read about setSoundPosition. Link to comment
Noki Posted March 23, 2014 Share Posted March 23, 2014 Maybe just not play the sound...? Link to comment
WhoAmI Posted March 23, 2014 Share Posted March 23, 2014 Just start music sometime, f.e. onClientResourceStart and set his volume to 0. And put in your script such a thing local checkbox = (...) local sound = playSound (...) setSoundVolume ( sound, 0 ) addEventHandler ( "onClientGUIClick", checkbox, function ( ) if ( guiCheckBoxGetSelected ( checkbox ) ) then setSoundVolume ( sound, 1 ) else setSoundVolume ( sound, 0 ) end end, false ) 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