Karuzo Posted January 30, 2014 Share Posted January 30, 2014 (edited) Hey Guys, i have a radio panel with a few radio stations , ok , so what's the problem ? If i click on one radio station and than to another it plays the sound of the firt radio station too. So how can i handle this ? Code : addEventHandler("onClientGUIClick", root, function () if ( source == Radyobutton1 ) then sound1 = playSound( "****", false ) elseif ( source == Radyobutton2 ) then sound2 = playSound( "**", false ) elseif ( source == Radyobutton3 ) then sound3 = playSound( "***", false ) elseif ( source == Radyobutton4 ) then sound4 = playSound( "****", false ) elseif ( source == radkapat ) then if isElement(sound1) then destroyElement(sound1) end if isElement(sound2) then destroyElement(sound2) end if isElement(sound3) then destroyElement(sound3) end if isElement(sound4) then destroyElement(sound4) end end end ) -KRZO. Edited January 30, 2014 by Guest Link to comment
Bonsai Posted January 30, 2014 Share Posted January 30, 2014 Hey Guys,i have a radio panel with a few radio stations , ok , so what's the problem ? If i click on one radio station and than to another it plays the sound of the firt radio station too. So how can i handle this ? Code : addEventHandler("onClientGUIClick", root, function () if ( source == Radyobutton1 ) then sound1 = playSound( "****", false ) elseif ( source == Radyobutton2 ) then sound2 = playSound( "**", false ) elseif ( source == Radyobutton3 ) then sound3 = playSound( "***", false ) elseif ( source == Radyobutton4 ) then sound4 = playSound( "****", false ) elseif ( source == radkapat ) then if isElement(sound1) then destroyElement(sound1) end if isElement(sound2) then destroyElement(sound2) end if isElement(sound3) then destroyElement(sound3) end if isElement(sound4) then destroyElement(sound4) end end end ) -KRZO. I'm not sure how to stop sounds. If its done by destroyElement, then you just have to add something like this: elseif ( source == Radyobutton3 ) then sound3 = playSound( "***", false ) if isElement(sound1) then destroyElement(sound1) end if isElement(sound2) then destroyElement(sound2) end if isElement(sound4) then destroyElement(sound4) end Link to comment
pa3ck Posted January 30, 2014 Share Posted January 30, 2014 (edited) addEventHandler("onClientGUIClick", root, function () if ( source == Radyobutton1 ) then if isElement(sound) then stopSound(sound) end sound = playSound( "****", false ) elseif ( source == Radyobutton2 ) then if isElement(sound) then stopSound(sound) end sound = playSound( "**", false ) elseif ( source == Radyobutton3 ) then if isElement(sound) then stopSound(sound) end sound = playSound( "***", false ) elseif ( source == Radyobutton4 ) then if isElement(sound) then stopSound(sound) end sound = playSound( "****", false ) elseif ( source == radkapat ) then if isElement(sound) then stopSound(sound) end end end) Edited January 30, 2014 by Guest Link to comment
Karuzo Posted January 30, 2014 Author Share Posted January 30, 2014 lol, ye it worked . im so dumb... Thank you //Edit : pa3ck thank you , but i used bonsai's way Link to comment
pa3ck Posted January 30, 2014 Share Posted January 30, 2014 Okay, both of them do the same thing, mine is just shorter and easier, handier. 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