piras Posted July 26, 2010 Share Posted July 26, 2010 Hello, I am trying to save some stuff with these functions. They are not returning errors but the file is not getting saved. I can call xmlNodeGetAttributes on the node Im trying to save and it works as expected. function saveRamps() outputDebugString("saveRamps()", 0) local xml = xmlCreateFile("savedRamps.xml", "ramps") local rampXml if not xml then outputConsole("Couldnt CREATE xml file.", 0) end --<<=== This seems to work OK. for rampName,rampTabElement in pairs(win.ramps) do if type(rampTabElement) == "table" and rampTabElement.type == "tab" then rampXml = xmlCreateChild(xml, rampName) xmlNodeSetAttribute(rampXml, "modelId", rampTabElement.modelIdEdit:getValueAsString()) xmlNodeSetAttribute(rampXml, "topAngle", rampTabElement.topAngleEdit:getValueAsString()) xmlNodeSetAttribute(rampXml, "radius", rampTabElement.radiusEdit:getValueAsString()) xmlNodeSetAttribute(rampXml, "resolution", rampTabElement.resolutionEdit:getValueAsString()) xmlNodeSetAttribute(rampXml, "length", rampTabElement.lengthEdit:getValueAsString()) tableOut(xmlNodeGetAttributes(rampXml)) --<=== This works OK, everything looks fine. end end if not xmlSaveFile(xml) then outputConsole("Couldnt SAVE xml file.", 0) end --<=== This seems to work OK. end I can load an xml file with xmlLoadFile. Have I done something wrong like not called a function before calling xmlSaveFile, or something ... Link to comment
piras Posted July 27, 2010 Author Share Posted July 27, 2010 By the way this was on a client side script. I managed to get around it, by sending all the data to the server with triggerServerEvent() and use the xml functions from the server side and they work from the server side. Link to comment
dzek (varez) Posted July 28, 2010 Share Posted July 28, 2010 notice your files on client-side script will be created in MTA\mods\deathmatch\resources\res_name\ not in MTA\server\mods\deathmatch\resources\res_name\ when i was making xml i was looking it automatically in server files ;/ Link to comment
piras Posted July 28, 2010 Author Share Posted July 28, 2010 Good man varez, I was also looking in /server/... I looked in the other directory, and there were the files... 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