Jump to content

detect click/trigger an event.


Stevenn

Recommended Posts

Hello, i got another problem, if I click on a button, it wont trigger my event and I have no idea..

function buttonClick( button) 
        if (button) ~= "left" then return end 
        if ( source ==  lol ) then 
        showCursor ( false ) 
    elseif ( source == button ) then 
        triggerEvent ( "MyEvent", localPlayer ) 
end 
end 
addEventHandler("onClientGUIClick", resourceRoot, buttonClick, true) 

Link to comment

button parameter is the name of the mouse button that the GUI element was clicked with, can be left, right, or middle.

also resourceRoot may not work try use root

if didn't work then show the rest code.

Link to comment

So in another words.

function buttonClick(button, state, x, y) 
    if (button) ~= "left" then return end 
    if (source == lol) then 
        showCursor(false) 
    elseif (source == button) then 
        triggerEvent("MyEvent", localPlayer) 
    end 
end 
addEventHandler("onClientGUIClick", root, buttonClick, false) 

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