greenops011 Posted January 15, 2023 Share Posted January 15, 2023 (edited) So, I'm working on doing some scripting with the MDC in the oG open source scripts. what I'm trying to do is when the person clicks on a button, say, search database, it will play a sound effect, like https://on.soundcloud.com/ZygMG just wondering how I would go about doing that? Edited January 15, 2023 by greenops011 updated soundcloud link Link to comment
Mkl Posted January 15, 2023 Share Posted January 15, 2023 Hi, by using playSound inside onClientGUIClick event handler for this specific button. You'll have add your music to the resource and then find the part where this GUI window is scripted to add playSound function inside the existing event handler. Link to comment
greenops011 Posted January 16, 2023 Author Share Posted January 16, 2023 18 hours ago, Mkl said: Hi, by using playSound inside onClientGUIClick event handler for this specific button. You'll have add your music to the resource and then find the part where this GUI window is scripted to add playSound function inside the existing event handler. So, would something like this work? window.dialog.closeButton = guiCreateButton( 10, 60, width - 20, 40, "Close", false, window.dialog.window ) addEventHandler( "onClientGUIClick", window.dialog.closeButton, function () guiSetVisible( window.dialog.window, false ) destroyElement( window.dialog.window ) window.dialog = { } local sound = playSound("tap.wav") setSoundVolume(sound, 0.5) end , false ) end 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