Wei Posted May 19, 2012 Share Posted May 19, 2012 it say that is event not added to the serverside. Client function clientSubmitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(loginEdit["Username"]) local password = guiGetText(loginEdit["Password"]) if username and password then triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) end end end addEventHandler("onClientGUIClick", loginButton["Main"], clientSubmitLogin, false) function clientSubmitRegister(button, state) if button == "left" and state == "up" then local username = guiGetText(registerEdit["Username"]) local password = guiGetText(registerEdit["Password"]) if username and password then triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password) end end end addEventHandler("onClientGUIClick", registerButton["Main"], clientSubmitRegister, false) Server addEvent("submitLogin", true) addEvent("submitRegister", true) function loginHandler(player, username, password) local account = getAccount(username, password) if (account ~= false) then if (logIn(player, account, password) == true) then triggerClientEvent (player, "hideLoginWindow", getRootElement()) end end end addEventHandler("submitLogin", root, loginHandler) function registerHandler(player, username, password) local account = getAccount(username, password) if (account ~= false) then outputChatBox( "", root, 255, 255, 255 ) else account = addAccount(username, password) if (logIn(player, account, password) == true) then triggerClientEvent(player, "hideRegisterWindow", getRootElement()) end end end addEventHandler("submitRegister", root, registerHandler) Link to comment
Jaysds1 Posted May 19, 2012 Share Posted May 19, 2012 I didn't see anything wrong but try this, Client: function clientSubmitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(loginEdit["Username"]) local password = guiGetText(loginEdit["Password"]) if username and password then triggerServerEvent("submitLogin",localPlayer, username, password) end end end addEventHandler("onClientGUIClick", loginButton["Main"], clientSubmitLogin, false) function clientSubmitRegister(button, state) if button == "left" and state == "up" then local username = guiGetText(registerEdit["Username"]) local password = guiGetText(registerEdit["Password"]) if username and password then triggerServerEvent("submitRegister",localPlayer, username, password) end end end addEventHandler("onClientGUIClick", registerButton["Main"], clientSubmitRegister, false) Link to comment
Wei Posted May 20, 2012 Author Share Posted May 20, 2012 damn I'm noob. I fogot to add server.lua into it. Thanks KENIX !! Link to comment
Wei Posted May 20, 2012 Author Share Posted May 20, 2012 now the error is: [2012-05-20 10:24:57] WARNING: duu\server.lua:19: Bad argument @ 'addAccount' [Expected string at argument 2, got nil] [2012-05-20 10:24:57] WARNING: duu\server.lua:20: Bad argument @ 'logIn' [Expected player at argument 1, got string 'lowa'] I tryed to register as lowa Link to comment
Alpha Posted May 20, 2012 Share Posted May 20, 2012 Server: addEvent("submitLogin", true) addEvent("submitRegister", true) function loginHandler(username, password) local account = getAccount(username, password) if (account ~= false) then if (logIn(source, account, password) == true) then triggerClientEvent (source, "hideLoginWindow", source) end end end addEventHandler("submitLogin", root, loginHandler) function registerHandler(username, password) local account = getAccount(username, password) if (account ~= false) then outputChatBox( "", root, 255, 255, 255 ) else account = addAccount(username, password) if (logIn(source, account, password) == true) then triggerClientEvent(source, "hideRegisterWindow", getRootElement()) end end end addEventHandler("submitRegister", root, registerHandler) 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