#RooTs Posted March 5, 2016 Share Posted March 5, 2016 (edited) hello guys, is there any easier way to. so I can move the mouse in a certain place, and make a sound? dx line dxDrawImage ( botX+sizeX+417, 140, 150, 150, isMouseInPosition ( botX+sizeX+417, 140, 150, 150 ) and "icon/fu2.png" or "icon/fu1.png", 0, 0, 0, tocolor ( 255, 255, 255) ) position botX+sizeX+417, 140, 150, 150 my attempt function ClientMouseEnter (_,state) if painelAnim == true then if state == "down" then if isCursorOnElement (botX+sizeX+417, 140, 150, 150) then playSound(click) end end end end addEventHandler ("onClientMouseEnter", root, ClientMouseEnter) Edited March 7, 2016 by Guest Link to comment
MrDante Posted March 5, 2016 Share Posted March 5, 2016 hello guys, is there any easier way to. so I can move the mouse in a certain place, and make a sound?dx line dxDrawImage ( botX+sizeX+417, 140, 150, 150, isMouseInPosition ( botX+sizeX+417, 140, 150, 150 ) and "icon/fu2.png" or "icon/fu1.png", 0, 0, 0, tocolor ( 255, 255, 255) ) position botX+sizeX+417, 140, 150, 150 my attempt function ClientMouseEnter (_,state) if painelAnim == true then if state == "down" then if isCursorOnElement (botX+sizeX+417, 140, 150, 150) then playSound(click) end end end end addEventHandler ("onClientMouseEnter", root, ClientMouseEnter) no need to create a function for this, use the isCursorOnElement if in the very function dx if isCursorOnElement (botX+sizeX+417, 140, 150, 150) then playSound(click) else -- you can opt for it if you want to test stopSound(click) OBS: I have not tested, if not right tell me Link to comment
Mann56 Posted March 5, 2016 Share Posted March 5, 2016 OnClientMouseEnter only detects mouse over gui elements, not the dx ones, i myself tried it over dx, didn't work, make an invisible gui element behind the dx and then use the event... EDIT : Didn't see the above post while typing ^ Link to comment
#RooTs Posted March 5, 2016 Author Share Posted March 5, 2016 OnClientMouseEnter only detects mouse over gui elements, not the dx ones, i myself tried it over dx, didn't work, make an invisible gui element behind the dx and then use the event...EDIT : Didn't see the above post while typing ^ no other way? Link to comment
Mann56 Posted March 5, 2016 Share Posted March 5, 2016 hello guys, is there any easier way to. so I can move the mouse in a certain place, and make a sound?dx line dxDrawImage ( botX+sizeX+417, 140, 150, 150, isMouseInPosition ( botX+sizeX+417, 140, 150, 150 ) and "icon/fu2.png" or "icon/fu1.png", 0, 0, 0, tocolor ( 255, 255, 255) ) position botX+sizeX+417, 140, 150, 150 my attempt function ClientMouseEnter (_,state) if painelAnim == true then if state == "down" then if isCursorOnElement (botX+sizeX+417, 140, 150, 150) then playSound(click) end end end end addEventHandler ("onClientMouseEnter", root, ClientMouseEnter) no need to create a function for this, use the isCursorOnElement if in the very function dx if isCursorOnElement (botX+sizeX+417, 140, 150, 150) then playSound(click) else -- you can opt for it if you want to test stopSound(click) OBS: I have not tested, if not right tell me Mr.Dante's will work... Link to comment
RenanPG Posted March 6, 2016 Share Posted March 6, 2016 https://wiki.multitheftauto.com/wiki/OnClientCursorMove https://wiki.multitheftauto.com/wiki/OnClientMouseMove Link to comment
#RooTs Posted March 6, 2016 Author Share Posted March 6, 2016 I tried this and it worked. but you have an error message... if isMouseInPosition ( botX+sizeX+420, botX2+sizeX2+100, 150, 150 ) then som = playSound(click) setTimer ( function() stopSound(som) end, 50, 1 ) dxDrawImage ( botX+sizeX+420, botX2+sizeX2+100, 150, 150,"icon/chat2.png", 0, 0, 0, tocolor ( 255, 255, 255) ) else dxDrawImage ( botX+sizeX+420, botX2+sizeX2+100, 150, 150,"icon/chat1.png", 0, 0, 0, tocolor ( 255, 255, 255) ) end WARNING: mod_panel\sourceC.lua:132: Bad argument @ 'stopSound' [Expected sound at argument 1] WARNING: mod_panel\sourceC.lua:132: Bad argument @ 'stopSound' [Expected sound at argument 1] WARNING: mod_panel\sourceC.lua:132: Bad argument @ 'stopSound' [Expected sound at argument 1] [DUB x10] WARNING: mod_panel\sourceC.lua:132: Bad argument @ 'stopSound' [Expected sound at argument 1] [DUB x5] is possible add the playSound within of render ??? Link to comment
MrDante Posted March 6, 2016 Share Posted March 6, 2016 I tried this and it worked. but you have an error message... if isMouseInPosition ( botX+sizeX+420, botX2+sizeX2+100, 150, 150 ) then som = playSound(click) setTimer ( function() stopSound(som) end, 50, 1 ) dxDrawImage ( botX+sizeX+420, botX2+sizeX2+100, 150, 150,"icon/chat2.png", 0, 0, 0, tocolor ( 255, 255, 255) ) else dxDrawImage ( botX+sizeX+420, botX2+sizeX2+100, 150, 150,"icon/chat1.png", 0, 0, 0, tocolor ( 255, 255, 255) ) end WARNING: mod_panel\sourceC.lua:132: Bad argument @ 'stopSound' [Expected sound at argument 1] WARNING: mod_panel\sourceC.lua:132: Bad argument @ 'stopSound' [Expected sound at argument 1] WARNING: mod_panel\sourceC.lua:132: Bad argument @ 'stopSound' [Expected sound at argument 1] [DUB x10] WARNING: mod_panel\sourceC.lua:132: Bad argument @ 'stopSound' [Expected sound at argument 1] [DUB x5] is possible add the playSound within of render ??? Stop Sound has to be the music of the variable, not the playsound if isMouseInPosition ( botX+sizeX+420, botX2+sizeX2+100, 150, 150 ) then playSound(click) setTimer ( function() stopSound(click) end, 50, 1 ) dxDrawImage ( botX+sizeX+420, botX2+sizeX2+100, 150, 150,"icon/chat2.png", 0, 0, 0, tocolor ( 255, 255, 255) ) else dxDrawImage ( botX+sizeX+420, botX2+sizeX2+100, 150, 150,"icon/chat1.png", 0, 0, 0, tocolor ( 255, 255, 255) ) end Link to comment
MrDante Posted March 6, 2016 Share Posted March 6, 2016 @MrDante, not worked Try To Make GUI Invisible then Link to comment
SpecT Posted March 6, 2016 Share Posted March 6, 2016 If it gives you this error then probably the sound did end ... soo before you try to stop the sound you should check if it isElement. sound = playSound(click) setTimer ( function() if isElement(sound) then stopSound(sound) end end, 50, 1 ) Link to comment
-Doc- Posted March 7, 2016 Share Posted March 7, 2016 I suggest you to take a look at dayz login panel it has what you want Link to comment
#RooTs Posted March 7, 2016 Author Share Posted March 7, 2016 If it gives you this error then probably the sound did end ... soo before you try to stop the sound you should check if it isElement. sound = playSound(click) setTimer ( function() if isElement(sound) then stopSound(sound) end end, 50, 1 ) LOLL, worked. I was thinking it was not possible more with the cursor over an image and another. the sound is repeating endlessly. Link to comment
#RooTs Posted March 7, 2016 Author Share Posted March 7, 2016 solved, thanks @toni012899 Link to comment
SpecT Posted March 7, 2016 Share Posted March 7, 2016 solved, thanks @toni012899 You are welcome! 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