justn Posted March 14, 2014 Share Posted March 14, 2014 (edited) So the problem is, when the player clicks the button in the main_c.lua and if the player logged in successfully then the gui 'RegisterLogin_Window' will be closed and the cursor will be gone too main_s.lua: function loginPlayer(username,password) if not (username == "") then if not (password == "") then local account = getAccount ( username, password ) if ( account ~= false ) then logIn (source, account, password) exports["TopBarChat"]:sendClientMessage ("#0000FF* #FFFFFFYou have sucessfully logged in!",source,255,255,255,true) else exports["TopBarChat"]:sendClientMessage ("#0000FF* #FFFFFFError! Wrong username and/or password!",source,255,255,255,true) end end end end addEvent("onRequestLogin",true) addEventHandler("onRequestLogin",getRootElement(),loginPlayer) main_c.lua addEventHandler("onClientGUIClick",RegisterLogin_Window, function(b) if b == "left" then if source == LoginButton then username = guiGetText(LoginUsername) password = guiGetText(LoginPass) triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password) xmlFileHandler() end end end) Edited March 14, 2014 by Guest Link to comment
xXMADEXx Posted March 14, 2014 Share Posted March 14, 2014 -- server function loginPlayer(username,password) if not (username == "") then if not (password == "") then local account = getAccount ( username, password ) if ( account ~= false ) then logIn (source, account, password) exports["TopBarChat"]:sendClientMessage ("#0000FF* #FFFFFFYou have sucessfully logged in!",source,255,255,255,true) triggerClientEvent ( source, "onClientPlayerLoginFromServer", source ) else exports["TopBarChat"]:sendClientMessage ("#0000FF* #FFFFFFError! Wrong username and/or password!",source,255,255,255,true) end end end end addEvent("onRequestLogin",true) addEventHandler("onRequestLogin",getRootElement(),loginPlayer) -- client addEventHandler("onClientGUIClick",RegisterLogin_Window, function(b) if b == "left" then if source == LoginButton then username = guiGetText(LoginUsername) password = guiGetText(LoginPass) triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password) xmlFileHandler() end end end) addEvent("onClientPlayerLoginFromServer",true) addEventHandler("onClientPlayerLoginFromServer",root,function() showCursor ( false ) guiSetVisible ( theLoginWindow, false ) end ) 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