Jump to content

[HELP] A few buttons in function


Erlkonig

Recommended Posts

Hello, I have a similar functions which activated when the client clicked on the button. Now Im calling they like different functions.

 

addEventHandler("onClientGUIClick", ctrl[1], setCtrl1, false)
addEventHandler("onClientGUIClick", ctrl[2], setCtrl2, false)
addEventHandler("onClientGUIClick", ctrl[3], setCtrl3, false)

 

I want to call one function when I push the different buttons

addEventHandler("onClientGUIClick", ctrl[1], setCtrl, false)
addEventHandler("onClientGUIClick", ctrl[2], setCtrl, false)
addEventHandler("onClientGUIClick", ctrl[3], setCtrl, false)

But also I want to do this with a different actions in function. Unfortunely, I did not found the way how can I check the button which clicked. 

Im planing to do something like this:

-- This just an example

function()

    if ctrl[1] then
      --do something
    elseif ctrl[2] then
      --do anything
    elseif ctrl[3] then
      --do this but it actually looks like previous
    end

end

addEventHandler("onClientGUIClick", ctrl[1], setCtrl, false)
addEventHandler("onClientGUIClick", ctrl[2], setCtrl, false)
addEventHandler("onClientGUIClick", ctrl[3], setCtrl, false)

 

Edited by Erlkonig
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...