IIIIlllllIII Posted December 13, 2011 Share Posted December 13, 2011 hi how i make the sound playing for 1 time when i move the mouse on gui button or gui window i want when i move the mouse on button the sound play for 1 time not replay agine this the code =================================================== addEventHandler("onClientMouseMove", getRootElement(), function() if source == Button then playSound("sot.mp3") end end ) ================================================ the problem when i move the mouse on button the sound replay agine on the button when i select the button how i stop the sound without replay agine on the button i hope you understand me Link to comment
top sniper Posted December 13, 2011 Share Posted December 13, 2011 (edited) tell the other members to help you .. but when you post code please use lua code viewer . use this Edited December 13, 2011 by Guest Link to comment
top sniper Posted December 13, 2011 Share Posted December 13, 2011 use this addEventHandler("onClientMouseMove", getRootElement(), function() if source == Button then stopSound("sot.mp3") end end ) Link to comment
Evil-Cod3r Posted December 13, 2011 Share Posted December 13, 2011 (edited) function play () if source == Button then local me = playSound("sot.mp3") setSoundVolume(me, 0.-- s8) --> end addEventHandler( "onClientMouseMove", getRootElement( ), play) function stop () if source == Button then stopSound("me") end addEventHandler("onClientMouseLeave", getRootElement(), stop) Edited December 13, 2011 by Guest Link to comment
Evil-Cod3r Posted December 13, 2011 Share Posted December 13, 2011 use this addEventHandler("onClientMouseMove", getRootElement(), function() if source == Button then stopSound("sot.mp3") end end ) where is the event ?? Link to comment
TAPL Posted December 13, 2011 Share Posted December 13, 2011 addEventHandler("onClientMouseMove", root, function() if (source == Button) then playSound("sot.mp3",false) end end) Link to comment
top sniper Posted December 13, 2011 Share Posted December 13, 2011 use this addEventHandler("onClientMouseMove", getRootElement(), function() if source == Button then stopSound("sot.mp3") end end ) where is the event ?? i don't know Link to comment
TAPL Posted December 13, 2011 Share Posted December 13, 2011 what? lol you both get out noobs where is the event? wtf the event is there addEventHandler("onClientMouseMove", getRootElement(), function() Link to comment
myonlake Posted December 13, 2011 Share Posted December 13, 2011 what? lolyou both get out noobs where is the event? wtf the event is there addEventHandler("onClientMouseMove", getRootElement(), function() Exactly, I thought about the same thing that what the hell are they talking about :3 Link to comment
50p Posted December 13, 2011 Share Posted December 13, 2011 Since the event is triggered every time mouse moves over the GUI element. I suggest you use onClientMouseEnter instead which is triggered only when mouse enters the gui element bounding box. That is: addEventHandler("onClientMouseEnter", root, function() playSound("sot.mp3"); end) Link to comment
12p Posted December 13, 2011 Share Posted December 13, 2011 That will be triggered for any GUI element. addEventHandler("onClientMouseEnter", Button, function() playSound("sot.mp3"); end) Link to comment
IIIIlllllIII Posted December 13, 2011 Author Share Posted December 13, 2011 Since the event is triggered every time mouse moves over the GUI element. I suggest you use onClientMouseEnter instead which is triggered only when mouse enters the gui element bounding box.That is: addEventHandler("onClientMouseEnter", root, function() playSound("sot.mp3"); end) 50p Wow thanks you works great Link to comment
50p Posted December 13, 2011 Share Posted December 13, 2011 That will be triggered for any GUI element. addEventHandler("onClientMouseEnter", Button, function() playSound("sot.mp3"); end) Yes, isn't that what author of the topic wanted? MOJRM-511, you're welcome. Have fun scripting and don't hesitate to ask here or IRC. 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