Erlkonig Posted November 22, 2020 Share Posted November 22, 2020 (edited) 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 November 22, 2020 by Erlkonig Link to comment
Tekken Posted November 22, 2020 Share Posted November 22, 2020 addEventHandler("onClientGUIClick", resourceRoot, function() if source == ctrl[1] then -- do something elseif source == ctrl[2] then -- do something else --etc... end end, false) 1 Link to comment
Erlkonig Posted November 22, 2020 Author Share Posted November 22, 2020 3 minutes ago, Tekken said: addEventHandler("onClientGUIClick", resourceRoot, function() if source == ctrl[1] then -- do something elseif source == ctrl[2] then -- do something else --etc... end end, false) Sure! Thank you! 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