IgnacioSkerry Posted October 14, 2019 Share Posted October 14, 2019 ventanalogin = {} GuestEnable = true addEventHandler("onClientBrowserDocumentReady", browser, function () fadeCamera(true) showCursor(true) sound = playSound("/45.235.98.63_22003/mods/deathmatch/resources/LoginEspanol/music.mp3",true) local username, password = loginFile("get") if not (username == "" or password == "") then executeBrowserJavascript(source, "document.getElementById('loginUser').value = '" .. username .. "'"); executeBrowserJavascript(source, "document.getElementById('loginPass').value = '" .. password .. "'"); executeBrowserJavascript(source, "document.getElementById('loginSave').checked = true"); else executeBrowserJavascript(source, "document.getElementById('loginSave').checked = false"); end end ) addEvent("onClientPlayerLogin", true) addEventHandler("onClientPlayerLogin", resourceRoot, function() if isTimer ( notification ) then killTimer ( notification ) end destroyElement(initBrowser) showCursor(false) stopSound(sound) end ) function panelaparece() if not(isElement(ventanalogin)) then Image2 = guiCreateStaticImage( 0, 0, 1920, 1200, "wea.png", false ) guiSetEnabled (Image2, false) x,y = guiGetScreenSize() local sWidth,sHeight = guiGetScreenSize() local Width,Height = 473,284 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) ventanalogin = guiCreateWindow(X,Y,Width,Height,"Bienvenido al Servidor.", false) guiWindowSetSizable(ventanalogin, false) edi1 = guiCreateEdit(107, 39, 270, 36, "", false, ventanalogin) edi2 = guiCreateEdit(107, 99, 270, 36, "", false, ventanalogin) guiEditSetMaxLength ( edi2,8) edi3 = guiCreateEdit(107, 155, 270, 36, "", false, ventanalogin) guiEditSetMaxLength ( edi3,8) guiEditSetMasked(edi2, true) guiEditSetMasked(edi3, true) botoninicio = guiCreateButton(289, 232, 92, 30, "Iniciar", false, ventanalogin) if GuestEnable == true then else end botonregistro = guiCreateButton(150, 232, 92, 30, "Registrarse", false, ventanalogin) label1 = guiCreateLabel(10, 41, 91, 34, "Usuario:", false, ventanalogin) guiLabelSetColor(label1,255,255,255) --- esto le da color al label en guiLabelSetVerticalAlign(label1,"center") ---esto hace que el label este cendrato verticalmente guiLabelSetHorizontalAlign(label1,"center",false) ---esto hace que el label este cendrato horizontalmente label2 = guiCreateLabel(10, 101, 91, 34, "Contraseña:", false, ventanalogin) guiLabelSetColor(label2,255,255,255) guiLabelSetVerticalAlign(label2,"center") guiLabelSetHorizontalAlign(label2,"center",false) label3 = guiCreateLabel(10, 157, 91, 34, "Confirmar:", false, ventanalogin) guiLabelSetColor(label3,255,255,255) guiLabelSetVerticalAlign(label3,"center") guiLabelSetHorizontalAlign(label3,"center",false) label4 = guiCreateLabel(121, 201, 250, 15, "Disfrute su estadia en el servidor", false, ventanalogin) creditos = guiCreateLabel(381, 262, 85, 15, "By:EstiloGTA", false, ventanalogin) image = guiCreateStaticImage(219, 30, 363, 118, "imagen.png", false) login_tab_error_msg = guiCreateLabel(31,131,419,25,"Error_login_tab",false,ventanalogin) guiLabelSetColor(login_tab_error_msg,255,0,0) guiLabelSetVerticalAlign(login_tab_error_msg,"center") guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false) guiSetFont(login_tab_error_msg,"default-bold-small") reg_tab_error_msg = guiCreateLabel(66,129,364,31,"Error_reg_ttab",false,ventanalogin) guiLabelSetColor(reg_tab_error_msg,255,20,0) guiLabelSetVerticalAlign(reg_tab_error_msg,"center") guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false) guiSetFont(reg_tab_error_msg,"default-bold-small") guiSetVisible(ventanalogin,true) guiSetVisible(image,true) --guiSetInputEnabled(true) showCursor(true) showChat(false) local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiSetText ( edi1, tostring(username)) guiSetText ( edi2, tostring(password)) else guiSetText ( edi1, tostring(username)) guiSetText ( edi2, tostring(password)) end addEventHandler("onClientGUIClick",botoninicio,onClickBtninicio) addEventHandler("onClientGUIClick",botonregistro,onClickBtnRegister) if GuestEnable == true then addEventHandler("onClientGUIClick",botoninvitado,onClickinvitado) end guiSetText(reg_tab_error_msg, "") guiSetText(login_tab_error_msg, "") end end addEventHandler("onClientResourceStart", resourceRoot, panelaparece) function loadLoginFromXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile ( xml_save_log_File ) end function saveLoginToXML(username, password) local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) function onClickBtninicio(button,state) if(button == "left" and state == "up") then if (source == botoninicio) then username = guiGetText(edi1) password = guiGetText(edi2) triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave) end end end function Error_msg(Tab, Text) if Tab == "Login" then guiSetText(login_tab_error_msg, tostring(Text)) setTimer(function() guiSetText(login_tab_error_msg, "") end,3000,1) elseif Tab == "Register" then guiSetText(reg_tab_error_msg, tostring(Text)) setTimer(function() guiSetText(reg_tab_error_msg, "") end,3000,1) end end addEvent("set_warning_text",true) addEventHandler("set_warning_text",getRootElement(),Error_msg) function onClickBtnRegister(button,state) if(button == "left" and state == "up") then if (source == botonregistro) then username = guiGetText(edi1) password = guiGetText(edi2) passwordConfirm = guiGetText(edi3) triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm) end end end function onClickinvitado(button,state) if(button == "left" and state == "up") then if (source == botoninvitado) then guiSetVisible(ventanalogin, false) guiSetVisible(image,false) guiSetVisible(Image2,false) guiSetInputEnabled(false) showCursor(false) showChat(true) end end end function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(ventanalogin, false) destroyElement(ventanalogin) ventanalogin = nil showCursor(false) showChat(true) guiSetVisible(image,false) guiSetVisible(Image2,false) removeEventHandler("onClientGUIClick",botoninicio,onClickBtninicio) removeEventHandler("onClientGUIClick",botonregistro,onClickBtnRegister) if GuestEnable == true then removeEventHandler("onClientGUIClick",botoninvitado,onClickinvitado) end end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) function mostrarporbinkey ( ) guiSetVisible ( ventanalogin, not guiGetVisible ( ventanalogin ) ) guiSetVisible(image, not guiGetVisible ( image )) guiSetVisible(Image2, not guiGetVisible ( Image2 )) showChat (true) showCursor ( not isCursorShowing( ) ) end bindKey ( "l","down", mostrarporbinkey ) function CursorError () outputChatBox("Cursor removido") showCursor(false) end addCommandHandler("sc", CursorError) No me funciona!!, ayuda.. Link to comment
root. Posted November 25, 2019 Share Posted November 25, 2019 Para ver los errores de su codigo usted debe ejecutar el comando /debugscript 3 , una vez tenga los errores impresos deberia importar la imagen al post, con decir "no funciona" y mostrar el codigo completo es un poco confuso la verdad... continuando con tu codigo tu s 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