IIIIlllllIII Posted December 13, 2011 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 http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
top sniper Posted December 13, 2011 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 ================================================================== ~|منٌ رأيّتُموِۂ يّعتُدُيّ على عرض فُتُٱة مؤمنٌة فُٱسًحًقَوِوِوِوِوِوِوِة|~ ==================================================================
top sniper Posted December 13, 2011 Posted December 13, 2011 use this addEventHandler("onClientMouseMove", getRootElement(), function() if source == Button then stopSound("sot.mp3") end end ) ================================================================== ~|منٌ رأيّتُموِۂ يّعتُدُيّ على عرض فُتُٱة مؤمنٌة فُٱسًحًقَوِوِوِوِوِوِوِة|~ ==================================================================
Evil-Cod3r Posted December 13, 2011 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 My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
Evil-Cod3r Posted December 13, 2011 Posted December 13, 2011 use this addEventHandler("onClientMouseMove", getRootElement(), function() if source == Button then stopSound("sot.mp3") end end ) where is the event ?? My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
TAPL Posted December 13, 2011 Posted December 13, 2011 addEventHandler("onClientMouseMove", root, function() if (source == Button) then playSound("sot.mp3",false) end end)
top sniper Posted December 13, 2011 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 ================================================================== ~|منٌ رأيّتُموِۂ يّعتُدُيّ على عرض فُتُٱة مؤمنٌة فُٱسًحًقَوِوِوِوِوِوِوِة|~ ==================================================================
TAPL Posted December 13, 2011 Posted December 13, 2011 what? lol you both get out noobs where is the event? wtf the event is there addEventHandler("onClientMouseMove", getRootElement(), function()
myonlake Posted December 13, 2011 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 If I helped you, please click the like button on the right Thanks!
50p Posted December 13, 2011 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) - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
12p Posted December 13, 2011 Posted December 13, 2011 That will be triggered for any GUI element. addEventHandler("onClientMouseEnter", Button, function() playSound("sot.mp3"); end)
IIIIlllllIII Posted December 13, 2011 Author 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 http://mojrm511.x10.mx msn: [email protected] my server ip: 176.9.40.71:22779 -------------------------------------- 2012 updated--------
50p Posted December 13, 2011 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. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
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