Jump to content

Preciso de uma ajuda no XML


Recommended Posts

Eu to editando meu painel de criar base e to antes nao tinha como alterar a senha da base pelo painel e acabei criando 1 so que que estou com problema na hora de salvar no xml no caso substituir a senha que ja conta no xml por uma nova veja se esta correto e por favor me ajuda a resolver 

 

addEvent("editGate",true)
addEventHandler("editGate",getRootElement(),function(baseName,gateName,pass)
	local xml = xmlLoadFile("Bases.xml")
	for i,node in pairs(xmlNodeGetChildren(xml))do
		if xmlNodeGetName(node) == baseName then
		    local gateInfo = xmlFindChild(node,"baseName")
            local gate = xmlFindChild(gateInfo,"Gates")
			local gates = xmlFindChild(gate,gateName:gsub(" ","Space"),0)
			if gates then
				xmlNodeSetAttribute(gates,"pass",pass)
			end
			xmlSaveFile(xml)
			alert("Base edited!",source)
		end
	end
	xmlUnloadFile(xml)
	refreshGates(baseName)
end)

um exemplo do meu xml é esse aqui quando salva 

<Gates>
            <PortãoSpacedaSpaceFrente X="-95.199996948242" Y="-2180.1999511719" Z="30.5" RX="0" RY="0" RZ="0" openMode="Up/Down" objectScale="1" moveScale="5" pass="1" modelID="2938"></PortãoSpacedaSpaceFrente>
            <Teto X="-38.799999237061" Y="-2180.3000488281" Z="37.590000152588" RX="0" RY="0" RZ="180" openMode="West/East" objectScale="1" moveScale="-30" pass="2" modelID="6959"></Teto>
        </Gates>

 

Edited by felipebaidoloko
Link to comment
  • Other Languages Moderators
On 27/12/2017 at 18:48, felipebaidoloko said:

um exemplo do meu xml é esse aqui quando salva 


<Gates>
            <PortãoSpacedaSpaceFrente X="-95.199996948242" Y="-2180.1999511719" Z="30.5" RX="0" RY="0" RZ="0" openMode="Up/Down" objectScale="1" moveScale="5" pass="1" modelID="2938"></PortãoSpacedaSpaceFrente>
            <Teto X="-38.799999237061" Y="-2180.3000488281" Z="37.590000152588" RX="0" RY="0" RZ="180" openMode="West/East" objectScale="1" moveScale="-30" pass="2" modelID="6959"></Teto>
        </Gates>

 

Não use acentos nos nomes, exceto se for uma string.

A senha do portão fica no pass?

Edited by Lord Henry
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...