Jump to content

A small problem.


MajdMTA

Recommended Posts

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

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

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