brocky Posted May 31, 2018 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)
AJXB Posted May 31, 2018 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) ~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names. ~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.
brocky Posted May 31, 2018 Author 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
DNL291 Posted May 31, 2018 Posted May 31, 2018 (edited) local account = getAccount ( account, password ) logIn (source, account, password) Edited May 31, 2018 by DNL291 Please do not PM me with scripting related question nor support, use the forums instead.
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