brocky Posted May 31, 2018 Share Posted May 31, 2018 My login button doesn't works. local window1 = guiCreateWindow(455, 178, 710, 532, "", false) guiWindowSetSizable(window1, false) local editUsername = guiCreateEdit(167, 108, 361, 40, "", false, window1) local editPassword = guiCreateEdit(170, 197, 358, 36, "", false, window1) btnLogin = guiCreateButton(9, 434, 691, 43, "Login", false, window1) btnClose = guiCreateButton(14, 486, 686, 36, "Close", false, window1) guiSetVisible(window1, true) showCursor(true) function closeGui() if btnClose == source then guiSetVisible(window1, false) showCursor(false) end end addEventHandler("onClientGUIClick", btnClose, closeGui, false) function logToServer() account = guiGetText(editUsername) password = guiGetText(editPassword) local name = getPlayerName(getLocalPlayer()) triggerServerEvent("test", localPlayer, account, password, name) end addEventHandler("onClientGUIClick", btnLogin, logToServer, false) server side function myMoney(account, password, name) logIn (source, account, password) end addEvent("test", true) addEventHandler("test", getRootElement(), myMoney) Link to comment
AJXB Posted May 31, 2018 Share Posted May 31, 2018 Try this: -- Client window1 = guiCreateWindow(455, 178, 710, 532, "", false) editUsername = guiCreateEdit(167, 108, 361, 40, "", false, window1) editPassword = guiCreateEdit(170, 197, 358, 36, "", false, window1) btnLogin = guiCreateButton(9, 434, 691, 43, "Login", false, window1) btnClose = guiCreateButton(14, 486, 686, 36, "Close", false, window1) guiSetVisible(window1, true) showCursor(true) guiWindowSetSizable(window1, false) function closeGui() if btnClose == source then guiSetVisible(window1, false) showCursor(false) end end addEventHandler("onClientGUIClick", root, closeGui) -- changed "root" function logToServer() if (source == btnLogin) then -- Check button clicked local account = guiGetText(editUsername) local password = guiGetText(editPassword) local name = getPlayerName(getLocalPlayer()) triggerServerEvent("test", localPlayer, account, password, name) end end addEventHandler("onClientGUIClick", root, logToServer) -- changed "root" -- Server function myMoney(account, password, name) outputChatBox(name); logIn (source, account, password) end addEvent("test", true) addEventHandler("test", root, myMoney) Link to comment
brocky Posted May 31, 2018 Author Share Posted May 31, 2018 (edited) It doesn't works, it only displays the result of line 33. The player doesn't logs in Bad argument at logIn [expected account, got string] Edited May 31, 2018 by brocky Link to comment
DNL291 Posted May 31, 2018 Share Posted May 31, 2018 (edited) local account = getAccount ( account, password ) logIn (source, account, password) Edited May 31, 2018 by DNL291 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