sckatchof Posted February 26, 2012 Share Posted February 26, 2012 hi guys i need help when i join server nothing dose show this is my script Client Side : screenWidth,screenHeight = guiGetScreenSize() LoginWin = guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"TNS Login Panel",false) guiSetAlpha(LoginWin,1) guiWindowSetSizable(LoginWin,false) guiSetVisible(LoginWin, false) label = guiCreateLabel(122,131,293,19,"Make sure your username and password are correct!",false,LoginWin) guiLabelSetColor(label,0,255,0) Labelusername = guiCreateLabel(18,42,67,22,"Username :",false,LoginWin) Labelpassword = guiCreateLabel(18,86,65,22,"Password :",false,LoginWin) LoginUsername = guiCreateEdit(96,37,237,30,"",false,LoginWin) guiSetAlpha(LoginUsername,1) guiEditSetMaxLength(LoginUsername, 50) LoginPassword = guiCreateEdit(96,80,237,30,"",false,LoginWin) guiEditSetMasked(LoginPassword, true) guiEditSetMaxLength(LoginPassword, 50) guiEditSetMasked(LoginPassword,true) BtnAction = guiCreateButton(16,159,112,33,"Login",false,LoginWin) buttonRegister = guiCreateButton(143,159,127,33,"Create an Account",false,LoginWin) 5at = guiCreateLabel(43,199,438,25,"__________________________________________________________________",false,LoginWin) RegisterWindow = guiCreateWindow(376,162,447,396,"Create an Account",false) guiWindowSetSizable(RegisterWindow,false) LabelUsername = guiCreateLabel(12,39,72,27,"Username :",false,RegisterWindow) LabelPassword = guiCreateLabel(12,82,72,27,"Password :",false,RegisterWindow) EditRegisterUsername = guiCreateEdit(81,38,191,26,"",false,RegisterWindow) EditRegisterPassword = guiCreateEdit(81,78,191,26,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordRegister,9) guiEditSetMasked(EditPasswordRegister,true) EditPasswordConfirmation = guiCreateEdit(124,117,178,27,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordConfirmation,9) guiEditSetMasked(EditPasswordConfirmation,true) labelconfi = guiCreateLabel(12,123,109,27,"Confirm Password :",false,RegisterWindow) labelconfirpassword = guiCreateLabel(307,122,132,16,"Confitm yout password",false,RegisterWindow) guiLabelSetColor(labelconfirpassword,0,255,0) labesnas = guiCreateLabel(26,171,393,20,"Make sure your password can not be guessed. If somebody hacks your ",false,RegisterWindow) info = guiCreateLabel(26,191,411,24,"account you should have kept you password secure.",false,RegisterWindow) infoaccount = guiCreateLabel(9,231,130,30,"Account confirmation",false,RegisterWindow) guiSetFont(GUIEditor_Label[8],"default-bold-small") Labelemail = guiCreateLabel(9,264,57,22,"E-mail :",false,RegisterWindow) EditRegisterEmail = guiCreateEdit(54,259,191,26,"",false,RegisterWindow) ButtonRegister = guiCreateButton(9,347,124,37,"Create my account",false,RegisterWindow) ButtonClose = guiCreateButton(311,347,124,37,"Close",false,RegisterWindow) addEventHandler("onClientResourceStart", resourceRoot, function () guiSetVisible(LoginWi, true) guiSetVisible(RegisterWindow, false) showCursor(true) guiSetInputEnabled(true) end ) function onClickBtn(button, state) if(button == "left" and state == "up") then if (source == BtnAction) then username = guiGetText(LoginUsername) password = guiGetText(LoginPassword) triggerServerEvent("onLogin", getRootElement(), localPlayer, username, password) else triggerServerEvent("onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword), guiGetText(EditRegisterEmail)) end end end end addEventHandler("onClientGUIClick", BtnAction, onClickBtn, false) ----- Open registration window function onClickRegisterToggle(button,state) if(button == "left" and state == "up") then if (source == buttonRegister) then guiSetVisible(registerWindow, true) guiSetVisible(LoginWin, false) guiBringToFront(registerWindow) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",btnToggleRegister,onClickRegisterToggle) ------ Cancel registration function onClickCancel(button,state) if(button == "left" and state == "up") then if (source == ButtonClose) then guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",ButtonClose,onClickCancel) ---- Show Login function showLoginWindow() guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end addEvent("showLoginWindow", true) addEventHandler("showLoginWindow",getRootElement(),showLoginWindow) function hideRegisterWindow() guiSetInputEnabled(true) guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) showCursor(true) end addEvent("hideRegisterWindow", true) addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) ----------- local localPlayer = getLocalPlayer() function receiveVars( allow, email) local playername = getPlayerName(localPlayer) guiSetText(LoginUsername, "") guiSetText(EditRegisterUsername, "") if (email == "false") then guiSetVisible(LblRegisterEmail, false) guiSetVisible(EditRegisterEmail, false) end if (allow == "false") then end guiSetText(LoginUsername, playername) guiSetText(EditRegisterUsername, playername) guiSetVisible(LoginWin, true) guiBringToFront(LoginWin) guiSetInputEnabled(true) showCursor(true) end addEvent( "onSendVars", true ) addEventHandler( "onSendVars", getRootElement(), receiveVars ) function windowHandler() triggerServerEvent("onNeedVars", getLocalPlayer()) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler) Server Side : function onLogin ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if ( not isGuestAccount ( account ) ) then logOut ( player ) end if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "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, email ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else account = addAccount ( user, pass ) setAccountData ( account, "email", email) if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "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 ) function needVars() local allow_register = get("allow_register") local email_on_register = get("email_on_register") triggerClientEvent(source, "onSendVars", getRootElement(), allow_register, email_on_register) end addEvent("onNeedVars", true) addEventHandler("onNeedVars", getRootElement(), needVars) Link to comment
drk Posted February 26, 2012 Share Posted February 26, 2012 hi guys i need help when i join server nothing dose show this is my script Client Side : screenWidth,screenHeight = guiGetScreenSize() LoginWin = guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"TNS Login Panel",false) guiSetAlpha(LoginWin,1) guiWindowSetSizable(LoginWin,false) guiSetVisible(LoginWin, false) label = guiCreateLabel(122,131,293,19,"Make sure your username and password are correct!",false,LoginWin) guiLabelSetColor(label,0,255,0) Labelusername = guiCreateLabel(18,42,67,22,"Username :",false,LoginWin) Labelpassword = guiCreateLabel(18,86,65,22,"Password :",false,LoginWin) LoginUsername = guiCreateEdit(96,37,237,30,"",false,LoginWin) guiSetAlpha(LoginUsername,1) guiEditSetMaxLength(LoginUsername, 50) LoginPassword = guiCreateEdit(96,80,237,30,"",false,LoginWin) guiEditSetMasked(LoginPassword, true) guiEditSetMaxLength(LoginPassword, 50) guiEditSetMasked(LoginPassword,true) BtnAction = guiCreateButton(16,159,112,33,"Login",false,LoginWin) buttonRegister = guiCreateButton(143,159,127,33,"Create an Account",false,LoginWin) 5at = guiCreateLabel(43,199,438,25,"__________________________________________________________________",false,LoginWin) RegisterWindow = guiCreateWindow(376,162,447,396,"Create an Account",false) guiWindowSetSizable(RegisterWindow,false) LabelUsername = guiCreateLabel(12,39,72,27,"Username :",false,RegisterWindow) LabelPassword = guiCreateLabel(12,82,72,27,"Password :",false,RegisterWindow) EditRegisterUsername = guiCreateEdit(81,38,191,26,"",false,RegisterWindow) EditRegisterPassword = guiCreateEdit(81,78,191,26,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordRegister,9) guiEditSetMasked(EditPasswordRegister,true) EditPasswordConfirmation = guiCreateEdit(124,117,178,27,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordConfirmation,9) guiEditSetMasked(EditPasswordConfirmation,true) labelconfi = guiCreateLabel(12,123,109,27,"Confirm Password :",false,RegisterWindow) labelconfirpassword = guiCreateLabel(307,122,132,16,"Confitm yout password",false,RegisterWindow) guiLabelSetColor(labelconfirpassword,0,255,0) labesnas = guiCreateLabel(26,171,393,20,"Make sure your password can not be guessed. If somebody hacks your ",false,RegisterWindow) info = guiCreateLabel(26,191,411,24,"account you should have kept you password secure.",false,RegisterWindow) infoaccount = guiCreateLabel(9,231,130,30,"Account confirmation",false,RegisterWindow) guiSetFont(GUIEditor_Label[8],"default-bold-small") Labelemail = guiCreateLabel(9,264,57,22,"E-mail :",false,RegisterWindow) EditRegisterEmail = guiCreateEdit(54,259,191,26,"",false,RegisterWindow) ButtonRegister = guiCreateButton(9,347,124,37,"Create my account",false,RegisterWindow) ButtonClose = guiCreateButton(311,347,124,37,"Close",false,RegisterWindow) addEventHandler("onClientResourceStart", resourceRoot, function () guiSetVisible(LoginWi, true) guiSetVisible(RegisterWindow, false) showCursor(true) guiSetInputEnabled(true) end ) function onClickBtn(button, state) if(button == "left" and state == "up") then if (source == BtnAction) then username = guiGetText(LoginUsername) password = guiGetText(LoginPassword) triggerServerEvent("onLogin", getRootElement(), localPlayer, username, password) else triggerServerEvent("onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword), guiGetText(EditRegisterEmail)) end end end end addEventHandler("onClientGUIClick", BtnAction, onClickBtn, false) ----- Open registration window function onClickRegisterToggle(button,state) if(button == "left" and state == "up") then if (source == buttonRegister) then guiSetVisible(registerWindow, true) guiSetVisible(LoginWin, false) guiBringToFront(registerWindow) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",btnToggleRegister,onClickRegisterToggle) ------ Cancel registration function onClickCancel(button,state) if(button == "left" and state == "up") then if (source == ButtonClose) then guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",ButtonClose,onClickCancel) ---- Show Login function showLoginWindow() guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end addEvent("showLoginWindow", true) addEventHandler("showLoginWindow",getRootElement(),showLoginWindow) function hideRegisterWindow() guiSetInputEnabled(true) guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) showCursor(true) end addEvent("hideRegisterWindow", true) addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) ----------- local localPlayer = getLocalPlayer() function receiveVars( allow, email) local playername = getPlayerName(localPlayer) guiSetText(LoginUsername, "") guiSetText(EditRegisterUsername, "") if (email == "false") then guiSetVisible(LblRegisterEmail, false) guiSetVisible(EditRegisterEmail, false) end if (allow == "false") then end guiSetText(LoginUsername, playername) guiSetText(EditRegisterUsername, playername) guiSetVisible(LoginWin, true) guiBringToFront(LoginWin) guiSetInputEnabled(true) showCursor(true) end addEvent( "onSendVars", true ) addEventHandler( "onSendVars", getRootElement(), receiveVars ) function windowHandler() triggerServerEvent("onNeedVars", getLocalPlayer()) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler) Server Side : function onLogin ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if ( not isGuestAccount ( account ) ) then logOut ( player ) end if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "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, email ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else account = addAccount ( user, pass ) setAccountData ( account, "email", email) if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "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 ) function needVars() local allow_register = get("allow_register") local email_on_register = get("email_on_register") triggerClientEvent(source, "onSendVars", getRootElement(), allow_register, email_on_register) end addEvent("onNeedVars", true) addEventHandler("onNeedVars", getRootElement(), needVars) Variable mainWidth is nil. Link to comment
sckatchof Posted February 26, 2012 Author Share Posted February 26, 2012 thank you for help but it dont work. Link to comment
sckatchof Posted February 26, 2012 Author Share Posted February 26, 2012 Client side : screenWidth,screenHeight = guiGetScreenSize() LoginWin = guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"TNS Login Panel",false) guiSetAlpha(LoginWin,1) guiWindowSetSizable(LoginWin,false) guiSetVisible(LoginWin, false) guiLabelSetColor(label,0,255,0) Labelusername = guiCreateLabel(18,42,67,22,"Username :",false,LoginWin) Labelpassword = guiCreateLabel(18,86,65,22,"Password :",false,LoginWin) LoginUsername = guiCreateEdit(96,37,237,30,"",false,LoginWin) guiSetAlpha(LoginUsername,1) guiEditSetMaxLength(LoginUsername, 50) LoginPassword = guiCreateEdit(96,80,237,30,"",false,LoginWin) guiEditSetMasked(LoginPassword, true) guiEditSetMaxLength(LoginPassword, 50) guiEditSetMasked(LoginPassword,true) BtnAction = guiCreateButton(16,159,112,33,"Login",false,LoginWin) buttonRegister = guiCreateButton(143,159,127,33,"Create an Account",false,LoginWin) guiMemoSetReadOnly( TNSmemo,true,LoginWin) line = guiCreateLabel(43,199,438,25,"__________________________________________________________________",false,LoginWin) RegisterWindow = guiCreateWindow(376,162,447,396,"Create an Account",false) guiWindowSetSizable(RegisterWindow,false) LabelUsername = guiCreateLabel(12,39,72,27,"Username :",false,RegisterWindow) LabelPassword = guiCreateLabel(12,82,72,27,"Password :",false,RegisterWindow) EditRegisterUsername = guiCreateEdit(81,38,191,26,"",false,RegisterWindow) EditRegisterPassword = guiCreateEdit(81,78,191,26,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordRegister,9) guiEditSetMasked(EditPasswordRegister,true) EditPasswordConfirmation = guiCreateEdit(124,117,178,27,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordConfirmation,9) guiEditSetMasked(EditPasswordConfirmation,true) labelconfi = guiCreateLabel(12,123,109,27,"Confirm Password :",false,RegisterWindow) labelconfirpassword = guiCreateLabel(307,122,132,16,"Confitm yout password",false,RegisterWindow) guiLabelSetColor(labelconfirpassword,0,255,0) labesnas = guiCreateLabel(26,171,393,20,"Make sure your password can not be guessed. If somebody hacks your ",false,RegisterWindow) info = guiCreateLabel(26,191,411,24,"account you should have kept you password secure.",false,RegisterWindow) infoaccount = guiCreateLabel(9,231,130,30,"Account confirmation",false,RegisterWindow) guiSetFont(infoaccount ,"default-bold-small") Labelemail = guiCreateLabel(9,264,57,22,"E-mail :",false,RegisterWindow) EditRegisterEmail = guiCreateEdit(54,259,191,26,"",false,RegisterWindow) LabelEmail = guiCreateLabel(257,263,132,16,"Enter yout email",false,RegisterWindow) ButtonRegister = guiCreateButton(9,347,124,37,"Create my account",false,RegisterWindow) ButtonClose = guiCreateButton(311,347,124,37,"Close",false,RegisterWindow) addEventHandler("onClientResourceStart", resourceRoot, function () guiSetVisible(LoginWi, true) guiSetVisible(RegisterWindow, false) showCursor(true) guiSetInputEnabled(true) end ) function onClickBtn(button, state) if(button == "left" and state == "up") then if (source == BtnAction) then username = guiGetText(LoginUsername) password = guiGetText(LoginPassword) triggerServerEvent("onLogin", getRootElement(), localPlayer, username, password) else triggerServerEvent("onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword), guiGetText(EditRegisterEmail)) end end end end addEventHandler("onClientGUIClick", BtnAction, onClickBtn, false) ----- Open registration window function onClickRegisterToggle(button,state) if(button == "left" and state == "up") then if (source == buttonRegister) then guiSetVisible(registerWindow, true) guiSetVisible(LoginWin, false) guiBringToFront(registerWindow) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",btnToggleRegister,onClickRegisterToggle) ------ Cancel registration function onClickCancel(button,state) if(button == "left" and state == "up") then if (source == ButtonClose) then guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",ButtonClose,onClickCancel) ---- Show Login function showLoginWindow() guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end addEvent("showLoginWindow", true) addEventHandler("showLoginWindow",getRootElement(),showLoginWindow) function hideRegisterWindow() guiSetInputEnabled(true) guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) showCursor(true) end addEvent("hideRegisterWindow", true) addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) local localPlayer = getLocalPlayer() function receiveVars( allow, email) local playername = getPlayerName(localPlayer) guiSetText(LoginUsername, "") guiSetText(EditRegisterUsername, "") if (email == "false") then guiSetVisible(LblRegisterEmail, false) guiSetVisible(EditRegisterEmail, false) end if (allow == "false") then end guiSetText(LoginUsername, playername) guiSetText(EditRegisterUsername, playername) guiSetVisible(LoginWin, true) guiBringToFront(LoginWin) guiSetInputEnabled(true) showCursor(true) end addEvent( "onSendVars", true ) addEventHandler( "onSendVars", getRootElement(), receiveVars ) function windowHandler() triggerServerEvent("onNeedVars", getLocalPlayer()) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler) Server Side : function onLogin ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if ( not isGuestAccount ( account ) ) then logOut ( player ) end if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "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, email ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else account = addAccount ( user, pass ) setAccountData ( account, "email", email) if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "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 ) function needVars() local allow_register = get("allow_register") local email_on_register = get("email_on_register") triggerClientEvent(source, "onSendVars", getRootElement(), allow_register, email_on_register) end addEvent("onNeedVars", true) addEventHandler("onNeedVars", getRootElement(), needVars) addEventHandler ( "onPlayerLogin", getRootElement(), hudChangerOnLogin ) Link to comment
Kenix Posted February 26, 2012 Share Posted February 26, 2012 screenWidth,screenHeight = guiGetScreenSize() LoginWin = guiCreateWindow(screenWidth/2-mainWidth/2,screenHeight/2-mainHeight/2,mainWidth,mainHeight,"TNS Login Panel",false) guiSetAlpha(LoginWin,1) guiWindowSetSizable(LoginWin,false) guiSetVisible(LoginWin, false) guiLabelSetColor(label,0,255,0) Labelusername = guiCreateLabel(18,42,67,22,"Username :",false,LoginWin) Labelpassword = guiCreateLabel(18,86,65,22,"Password :",false,LoginWin) LoginUsername = guiCreateEdit(96,37,237,30,"",false,LoginWin) guiSetAlpha(LoginUsername,1) guiEditSetMaxLength(LoginUsername, 50) LoginPassword = guiCreateEdit(96,80,237,30,"",false,LoginWin) guiEditSetMasked(LoginPassword, true) guiEditSetMaxLength(LoginPassword, 50) guiEditSetMasked(LoginPassword,true) BtnAction = guiCreateButton(16,159,112,33,"Login",false,LoginWin) buttonRegister = guiCreateButton(143,159,127,33,"Create an Account",false,LoginWin) guiMemoSetReadOnly( TNSmemo,true,LoginWin) line = guiCreateLabel(43,199,438,25,"__________________________________________________________________",false,LoginWin) RegisterWindow = guiCreateWindow(376,162,447,396,"Create an Account",false) guiWindowSetSizable(RegisterWindow,false) LabelUsername = guiCreateLabel(12,39,72,27,"Username :",false,RegisterWindow) LabelPassword = guiCreateLabel(12,82,72,27,"Password :",false,RegisterWindow) EditRegisterUsername = guiCreateEdit(81,38,191,26,"",false,RegisterWindow) EditRegisterPassword = guiCreateEdit(81,78,191,26,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordRegister,9) guiEditSetMasked(EditPasswordRegister,true) EditPasswordConfirmation = guiCreateEdit(124,117,178,27,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordConfirmation,9) guiEditSetMasked(EditPasswordConfirmation,true) labelconfi = guiCreateLabel(12,123,109,27,"Confirm Password :",false,RegisterWindow) labelconfirpassword = guiCreateLabel(307,122,132,16,"Confitm yout password",false,RegisterWindow) guiLabelSetColor(labelconfirpassword,0,255,0) labesnas = guiCreateLabel(26,171,393,20,"Make sure your password can not be guessed. If somebody hacks your ",false,RegisterWindow) info = guiCreateLabel(26,191,411,24,"account you should have kept you password secure.",false,RegisterWindow) infoaccount = guiCreateLabel(9,231,130,30,"Account confirmation",false,RegisterWindow) guiSetFont(infoaccount ,"default-bold-small") Labelemail = guiCreateLabel(9,264,57,22,"E-mail :",false,RegisterWindow) EditRegisterEmail = guiCreateEdit(54,259,191,26,"",false,RegisterWindow) LabelEmail = guiCreateLabel(257,263,132,16,"Enter yout email",false,RegisterWindow) ButtonRegister = guiCreateButton(9,347,124,37,"Create my account",false,RegisterWindow) ButtonClose = guiCreateButton(311,347,124,37,"Close",false,RegisterWindow) addEventHandler("onClientResourceStart", resourceRoot, function () guiSetVisible(LoginWi, true) guiSetVisible(RegisterWindow, false) showCursor(true) guiSetInputEnabled(true) end ) function onClickBtn(button, state) if(button == "left" and state == "up") then if (source == BtnAction) then username = guiGetText(LoginUsername) password = guiGetText(LoginPassword) triggerServerEvent("onLogin", getRootElement(), localPlayer, username, password) else triggerServerEvent("onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword), guiGetText(EditRegisterEmail)) end end end addEventHandler("onClientGUIClick", BtnAction, onClickBtn, false) ----- Open registration window function onClickRegisterToggle(button,state) if(button == "left" and state == "up") then if (source == buttonRegister) then guiSetVisible(registerWindow, true) guiSetVisible(LoginWin, false) guiBringToFront(registerWindow) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",btnToggleRegister,onClickRegisterToggle) ------ Cancel registration function onClickCancel(button,state) if(button == "left" and state == "up") then if (source == ButtonClose) then guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",ButtonClose,onClickCancel) ---- Show Login function showLoginWindow() guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end addEvent("showLoginWindow", true) addEventHandler("showLoginWindow",getRootElement(),showLoginWindow) function hideRegisterWindow() guiSetInputEnabled(true) guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) showCursor(true) end addEvent("hideRegisterWindow", true) addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) local localPlayer = getLocalPlayer() function receiveVars( allow, email) local playername = getPlayerName(localPlayer) guiSetText(LoginUsername, "") guiSetText(EditRegisterUsername, "") if (email == "false") then guiSetVisible(LblRegisterEmail, false) guiSetVisible(EditRegisterEmail, false) end if (allow == "false") then end guiSetText(LoginUsername, playername) guiSetText(EditRegisterUsername, playername) guiSetVisible(LoginWin, true) guiBringToFront(LoginWin) guiSetInputEnabled(true) showCursor(true) end addEvent( "onSendVars", true ) addEventHandler( "onSendVars", getRootElement(), receiveVars ) function windowHandler() triggerServerEvent("onNeedVars", getLocalPlayer()) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler) Syntax error Use /debugscript 3 please! Link to comment
drk Posted February 26, 2012 Share Posted February 26, 2012 LOL? You have not changed anything! What is mainWidth? Client-side: screenWidth,screenHeight = guiGetScreenSize() LoginWin = guiCreateWindow(screenWidth/2,screenHeight/2,screenWidth/2,screenHeight/2,"TNS Login Panel",false) guiSetAlpha(LoginWin,1) guiWindowSetSizable(LoginWin,false) guiSetVisible(LoginWin, false) guiLabelSetColor(label,0,255,0) Labelusername = guiCreateLabel(18,42,67,22,"Username :",false,LoginWin) Labelpassword = guiCreateLabel(18,86,65,22,"Password :",false,LoginWin) LoginUsername = guiCreateEdit(96,37,237,30,"",false,LoginWin) guiSetAlpha(LoginUsername,1) guiEditSetMaxLength(LoginUsername, 50) LoginPassword = guiCreateEdit(96,80,237,30,"",false,LoginWin) guiEditSetMasked(LoginPassword, true) guiEditSetMaxLength(LoginPassword, 50) guiEditSetMasked(LoginPassword,true) BtnAction = guiCreateButton(16,159,112,33,"Login",false,LoginWin) buttonRegister = guiCreateButton(143,159,127,33,"Create an Account",false,LoginWin) guiMemoSetReadOnly( TNSmemo,true,LoginWin) line = guiCreateLabel(43,199,438,25,"__________________________________________________________________",false,LoginWin) RegisterWindow = guiCreateWindow(376,162,447,396,"Create an Account",false) guiWindowSetSizable(RegisterWindow,false) LabelUsername = guiCreateLabel(12,39,72,27,"Username :",false,RegisterWindow) LabelPassword = guiCreateLabel(12,82,72,27,"Password :",false,RegisterWindow) EditRegisterUsername = guiCreateEdit(81,38,191,26,"",false,RegisterWindow) EditRegisterPassword = guiCreateEdit(81,78,191,26,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordRegister,9) guiEditSetMasked(EditPasswordRegister,true) EditPasswordConfirmation = guiCreateEdit(124,117,178,27,"",false,RegisterWindow) guiEditSetMaxLength(EditPasswordConfirmation,9) guiEditSetMasked(EditPasswordConfirmation,true) labelconfi = guiCreateLabel(12,123,109,27,"Confirm Password :",false,RegisterWindow) labelconfirpassword = guiCreateLabel(307,122,132,16,"Confitm yout password",false,RegisterWindow) guiLabelSetColor(labelconfirpassword,0,255,0) labesnas = guiCreateLabel(26,171,393,20,"Make sure your password can not be guessed. If somebody hacks your ",false,RegisterWindow) info = guiCreateLabel(26,191,411,24,"account you should have kept you password secure.",false,RegisterWindow) infoaccount = guiCreateLabel(9,231,130,30,"Account confirmation",false,RegisterWindow) guiSetFont(infoaccount ,"default-bold-small") Labelemail = guiCreateLabel(9,264,57,22,"E-mail :",false,RegisterWindow) EditRegisterEmail = guiCreateEdit(54,259,191,26,"",false,RegisterWindow) LabelEmail = guiCreateLabel(257,263,132,16,"Enter yout email",false,RegisterWindow) ButtonRegister = guiCreateButton(9,347,124,37,"Create my account",false,RegisterWindow) ButtonClose = guiCreateButton(311,347,124,37,"Close",false,RegisterWindow) addEventHandler("onClientResourceStart", resourceRoot, function () guiSetVisible(LoginWi, true) guiSetVisible(RegisterWindow, false) showCursor(true) guiSetInputEnabled(true) end ) function onClickBtn(button, state) if(button == "left" and state == "up") then if (source == BtnAction) then username = guiGetText(LoginUsername) password = guiGetText(LoginPassword) triggerServerEvent("onLogin", getRootElement(), localPlayer, username, password) else triggerServerEvent("onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword), guiGetText(EditRegisterEmail)) end end end end addEventHandler("onClientGUIClick", BtnAction, onClickBtn, false) ----- Open registration window function onClickRegisterToggle(button,state) if(button == "left" and state == "up") then if (source == buttonRegister) then guiSetVisible(registerWindow, true) guiSetVisible(LoginWin, false) guiBringToFront(registerWindow) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",btnToggleRegister,onClickRegisterToggle) ------ Cancel registration function onClickCancel(button,state) if(button == "left" and state == "up") then if (source == ButtonClose) then guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end end end addEventHandler("onClientGUIClick",ButtonClose,onClickCancel) ---- Show Login function showLoginWindow() guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) guiSetInputEnabled(true) showCursor(true) end addEvent("showLoginWindow", true) addEventHandler("showLoginWindow",getRootElement(),showLoginWindow) function hideRegisterWindow() guiSetInputEnabled(true) guiSetVisible(LoginWin, true) guiSetVisible(registerWindow, false) showCursor(true) end addEvent("hideRegisterWindow", true) addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) local localPlayer = getLocalPlayer() function receiveVars( allow, email) local playername = getPlayerName(localPlayer) guiSetText(LoginUsername, "") guiSetText(EditRegisterUsername, "") if (email == "false") then guiSetVisible(LblRegisterEmail, false) guiSetVisible(EditRegisterEmail, false) end if (allow == "false") then end guiSetText(LoginUsername, playername) guiSetText(EditRegisterUsername, playername) guiSetVisible(LoginWin, true) guiBringToFront(LoginWin) guiSetInputEnabled(true) showCursor(true) end addEvent( "onSendVars", true ) addEventHandler( "onSendVars", getRootElement(), receiveVars ) function windowHandler() triggerServerEvent("onNeedVars", getLocalPlayer()) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler) Server Side : function onLogin ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if ( not isGuestAccount ( account ) ) then logOut ( player ) end if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "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, email ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else account = addAccount ( user, pass ) setAccountData ( account, "email", email) if (logIn ( player, account, pass ) == true) then triggerClientEvent ( player, "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 ) function needVars() local allow_register = get("allow_register") local email_on_register = get("email_on_register") triggerClientEvent(source, "onSendVars", getRootElement(), allow_register, email_on_register) end addEvent("onNeedVars", true) addEventHandler("onNeedVars", getRootElement(), needVars) addEventHandler ( "onPlayerLogin", getRootElement(), hudChangerOnLogin ) If not work then tell me. Link to comment
sckatchof Posted February 26, 2012 Author Share Posted February 26, 2012 nothing it show when i join the server and i dont have any error that's my problem. Link to comment
Kenix Posted February 26, 2012 Share Posted February 26, 2012 LOL? You have not changed anything! What is mainWidth? He have syntax error i said. In your code have syntax error. In my no. sckatchof,test my code. Link to comment
sckatchof Posted February 26, 2012 Author Share Posted February 26, 2012 LOL? You have not changed anything! What is mainWidth? He have syntax error i said. In your code have syntax error. In my no. sckatchof,test my code. thank but ,I tested ur code kenix i have some problem nothing it show when i join. Link to comment
drk Posted February 26, 2012 Share Posted February 26, 2012 LOL? You have not changed anything! What is mainWidth? He have syntax error i said. In your code have syntax error. In my no. sckatchof,test my code. thank but ,I tested ur code kenix i have some problem nothing it show when i join. Tell me, what is mainWidth? Link to comment
Kenix Posted February 26, 2012 Share Posted February 26, 2012 He have not defined variables: TNSmemo,EditPasswordRegister,LoginWi,LblRegisterEmail Link to comment
sckatchof Posted February 26, 2012 Author Share Posted February 26, 2012 it's work ,thank yoooooou Kenix for help 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