Saml1er Posted November 8, 2013 Share Posted November 8, 2013 When ever I add this line if button == "left" and state == "up" then then my gui window is hidden. I've no idea what's causing this. function loginwindow() showChat(false) showCursor(true) m_window = guiCreateWindow(0.63, 0.01, 0.37, 0.46, "Login panel", true) guiWindowSetMovable(m_window, false) guiWindowSetSizable(m_window, false) guiSetAlpha(m_window, 1.00) m_button1 = guiCreateButton(15, 103, 263, 22, "LOGIN", false, m_window) m_edit1 = guiCreateEdit(78, 178, 200, 20, "", false, m_window) m_edit2 = guiCreateEdit(78, 202, 200, 20, "", false, m_window) guiSetVisible(m_window, true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () loginwindow() end addEventHandler( "onClientGUIClick", root, function (button, state) if button == "left" and state == "down" then if ( source == m_button1 ) then local username = guiGetText(m_edit1) local password = guiGetText(m_edit2) if username and password then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password) guiSetVisible(m_window, true) end end ) Link to comment
TAPL Posted November 8, 2013 Share Posted November 8, 2013 showChat(false) showCursor(true) m_window = guiCreateWindow(0.63, 0.01, 0.37, 0.46, "Login panel", true) guiWindowSetMovable(m_window, false) guiWindowSetSizable(m_window, false) guiSetAlpha(m_window, 1.00) m_button1 = guiCreateButton(15, 103, 263, 22, "LOGIN", false, m_window) m_edit1 = guiCreateEdit(78, 178, 200, 20, "", false, m_window) m_edit2 = guiCreateEdit(78, 202, 200, 20, "", false, m_window) addEventHandler("onClientGUIClick", root, function (button, state) if button == "left" and state == "up" then if (source == m_button1) then local username = guiGetText(m_edit1) local password = guiGetText(m_edit2) if username and password and username ~= "" and password ~= "" then triggerServerEvent("onRequestLogin", localPlayer, username, password) guiSetVisible(m_window, false) end end end end) Link to comment
Saml1er Posted November 9, 2013 Author Share Posted November 9, 2013 Oh my pancreas, I should've think about this earlier and I like it if username and password and username ~= "" and password ~= "" then Thanks mate. 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