Jump to content

onClientMouseMove


IIIIlllllIII

Recommended Posts

Posted

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 8)

Posted (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 by Guest
Posted
addEventHandler("onClientMouseMove", root, function() 
if (source == Button) then 
     playSound("sot.mp3",false) 
     end 
end) 

Posted

what? lol

you both get out noobs

where is the event? wtf

the event is there

addEventHandler("onClientMouseMove", getRootElement(), function() 

Posted
what? lol

you 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

Posted

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) 

Posted

That will be triggered for any GUI element.

addEventHandler("onClientMouseEnter", Button, function() 
    playSound("sot.mp3"); 
end) 

Posted
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

Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...