Jump to content

[SOLVED] bindKey does not seem to work with my GUI.


Recommended Posts

So I have tested that the key is bound and it is.. The issue is the key doesn't seem to log me in when I hit it. Any help would be great. This is also not throwing any errors at the debug so.

c_login.lua

function showRegister() 
    if not guiGetVisible(wdwAccount) then 
        guiSetVisible(wdwAccount, true) 
        guiSetInputEnabled(true) 
        showCursor(true, true) 
        bindKey("enter", "down", accRequest) 
    end 
end 
  
function hideRegister() 
    guiSetVisible(wdwAccount, false) 
    showCursor(false, false) 
    guiSetInputEnabled(false) 
    triggerEvent("showSpawnWindow", localPlayer) 
    unbindKey(localPlayer, "enter", "down", accRequest) 
end 
addEvent("hideLoginWindow", true) 
addEventHandler("hideLoginWindow", localPlayer, hideRegister) 
  
function accRequest(key, keyState) 
    local password = guiGetText(edtInfo) 
    triggerServerEvent("accLogReg", localPlayer, password) 
end 

Thanks in advance.

Edited by Guest
Link to comment

This is what I have, here are my two pieces of code. It keeps saying that argument 2 is nil.

addEventHandler("onClientGUIAccepted", edtInfo, 
    function() 
        local password = guiGetText(edtInfo) 
        triggerServerEvent("accLogReg", localPlayer, password) 
    end 
) 

function createRegister() 
    local screenW, screenH = guiGetScreenSize() 
    wdwAccount = guiCreateWindow((screenW - 378) / 2, (screenH - 109) / 2, 378, 109, "Register/Login", false) 
    guiWindowSetSizable(wdwAccount, false) 
    lblPassword = guiCreateLabel(10, 37, 102, 15, "Enter a Password", false, wdwAccount) 
    guiSetFont(lblPassword, "default-bold-small") 
    edtInfo = guiCreateEdit(127, 33, 240, 24, "", false, wdwAccount) 
    addEventHandler("onClientGUIAccepted", edtInfo, 
    guiEditSetMasked(edtInfo, true) 
    btnSubmit = guiCreateButton(112, 67, 153, 30, "Submit", false, wdwAccount) 
     
    --addEventHandler("onClientGUIClick", btnSubmit, accRequest, false) 
end 

Link to comment
function createRegister() 
    local screenW, screenH = guiGetScreenSize() 
    wdwAccount = guiCreateWindow((screenW - 378) / 2, (screenH - 109) / 2, 378, 109, "Register/Login", false) 
    guiWindowSetSizable(wdwAccount, false) 
    lblPassword = guiCreateLabel(10, 37, 102, 15, "Enter a Password", false, wdwAccount) 
    guiSetFont(lblPassword, "default-bold-small") 
    edtInfo = guiCreateEdit(127, 33, 240, 24, "", false, wdwAccount) 
    addEventHandler("onClientGUIAccepted", edtInfo, 
        function() 
            local password = guiGetText(edtInfo) 
            triggerServerEvent("accLogReg", localPlayer, password) 
        end 
    ) 
    guiEditSetMasked(edtInfo, true) 
    btnSubmit = guiCreateButton(112, 67, 153, 30, "Submit", false, wdwAccount) 
    
    --addEventHandler("onClientGUIClick", btnSubmit, accRequest, false) 
end 

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