iFoReX Posted May 11, 2012 Share Posted May 11, 2012 I dont know how know if the checkbox is pressed GUIEditor_Button = {} GUIEditor_Checkbox = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Radio = {} LoginWindow = guiCreateWindow(0.2763,0.3467,0.4863,0.3633,"Ventana de Loggeo",true) guiWindowSetMovable(LoginWindow,false) guiWindowSetSizable(LoginWindow,false) GUIEditor_Label[1] = guiCreateLabel(21,63,52,21,"Nick :",false,LoginWindow) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Edit[1] = guiCreateEdit(63,58,126,28,"",false,LoginWindow) GUIEditor_Label[2] = guiCreateLabel(19,110,74,19,"Contraseña : ",false,LoginWindow) GUIEditor_Edit[2] = guiCreateEdit(94,105,126,28,"",false,LoginWindow) GUIEditor_Label[3] = guiCreateLabel(19,147,227,19,"Si no Tienes una Cuenta registrate aqui : ",false,LoginWindow) guiLabelSetColor(GUIEditor_Label[3],255,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Button[1] = guiCreateButton(19,168,100,36,"Registrarme",false,LoginWindow) GUIEditor_Checkbox[1] = guiCreateCheckBox(227,107,115,27,"Recordar Datos",false,false,LoginWindow) guiSetFont(GUIEditor_Checkbox[1],"default-bold-small") GUIEditor_Button[2] = guiCreateButton(229,55,97,35,"Logearme",false,LoginWindow) GUIEditor_Label[4] = guiCreateLabel(196,188,181,16,"GUI Creada por ElMota (c) 2012",false,LoginWindow) guiLabelSetColor(GUIEditor_Label[4],255, 255, 0) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Radio[1] = guiCreateRadioButton(17,26,81,21,"Español",false,LoginWindow) guiRadioButtonSetSelected(GUIEditor_Radio[1],true) GUIEditor_Radio[2] = guiCreateRadioButton(109,26,81,21,"English",false,LoginWindow) RegisterWindow = guiCreateWindow(0.2937,0.3533,0.4437,0.3517,"Ventana de Registrarse",true) guiWindowSetMovable(RegisterWindow,false) guiWindowSetSizable(RegisterWindow,false) GUIEditor_Label[5] = guiCreateLabel(11,26,142,17,"Pon datos que no Olvides",false,RegisterWindow) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Label[6] = guiCreateLabel(9,52,140,20,"---Datos Importantes.",false,RegisterWindow) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Label[7] = guiCreateLabel(12,85,52,21,"Nick :",false,RegisterWindow) guiSetFont(GUIEditor_Label[7],"clear-normal") GUIEditor_Edit[3] = guiCreateEdit(50,80,100,26,"",false,RegisterWindow) GUIEditor_Label[8] = guiCreateLabel(12,127,87,17,"Contraseña :",false,RegisterWindow) guiSetFont(GUIEditor_Label[8],"clear-normal") GUIEditor_Edit[4] = guiCreateEdit(100,122,100,26,"",false,RegisterWindow) GUIEditor_Label[9] = guiCreateLabel(12,179,42,16,"Sexo :",false,RegisterWindow) guiSetFont(GUIEditor_Label[9],"clear-normal") GUIEditor_Radio[3] = guiCreateRadioButton(62,174,65,25,"Hombre",false,RegisterWindow) guiRadioButtonSetSelected(GUIEditor_Radio[3],true) guiSetFont(GUIEditor_Radio[3],"default-bold-small") GUIEditor_Radio[4] = guiCreateRadioButton(134,174,65,25,"Mujer",false,RegisterWindow) guiSetFont(GUIEditor_Radio[4],"default-bold-small") GUIEditor_Label[10] = guiCreateLabel(216,29,52,16,"ESPAÑOL",false,RegisterWindow) guiLabelSetColor(GUIEditor_Label[10],0,0,255) guiSetFont(GUIEditor_Label[10],"default-bold-small") GUIEditor_Label[11] = guiCreateLabel(294,29,52,16,"ENGLISH",false,RegisterWindow) guiLabelSetColor(GUIEditor_Label[11],0,0,255) guiSetFont(GUIEditor_Label[11],"default-bold-small") GUIEditor_Button[3] = guiCreateButton(215,69,123,39,"Registrarme !",false,RegisterWindow) GUIEditor_Button[4] = guiCreateButton(215,180,123,39,"Cancelar",false,RegisterWindow) guiSetVisible(RegisterWindow,false) guiSetVisible(LoginWindow,false) guiEditSetMasked(GUIEditor_Edit[2],true) guiEditSetMasked(GUIEditor_Edit[4],true) showCursor(false) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() guiSetVisible(RegisterWindow,false) guiSetVisible(LoginWindow,true) showCursor(true) guiSetText(GUIEditor_Edit[1], ""..getPlayerName( localPlayer ).."") guiSetText(GUIEditor_Edit[3], ""..getPlayerName( localPlayer ).."") end ) addEventHandler("onClientGUIClick", root, function() if source == GUIEditor_Button[1] then guiSetVisible(RegisterWindow,true) guiSetVisible(LoginWindow,false) elseif source == GUIEditor_Button[3] then guiSetVisible(RegisterWindow,false) guiSetVisible(LoginWindow,false) showCursor(false) elseif source == GUIEditor_Button[4] then guiSetVisible(RegisterWindow,false) guiSetVisible(LoginWindow,true) end end ) function clientSubmitLogin ( button, state ) if ( button == "left" and state == "up" ) then local username = guiGetText(GUIEditor_Edit[1]) local password = guiGetText(GUIEditor_Edit[2]) if ( username and password ) then triggerServerEvent("submitLoginEM", localPlayer, username, password) else outputChatBox("Porfavor pon tu Nick y tu Contrase?a.") end end end addEventHandler("onClientGUIClick", GUIEditor_Button[2], clientSubmitLogin, false) addEvent ( "closeLoginGUI", true ) addEventHandler ( "closeLoginGUI", root, function ( ) guiSetVisible ( LoginWindow, false ) guiSetVisible ( RegisterWindow, false ) showCursor ( false ) end ) function clientSubmitaccount ( button, state ) if ( button == "left" and state == "up" ) then local username = guiGetText(GUIEditor_Edit[3]) local password = guiGetText(GUIEditor_Edit[4]) if ( username and password ) then triggerServerEvent("addAccountEM", localPlayer, username, password) else outputChatBox("Porfavor pon tu Nick y tu Contraseña.") end end end addEventHandler("onClientGUIClick", GUIEditor_Button[3], clientSubmitaccount, false) addEvent ( "openLoginGUI", true ) addEventHandler ( "openLoginGUI", root, function ( ) guiSetVisible ( LoginWindow, true ) guiSetVisible ( RegisterWindow, false ) showCursor ( true ) end ) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() local xmlFile = xmlLoadFile("user.xml") if xmlFile then status = xmlNodeGetAttribute(xmlFile,"autologin") if (status == tostring(true)) then local username = tostring(xmlNodeGetAttribute(xmlFile,"username")) local password = tostring(xmlNodeGetAttribute(xmlFile,"password")) guiSetText(GUIEditor_Edit[1], ""..username.."") guiSetText(GUIEditor_Edit[2], ""..password.."") if not (username == "") and not (password == "") then saveXmlFile() end end end end ) addEventHandler("onClientGUIClick", root, function() if source == GUIEditor_Button[2] then local xmlFile = xmlLoadFile("user.xml") if not xmlFile then xmlFile = xmlCreateFile("user.xml","settings") xmlNodeSetAttribute(xmlFile,"autologin",tostring(false)) end xmlNodeSetAttribute(xmlFile,"username",tostring(guiGetText(GUIEditor_Edit[1]))) xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(GUIEditor_Edit[2]))) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end end ) addEventHandler("onClientGUIClick", root, function() if GUIEditor_Checkbox[1] == true then xmlNodeSetAttribute(xmlFile,"autologin",tostring(true)) end end ) function loginHandler(username,password) local acc = getAccount(username, password) if (acc) then logIn ( source, acc, password ) fadeCamera(source, true) setCameraTarget(source) triggerClientEvent ( source, "closeLoginGUI", source ) outputChatBox("Enjoy your time!", source) else outputChatBox("invalid username and password. Please re-connect and try again.", source) end end addEvent("submitLoginEM",true) addEventHandler("submitLoginEM",root, loginHandler) function registerPlayerEM ( username, password ) if ( password ~= "" and password ~= nil and username ~= "" and username ~= nil ) then if ( not getAccount ( username ) ) then local accountAdded = addAccount ( username, password ) if ( accountAdded ) then outputChatBox ( "Gracias " .. getPlayerName ( source ) .. ", Ya estas Registrado ahora loggeate", source ) triggerClientEvent ( source, "openLoginGUI", source ) else outputChatBox ( "Error creando la Cuenta por Favor contacta a un Admin.", source ) end else outputChatBox ( "Esta Cuenta Ya Existe..", source ) end else outputChatBox ( "Porfavor Pon tus datos Correctos.", source ) end end addEvent("addAccountEM", true) addEventHandler("addAccountEM", root, registerPlayerEM) thank in advanced Link to comment
abu5lf Posted May 11, 2012 Share Posted May 11, 2012 (edited) guiCheckBoxGetSelected guiCheckBoxSetSelected addEventHandler("onClientGUIClick", root, function () if ( guiCheckBoxGetSelected( GUIEditor_Checkbox[1], true) ) then xmlNodeSetAttribute(xmlFile,"autologin",tostring(true)) end end ) Edited May 11, 2012 by Guest Link to comment
abu5lf Posted May 12, 2012 Share Posted May 12, 2012 Doesnt work D: Copy My Post again Link to comment
Castillo Posted May 12, 2012 Share Posted May 12, 2012 @ElMota: Your code is totally random, you're checking if the checkbox exist, instead of checking if it is selected or not. Also, you're using a non-existent function to save the XML file: saveXmlFile ( ) when it is xmlSaveFile ( theFile ) Link to comment
iFoReX Posted May 12, 2012 Author Share Posted May 12, 2012 yeh , but the username and password saved , the problem is the 'autologin' Link to comment
iFoReX Posted May 12, 2012 Author Share Posted May 12, 2012 nextreme code ? , I find it in the login_panel_esp, and I send to my GUI, but only the XML save , Link to comment
Jaysds1 Posted May 12, 2012 Share Posted May 12, 2012 Sorry, We can't help people who takes scripts from the community... If you ask the uploader/scripter for permission then maybe he could help you Link to comment
Jaysds1 Posted May 12, 2012 Share Posted May 12, 2012 Well, that's what I thought when i was new here, but since it's someone else work then it's not really open-source... unless the scripter says that it's open-source 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