Jump to content

A small problem.


MajdMTA

Recommended Posts

Posted

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 ) 

Posted

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.

Posted

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.

Posted

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.

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