Plate Posted February 2, 2013 Posted February 2, 2013 Hola tengo un problema con este script es que me da bad argument xmlNodeSetAttribute en el segundo node el script: function HL(player, teamName ) local theTeam = getTeamFromName ( teamName ) if ( theTeam ) then setPlayerTeam ( player , theTeam ) local xml = xmlCreateFile("Lideres.xml","Lideres") local name = xmlCreateChild(xml, "Lideres") xmlNodeSetAttribute(name,"Lider", getPlayerName(player)) xmlNodeSetAttribute(name,"Team", getPlayerTeam(player)) xmlSaveFile(xml) xmlUnloadFile(xml) end end addEvent("onClanLiderAdd", true) addEventHandler("onClanLiderAdd", getRootElement(), HL) Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Castillo Posted February 2, 2013 Posted February 2, 2013 El error es en el argumento numero 3? si es asi, entonces es porque getPlayerTeam devuelve un elemento, no un nombre. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Plate Posted February 2, 2013 Author Posted February 2, 2013 Gracias solid PD: Tengo un problema con este script que creo alex pero yo lo modifique para que guarde solamente los teams que se crean con el panel que cree pero no me da ningun error y tampoco guarda los teams addEventHandler( "onResourceStart", resourceRoot, function () for k, i in ipairs (xmlNodeGetChildren( xmlLoadFile( "Clan.xml" ) )) do local r,g,b = unpack( fromJSON( xmlNodeGetAttribute(i, "color") )) createTeam( xmlNodeGetAttribute(i, "name"),tonumber(r), tonumber(g), tonumber(b)) end end ) function clansave () local xml = fileCreate ( "Clan.xml" ) fileWrite( xml, "\n" ) for k, i in ipairs(getElementsByType( "team" )) do local r, g, b = getTeamColor ( i ) local colors = {r, g, b} fileWrite( xml, "\""..getTeamName( i ).."\" color=\""..toJSON(colors).."\"/> \n") end fileWrite( xml, " \n" ) fileClose(xml) end addEvent("onClanCreate", true) addEventHandler("onClanCreate", resourceRoot, clansave) Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Recommended Posts