iFoReX Posted June 18, 2012 Share Posted June 18, 2012 Bueno amigos, como ya sabran estoy empezando a ocupar funciones XML, y queria hacer un sistema de reportes/pedidos XML con gridLists ya voy en la mitad, pero tengo un problema, cuando ya le pongo el motivo y la descripcion de este reporte/pedido, me aparece que se a creado satisfactoriamente, pero esto pasa : -.se me crea un archivo llamado .xml ( espacio .xml ) -. me aparece esto dentro : "" descripcionR="ElMota" creadorR="Teeeesteando" estadoR="leido"> aqui los codigos cl-side GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(290,102,773,586,"Reportes GUI",false) GUIEditor_Label[1] = guiCreateLabel(21,39,514,21,"Bueno amigos esta GUI esta echa para que pongan sus reportes y pedidos acerca del server",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(18,66,406,22,"Tu numero de reportes es .. xmlNodeGetAttribute( reportes, \"numero\" )",false,GUIEditor_Window[1]) GUIEditor_Grid[1] = guiCreateGridList(13,100,743,417,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) guiGridListAddColumn(GUIEditor_Grid[1],"#",0.1) guiGridListAddColumn(GUIEditor_Grid[1],"Motivo",0.4) guiGridListAddColumn(GUIEditor_Grid[1],"Estado",0.1) guiGridListAddColumn(GUIEditor_Grid[1],"Creador",0.3) GUIEditor_Button[1] = guiCreateButton(471,527,135,47,"Cancelar",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(610,527,135,47,"Crear nuevo reporte",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(12,522,139,55,"Leer Reporte",false,GUIEditor_Window[1]) GUIEditor_Window[2] = guiCreateWindow(445,252,493,344,"Creacion del reporte",false) GUIEditor_Label[3] = guiCreateLabel(220,32,37,18,"Motivo",false,GUIEditor_Window[2]) GUIEditor_Edit[1] = guiCreateEdit(237,-1025,5,680,"",false,GUIEditor_Window[2]) GUIEditor_Edit[2] = guiCreateEdit(25,59,436,31,"",false,GUIEditor_Window[2]) GUIEditor_Label[4] = guiCreateLabel(209,106,61,20,"Descripcion",false,GUIEditor_Window[2]) GUIEditor_Memo[1] = guiCreateMemo(24,139,437,125,"",false,GUIEditor_Window[2]) GUIEditor_Button[4] = guiCreateButton(333,275,121,49,"Crear !",false,GUIEditor_Window[2]) GUIEditor_Button[5] = guiCreateButton(205,275,121,49,"Cancelar",false,GUIEditor_Window[2]) GUIEditor_Window[3] = guiCreateWindow(456,228,482,353,"xmlNodeGetAttribute( reportes, 'motivo' )",false) GUIEditor_Memo[2] = guiCreateMemo(18,105,442,192,"",false,GUIEditor_Window[3]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Button[6] = guiCreateButton(311,305,142,32,"Volver",false,GUIEditor_Window[3]) GUIEditor_Button[7] = guiCreateButton(169,309,131,26,"Borrar",false,GUIEditor_Window[3]) GUIEditor_Edit[3] = guiCreateEdit(20,48,436,33,"",false,GUIEditor_Window[3]) guiEditSetReadOnly(GUIEditor_Edit[3],true) guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[3],false) guiSetVisible(GUIEditor_Button[3],false) showCursor(false) addCommandHandler("report", function() guiSetVisible(GUIEditor_Window[1],true) showCursor(true) end ) addEventHandler("onClientGUIClick", root, function() if source == GUIEditor_Button[1] then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) elseif source == GUIEditor_Button[2] then guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) elseif source == GUIEditor_Button[4] then local motivo = guiGetText(GUIEditor_Edit[1]) local descripcion = guiGetText(GUIEditor_Edit[2]) local creador = getPlayerName(getLocalPlayer()) triggerServerEvent("crear:Report", localPlayer, motivo, creador, descripcion) elseif source == GUIEditor_Button[5] then guiSetVisible(GUIEditor_Window[1],true) guiSetVisible(GUIEditor_Window[2],false) end end ) sv-side addEvent("crear:Report",true) addEventHandler("crear:Report",root,function(motivo,descripcion,creador) local reporteXML = xmlCreateFile( ":reportGUI/reportes/"..motivo..".xml", "reporte" ) local contenido = xmlCreateChild( reporteXML, "reporte:" ) local motivoXML = xmlNodeSetAttribute( contenido, "motivoR", motivo ) local descripcionXML = xmlNodeSetAttribute( contenido, "descripcionR", descripcion ) local creadorXML = xmlNodeSetAttribute( contenido, "creadorR", creador ) local estadoXML = xmlNodeSetAttribute( contenido, "estadoR", 'leido' ) xmlSaveFile(reporteXML) if ( reporteXML ) then outputChatBox("Reporte Creado Exitosamente",source) end end ) gracias de antemano u.u Link to comment
Castillo Posted June 18, 2012 Share Posted June 18, 2012 No entiendo cual es el problema. Link to comment
iFoReX Posted June 18, 2012 Author Share Posted June 18, 2012 que en descripcionR aparece el nombre del Cliente ( del creador del reporte/pedido ), en creadorR aparece el motivo, y en descripcionR no aparece la descripcion Link to comment
Castillo Posted June 18, 2012 Share Posted June 18, 2012 Eso es por que envias los datos de esa manera, ordenaste los argumentos mal en el server side: triggerServerEvent("crear:Report", localPlayer, motivo, creador, descripcion) Pero en el server side pusiste: function(motivo,descripcion,creador) Es algo facil de arreglar. Link to comment
iFoReX Posted June 18, 2012 Author Share Posted June 18, 2012 Solid ya lo arregle lo de los argumentos , sigue quedando asi ( espacio .xml ) y asi queda el archivo xml "" descripcionR="motivo Test" creadorR="ElMota" estadoR="no leido"> Link to comment
Castillo Posted June 18, 2012 Share Posted June 18, 2012 "motivo Test" "motivo" deberia ir en: "motivoR" y "Test" en "descripcionR"? Link to comment
iFoReX Posted June 18, 2012 Author Share Posted June 18, 2012 no , motivo Test era el motivoR y la descripcion era descripcion Test pero no se obtuvo en el archivo xml Link to comment
Recommended Posts