Jump to content

onClientMouseWheel


Krom

Recommended Posts

Hello. There's such functon listed in MTA-Wiki, but an example is missed. Here's very common idea: when I scrool-up my wheel while keeping mouse at some GUI element (button if possible), I need some variable A to become A + 1, and when I scrool-down, A should become A - 1. If anyone ever saw that function working well, could you give me an example please? Thankyou!

Link to comment
addEventHandler("onClientMouseWheel",getRootElement(),function(direction) 
    if source==yourbutton then 
        -- up 
        if direction==1 then  
            yourvariable = yourvariable + 1 
            outputChatBox("Variable increased by one, new value: "..yourvariable) 
        -- down 
        elseif direction==-1 then 
            yourvariable = yourvariable - 1 
            outputChatBox("Variable decreased by one, new value: "..yourvariable) 
        end 
    end 
end) 

Link to comment

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