SnoopCat Posted August 28, 2011 Share Posted August 28, 2011 hello i was modifing a login script that works fine in mta 1.0.5 now i eddited it and i cant use on 1.1 can someone help me? i just encoded it to UTF-8 but nothing happens client: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(201,213,255,341,"Welcome",false) GUIEditor_Edit[1] = guiCreateEdit(76,58,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Edit[2] = guiCreateEdit(76,96,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(11,65,63,21,"Usuario",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255)) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top"") guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(12,101,64,24,"Contrasena",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,255,255)) guiLabelSetVerticalAlign(GUIEditor_Label[2],"top"") guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(19,180,212,22,"O si eres Nuevo Registrate",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],255,150,255)) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top"") guiSetFont(GUIEditor_Label[3],"clear-normal") GUIEditor_Label[4] = guiCreateLabel(20,27,212,22,"Bienvenido porfavor Logeate",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],255,150,255)) guiLabelSetVerticalAlign(GUIEditor_Label[4],"top"") guiSetFont(GUIEditor_Label[4],"clear-normal") GUIEditor_Button[1] = guiCreateButton(133,142,101,31,"Logear",false,GUIEditor_Window[1]) GUIEditor_Edit[3] = guiCreateEdit(74,202,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Edit[4] = guiCreateEdit(74,240,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(10,208,63,21,"Usuario",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[5],255,255,255)) guiLabelSetVerticalAlign(GUIEditor_Label[5],"top"") guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Label[6] = guiCreateLabel(7,245,64,24,"Contrasena",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[6],255,255,255)) guiLabelSetVerticalAlign(GUIEditor_Label[6],"top"") guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Button[2] = guiCreateButton(133,284,101,31,"Registrarse",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(20,289,100,38,"Jugar Sin registrarse",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1],false) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[3]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(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 Side: 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 ) y rly need help plz Link to comment
JR10 Posted August 28, 2011 Share Posted August 28, 2011 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(201,213,255,341,"Welcome",false) GUIEditor_Edit[1] = guiCreateEdit(76,58,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Edit[2] = guiCreateEdit(76,96,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(11,65,63,21,"Usuario",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255)) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(12,101,64,24,"Contrasena",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,255,255)) guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(19,180,212,22,"O si eres Nuevo Registrate",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],255,150,255)) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiSetFont(GUIEditor_Label[3],"clear-normal") GUIEditor_Label[4] = guiCreateLabel(20,27,212,22,"Bienvenido porfavor Logeate",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],255,150,255)) guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") guiSetFont(GUIEditor_Label[4],"clear-normal") GUIEditor_Button[1] = guiCreateButton(133,142,101,31,"Logear",false,GUIEditor_Window[1]) GUIEditor_Edit[3] = guiCreateEdit(74,202,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Edit[4] = guiCreateEdit(74,240,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(10,208,63,21,"Usuario",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[5],255,255,255)) guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Label[6] = guiCreateLabel(7,245,64,24,"Contrasena",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[6],255,255,255)) guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Button[2] = guiCreateButton(133,284,101,31,"Registrarse",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(20,289,100,38,"Jugar Sin registrarse",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1],false) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[3]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(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 ) Link to comment
Cadu12 Posted August 29, 2011 Share Posted August 29, 2011 Doesnt work, you dont have local to getLogin/getPassword wong: LoginUsername EditRegisterUsername Sorry i cant help, if you tell me whats guiCreateEdit for login and password then i can help you edit: maybe GUIEditor_Edit[3] and GUIEditor_Edit[4] ? Link to comment
SnoopCat Posted August 30, 2011 Author Share Posted August 30, 2011 idk what are you talking about Link to comment
Static-X Posted August 30, 2011 Share Posted August 30, 2011 Your script has too much syntax errors, GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Window[1] = guiCreateWindow(201,213,255,341,"Welcome",false) GUIEditor_Edit[1] = guiCreateEdit(76,58,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Edit[2] = guiCreateEdit(76,96,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(11,65,63,21,"Usuario",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(12,101,64,24,"Contrasena",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[2],255,255,255) -- removed extra ) guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") -- removed extra " guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(19,180,212,22,"O si eres Nuevo Registrate",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[3],255,150,255) -- removed extra ) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") -- removed extra " guiSetFont(GUIEditor_Label[3],"clear-normal") GUIEditor_Label[4] = guiCreateLabel(20,27,212,22,"Bienvenido porfavor Logeate",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[4],255,150,255) --removed extra ) guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") -- removed extra " guiSetFont(GUIEditor_Label[4],"clear-normal") GUIEditor_Button[1] = guiCreateButton(133,142,101,31,"Logear",false,GUIEditor_Window[1]) GUIEditor_Edit[3] = guiCreateEdit(74,202,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Edit[4] = guiCreateEdit(74,240,157,35,"",false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(10,208,63,21,"Usuario",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[5],255,255,255) -- removed extra ) guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") -- removed extra " guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Label[6] = guiCreateLabel(7,245,64,24,"Contrasena",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[6],255,255,255) -- removed extra ) guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") -- removed extra " guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Button[2] = guiCreateButton(133,284,101,31,"Registrarse",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(20,289,100,38,"Jugar Sin registrarse",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1],false) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == GUIEditor_Button[3]) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor(false) end end -- added )-- added function windowHandler( ) local localPlayer = getLocalPlayer () 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 ) Fixed syntax errors HOWEVER you need to replace the old variables (LoginUsername,LoginPassword) with the new variables ( as you have mentioned that you edited the script ) 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