TheGamingMann Posted May 19, 2014 Share Posted May 19, 2014 (edited) 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 May 19, 2014 by Guest Link to comment
TAPL Posted May 19, 2014 Share Posted May 19, 2014 You don't need bindKey, you need this event: https://wiki.multitheftauto.com/wiki/OnClientGUIAccepted Link to comment
TheGamingMann Posted May 19, 2014 Author Share Posted May 19, 2014 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
TAPL Posted May 19, 2014 Share Posted May 19, 2014 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
TheGamingMann Posted May 19, 2014 Author Share Posted May 19, 2014 Thanks TAPL. It works. I thought I tried that before the post.. Odd. But thanks again man. 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