iFoReX Posted September 21, 2012 Posted September 21, 2012 Bueno, como dice en el titulo, aparece este error en la console, 'aca' era mi nick, porfavor ayudenme a solucionarlo [2012-09-21 02:28:55] WARNING: ElMota\server.lua:19: Bad argument @ 'logIn' [Expected account at argument 2, got string 'aca'] client label = {} RGUI = guiCreateWindow(0.3703,0.3503,0.2914,0.2695,"Register Panel",true) guiWindowSetMovable(RGUI,false) guiWindowSetSizable(RGUI,false) label[1] = guiCreateLabel(25,47,317,20,"Registrate ya !, asi guardaras datos y todo eso...",false,RGUI) guiSetFont(label[1],"clear-normal") EPassword = guiCreateEdit(21,91,155,32,"",false,RGUI) Registrarme = guiCreateButton(181,90,92,32,"Registrarme !",false,RGUI) label[2] = guiCreateLabel(63,124,76,17,"CONTRASEÑA",false,RGUI) guiSetFont(label[2],"default-bold-small") label[3] = guiCreateLabel(15,149,183,21,"Ve ya a nuestro nuevo Foro ! ...",false,RGUI) label[4] = guiCreateLabel(107,174,171,18,"http://bhzserver.forochile.com",false,RGUI) LGUI = guiCreateWindow(0.4516,0.3112,0.1758,0.1237,"Loguin GUI(60 Sec)",true) guiWindowSetSizable(LGUI,false) Lpassword = guiCreateLabel(20,36,54,19,"Password",false,LGUI) EPasswordL = guiCreateEdit(77,28,137,33,"",false,LGUI) Login = guiCreateButton(16,64,200,22,"Login",false,LGUI) guiSetVisible(RGUI,false) showCursor(false) guiSetVisible(LGUI,false) addEventHandler("onClientResourceStart",resourceRoot, function() triggerServerEvent("on:Visible:", getLocalPlayer()) end ) function clientSubmitaccount ( button, state ) if ( button == "left" and state == "up" ) then local username = getPlayerName( getLocalPlayer() ) local password = guiGetText(EPassword) if ( username and password ) then triggerServerEvent("cuenta", localPlayer, username, password) else outputChatBox("Porfavor pon tu Nick y tu Contraseña.") end end end addEventHandler("onClientGUIClick", Registrarme, clientSubmitaccount, false) addEvent ( "closeLoginGUI", true ) addEventHandler ( "closeLoginGUI", root, function ( ) guiSetVisible ( RGUI, false ) showCursor ( false ) guiSetVisible( LGUI, false ) end ) function clientSubmitLogin ( button, state ) if ( button == "left" and state == "up" ) then triggerServerEvent("archivo", localPlayer, file) local username = xmlNodeGetAttribute( file, "name" ) local password = guiGetText(EPasswordL) 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", Login, clientSubmitLogin, false) addEvent("openLGUI",true) addEventHandler("openLGUI", root, function() guiSetVisible(LGUI,true) showCursor(true) end ) addEvent("openRGUI",true) addEventHandler("openRGUI", root, function() guiSetVisible(RGUI,true) showCursor(true) end ) server addEvent("cuenta", true) addEventHandler("cuenta", root, function ( 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 y loggeado", source ) local file = xmlCreateFile(username .." .xml","root") local node = xmlCreateChild(file,"stats") xmlNodeSetAttribute( node, "name", username ) local check = xmlNodeSetAttribute( node, "pass", password) xmlSaveFile(file) if file then outputChatBox ( "Tu Character se a creado con exito !.", source ) triggerClientEvent ( source, "closeLoginGUI", source ) logIn ( source, xmlNodeGetAttribute( node, "name" ), xmlNodeGetAttribute( node, "pass" ) ) end 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 ) function loginHandler(username,password) if ( username ) then 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 end addEvent("submitLoginEM",true) addEventHandler("submitLoginEM",root, loginHandler) addEvent("on:Visible:",true) addEventHandler("on:Visible:",root, function() local username = getPlayerName( source ) local file = xmlLoadFile( username .." .xml" ) if ( file ) then triggerClientEvent(source, "openLGUI", source) elseif not ( file ) then triggerClientEvent(source, "openRGUI", source) end end ) addEvent("archivo", true) addEventHandler("archivo", root, function( file ) local username = getPlayerName( source ) local file = xmlLoadFile( username .." .xml" ) end ) elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Castillo Posted September 21, 2012 Posted September 21, 2012 addEvent("cuenta", true) addEventHandler("cuenta", root, function ( 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 y loggeado", source ) local file = xmlCreateFile(username .." .xml","root") local node = xmlCreateChild(file,"stats") xmlNodeSetAttribute( node, "name", username ) local check = xmlNodeSetAttribute( node, "pass", password) xmlSaveFile(file) if file then outputChatBox ( "Tu Character se a creado con exito !.", source ) triggerClientEvent ( source, "closeLoginGUI", source ) logIn ( source, getAccount ( xmlNodeGetAttribute( node, "name" ), xmlNodeGetAttribute( node, "pass" ) ), xmlNodeGetAttribute( node, "pass" ) ) end 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 ) function loginHandler(username,password) if ( username ) then 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 end addEvent("submitLoginEM",true) addEventHandler("submitLoginEM",root, loginHandler) addEvent("on:Visible:",true) addEventHandler("on:Visible:",root, function() local username = getPlayerName( source ) local file = xmlLoadFile( username .." .xml" ) if ( file ) then triggerClientEvent(source, "openLGUI", source) elseif not ( file ) then triggerClientEvent(source, "openRGUI", source) end end ) addEvent("archivo", true) addEventHandler("archivo", root, function( file ) local username = getPlayerName( source ) local file = xmlLoadFile( username .." .xml" ) end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
iFoReX Posted September 21, 2012 Author Posted September 21, 2012 Gracias Solid funciona , pero luego al reconectar Aparece el panel Login, coloco la pass correctamente y me da error en la linea 56 del client, Bad Argument 'xmlNodeGetAttribute' elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Renkon Posted September 21, 2012 Posted September 21, 2012 file es nulo... por eso te olvidaste de agregarlo a un xmlReadFile
iFoReX Posted September 21, 2012 Author Posted September 21, 2012 ._. no entiendo lo podrias añadir al script plz elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Renkon Posted September 21, 2012 Posted September 21, 2012 ._. no entiendo lo podrias añadir al script plz No seas vago. Y ponlo tú. Falta "declarar" la variable FILE y darle un VALOR Tendrías que usar xmlLoadFile para esto.
iFoReX Posted September 21, 2012 Author Posted September 21, 2012 local file = xmlLoadFile( username .." .xml" ) creo ya use eso. elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
iFoReX Posted September 21, 2012 Author Posted September 21, 2012 es que si lo coloco en clientside no lo leera porque en clientside no significa que este en el resource, sino que es el que el player descarga elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Renkon Posted September 21, 2012 Posted September 21, 2012 tu quieres hacer un sistema de 'guardar contraseña'? o de autologin? porque si es así el xml tiene que estar client side..
iFoReX Posted September 21, 2012 Author Posted September 21, 2012 no, ya funciona, si lo que no funciona es solo ese error, es que hare un save system mediante XML, entonces cada player tendra su XML, Y despues lo usare para muchos otros resources ( debido a que mi server sera RPG/DM ) elMota/elFoReX De Vuelta En MTA *---------* Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3 https://www.youtube.com/user/KillersGPs
Recommended Posts