MajdMTA Posted February 15, 2016 Share Posted February 15, 2016 Hello there i tried to make instead of clicking "Login" pressing enter it will be logged automatic. function clientSubmitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(loginEdit["Username"]) local password = guiGetText(loginEdit["Password"]) if username and password then triggerServerEvent("submitLogin",localPlayer, username, password) end end end addEventHandler("onClientGUIClick", loginButton["Main"], clientSubmitLogin, false) bindKey ( player, "enter", "down", clientSubmitLogin ) Link to comment
Rataj Posted February 15, 2016 Share Posted February 15, 2016 In client side you should not define player in function bindKey. Try to use it like this instead: bindKey("enter", "down", clientSubmitLogin) Also you need to edit condition in start of function, because it will not go through using it like this. Link to comment
Noki Posted February 17, 2016 Share Posted February 17, 2016 You're also checking for two states (parameters that were from the onClientGUIClick event). bindKey passes the key you hit (enter) and the state of that key (up or down). So, you will need to modify your original function to accommodate for this as well. Link to comment
KariiiM Posted February 17, 2016 Share Posted February 17, 2016 Btw bindKey ( player, "enter", "down", clientSubmitLogin ) You're using player outside the function plus not defined and after all it's client side and there's no player argument. 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