Genius Posted June 28, 2012 Share Posted June 28, 2012 I have problem with register system 79:Bad argument "addEventHandler[Expected element at argument 2,got nil] function clientRegister(button, state) if button == "left" and state == "up" then local username = guiGetText(registerEdit) local password = guiGetText(registerEdit) if username and password then triggerServerEvent("register",localPlayer, username, password) end end end its 79 line: addEventHandler("onClientGUIClick", registerButton, clientRegister, false) Link to comment
Jaysds1 Posted June 28, 2012 Share Posted June 28, 2012 remove the false at the end, it's only needed for click event handlers. try this: function clientRegister(button, state) if button == "left" and state == "up" then local username = guiGetText(registerEdit) local password = guiGetText(registerEdit) if username~="" and password~="" then --check if there's a string it them triggerServerEvent("register",localPlayer, username, password) end end end addEventHandler("onClientGUIClick", registerButton, clientRegister) --false not needed Link to comment
Castillo Posted June 28, 2012 Share Posted June 28, 2012 getPropagated: A boolean representing whether the handler will be triggered if the event was propagated down or up the element tree (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to false will only be triggered if source == this). If you don't set that to "false", when you click on another GUI, it'll trigger that function. 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