Chris!i! Posted August 23, 2014 Share Posted August 23, 2014 -Client GUIEditor = { tab = {}, tabpanel = {}, edit = {}, button = {}, window = {}, label = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(321, 107, 626, 612, "GTs Login or Register Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 312, 607, 290, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Updates", GUIEditor.tabpanel[1]) GUIEditor.memo[1] = guiCreateMemo(10, 10, 582, 241, "", false, GUIEditor.tab[1]) GUIEditor.button[1] = guiCreateButton(9, 142, 121, 61, "Login", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(194, 142, 121, 61, "Register", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(11, 30, 96, 34, "UserName : ", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(11, 92, 96, 34, "Password : ", false, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(125, 30, 161, 38, "", false, GUIEditor.window[1]) GUIEditor.edit[2] = guiCreateEdit(125, 88, 161, 38, "", false, GUIEditor.window[1]) end ) local localPlayer = getLocalPlayer ( ) function windowHandler( ) local playername = getPlayerName(localPlayer) guiSetText(GUIEditor.edit[1], "") guiSetText(GUIEditor.edit[2], "") guiSetText(GUIEditor.edit[1], playername) guiSetText(GUIEditor.edit[2], playername) guiSetVisible ( GUIEditor.window[1], true ) guiSetInputEnabled(true) showCursor ( true ) end function login ( button, state ) if (source == GUIEditor.button[1]) then triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(GUIEditor.edit[1]), guiGetText(GUIEditor.edit[2]) ) end end function register ( button, state ) if (source == GUIEditor.button[2]) then triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(GUIEditor.edit[1]), guiGetText(GUIEditor.edit[2])) 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], login, false ) addEventHandler ( "onClientGUIClick", GUIEditor.button[2], register, 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 ) end else outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) 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 ) 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 ) end end end addEvent( "onRegister", true ) addEventHandler( "onRegister", getRootElement(), onRegister ) Help me with that login panel i can not login either register and in debugscript 3 there is no errors i fixed them all ! Link to comment
Anubhav Posted August 23, 2014 Share Posted August 23, 2014 function onLogin ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then logIn ( player, account, pass ) triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) end end addEvent( "onLogin", true ) addEventHandler( "onLogin", getRootElement(), onLogin ) function onRegister ( player, user, pass ) local account = getAccount ( user, pass ) if ( account == false ) then account = addAccount ( user, pass ) logIn ( player, account, pass ) triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) end end addEvent( "onRegister", true ) addEventHandler( "onRegister", getRootElement(), onRegister ) Link to comment
Chris!i! Posted August 23, 2014 Author Share Posted August 23, 2014 Debug script 3 : line 75,74 Expected element at argument 2,got nil Link to comment
Anubhav Posted August 23, 2014 Share Posted August 23, 2014 Which are those lines in this script? Link to comment
roaddog Posted August 23, 2014 Share Posted August 23, 2014 Replace your client side with this GUIEditor = { tab = {}, tabpanel = {}, edit = {}, button = {}, window = {}, label = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(321, 107, 626, 612, "GTs Login or Register Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 312, 607, 290, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Updates", GUIEditor.tabpanel[1]) GUIEditor.memo[1] = guiCreateMemo(10, 10, 582, 241, "", false, GUIEditor.tab[1]) GUIEditor.button[1] = guiCreateButton(9, 142, 121, 61, "Login", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(194, 142, 121, 61, "Register", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(11, 30, 96, 34, "UserName : ", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(11, 92, 96, 34, "Password : ", false, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(125, 30, 161, 38, "", false, GUIEditor.window[1]) GUIEditor.edit[2] = guiCreateEdit(125, 88, 161, 38, "", false, GUIEditor.window[1]) end ) local localPlayer = getLocalPlayer ( ) function windowHandler( ) local playername = getPlayerName(localPlayer) guiSetText(GUIEditor.edit[1], "") guiSetText(GUIEditor.edit[2], "") guiSetText(GUIEditor.edit[1], playername) guiSetText(GUIEditor.edit[2], playername) guiSetVisible ( GUIEditor.window[1], true ) guiSetInputEnabled(true) showCursor ( true ) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) function login ( button, state ) if (source == GUIEditor.button[1]) then triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(GUIEditor.edit[1]), guiGetText(GUIEditor.edit[2]) ) end end addEventHandler ( "onClientGUIClick", guiRoot, login, false ) function register ( button, state ) if (source == GUIEditor.button[2]) then triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(GUIEditor.edit[1]), guiGetText(GUIEditor.edit[2])) end end addEventHandler ( "onClientGUIClick", guiRoot, register, false ) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible ( GUIEditor.window[1], false ) showCursor ( false ) end addEvent( "hideLoginWindow", true ) addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow ) Link to comment
roaddog Posted August 23, 2014 Share Posted August 23, 2014 Try now Client: GUIEditor = { tab = {}, tabpanel = {}, edit = {}, button = {}, window = {}, label = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(321, 107, 626, 612, "GTs Login or Register Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 312, 607, 290, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Updates", GUIEditor.tabpanel[1]) GUIEditor.memo[1] = guiCreateMemo(10, 10, 582, 241, "", false, GUIEditor.tab[1]) GUIEditor.button[1] = guiCreateButton(9, 142, 121, 61, "Login", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(194, 142, 121, 61, "Register", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(11, 30, 96, 34, "UserName : ", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(11, 92, 96, 34, "Password : ", false, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(125, 30, 161, 38, "", false, GUIEditor.window[1]) GUIEditor.edit[2] = guiCreateEdit(125, 88, 161, 38, "", false, GUIEditor.window[1]) end) local localPlayer = getLocalPlayer ( ) function windowHandler( ) local playername = getPlayerName(localPlayer) guiSetText(GUIEditor.edit[1], "") guiSetText(GUIEditor.edit[2], "") guiSetText(GUIEditor.edit[1], playername) guiSetVisible ( GUIEditor.window[1], true ) guiSetInputEnabled(true) showCursor ( true ) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) function login () if (source == GUIEditor.button[1]) then triggerServerEvent ( "onLogin",getRootElement(), localPlayer, guiGetText(GUIEditor.edit[1]), guiGetText(GUIEditor.edit[2]) ) end end addEventHandler ( "onClientGUIClick", guiRoot, login ) function register () if (source == GUIEditor.button[2]) then triggerServerEvent ( "onRegister",getRootElement(), localPlayer, guiGetText(GUIEditor.edit[1]), guiGetText(GUIEditor.edit[2])) end end addEventHandler ( "onClientGUIClick", guiRoot, register) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible ( GUIEditor.window[1], false ) showCursor ( false ) end addEvent( "hideLoginWindow", true ) addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow ) Link to comment
Chris!i! Posted August 24, 2014 Author Share Posted August 24, 2014 thanks verymuch but Register didnt worked and login worked debug says : server.lue:26: Access denied @ addAccount server.lua:27: Bad Argument @ logIn [Expected account at argument 2, got nil] Link to comment
Et-win Posted August 24, 2014 Share Posted August 24, 2014 Add the resource to the Admin group, or only give it 'addAccount' rights. (function.addAccount) Link to comment
Chris!i! Posted August 24, 2014 Author Share Posted August 24, 2014 Thanks Man now my login and register system is done thanks all Link to comment
Chris!i! Posted August 24, 2014 Author Share Posted August 24, 2014 1 more question i made a gui witha marker when the plaer hit the marker the GUI will be shown to all players in the server why can i add you in skype. Sorry for my bad english D: Link to comment
Anubhav Posted August 24, 2014 Share Posted August 24, 2014 Add me on skype, anubhav.agarwal87. I know how to do that. 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