Vanlot Posted July 7, 2012 Posted July 7, 2012 I Have Problem in My Login Panel with the buttons exactly. Sorry Cause I Ask Much.I Hope That You Help Me. Client: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(87,90,559,465,"Login Panel",false) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Label[1] = guiCreateLabel(493,442,60,18,"By:Lavand",false,GUIEditor_Window[1]) GUIEditor_Edit[1] = guiCreateEdit(214,98,119,42,"",false,GUIEditor_Window[1]) GUIEditor_Edit[2] = guiCreateEdit(214,174,119,42,"",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(238,77,59,17,"Username:",false,GUIEditor_Window[1]) GUIEditor_Label[3] = guiCreateLabel(243,155,57,15,"PassWord:",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(31,96,93,39,"Login",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(32,179,93,39,"Register",false,GUIEditor_Window[1]) GUIEditor_Image[1] = guiCreateStaticImage(379,71,162,148,"images/mtalogo.png",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(31,238,513,200," Welcome To My World",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) guiSetVisible ( GUIEditor_Window[1], false ) local localPlayer = getLocalPlayer ( ) function windowHandler( ) local playername = getPlayerName(localPlayer) guiSetText(LoginUsername, "") guiSetText(EditRegisterUsername, "") guiSetText(LoginUsername, playername) guiSetText(EditRegisterUsername, playername) guiSetVisible ( GUIEditor_Window[1], true ) guiSetInputEnabled(true) showCursor ( true ) end function onClickBtn ( button, state ) if (source == GUIEditor_Button[1]) then triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) ) end end function onClickBtn2 ( button, state ) if (source == GUIEditor_Button[2]) then triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword)) end end function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible ( GUIEditor_Window[1], false ) showCursor ( false ) end addEvent( "hideLoginWindow", true ) addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow ) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], onClickBtn2, false ) Server: function onLogin ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. end end addEvent( "onLogin", true ) addEventHandler( "onLogin", getRootElement(), onLogin ) function onRegister ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else account = addAccount ( user, pass ) if (logIn ( player, account, pass ) == true) then triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end end end addEvent( "onRegister", true ) addEventHandler( "onRegister", getRootElement(), onRegister )
Vanlot Posted July 7, 2012 Author Posted July 7, 2012 When I Press Login they Say That the Pass/Username are wrong but it's correct (I'm Sure 100%) When I press Register They Say "Register/Login Error
TAPL Posted July 7, 2012 Posted July 7, 2012 You don't have Edit with name LoginUsername and LoginPassword and EditRegisterUsername and EditRegisterPassword you have only two Edit called GUIEditor_Edit[1] and GUIEditor_Edit[2] when you copy codes from other resource make sure you have fixed the variables name as you have in your code.
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