SimpleNoob Posted February 14, 2016 Posted February 14, 2016 Hello, im working in a vehicle system and i want to save the players vehicle in a file (im thinking on xml or json) and dont remove it when the admin's script restart. My script is getting the players vehicle, but how i can save it into a table and send the table into json? and later to get it and do a loading of that vehicles when the script starts? Im really dont know how to save that vehicles without creating it from 0. Thanks for all and sorry for the bad english :c
Overkillz Posted February 14, 2016 Posted February 14, 2016 Maybe this can help u local xml = xmlCreateFile("vehicledata.xml","vehicledata") xmlNodeSetAttribute(xml,"vehicletoSave","") local xmlFile = xmlLoadFile("vehicledata.xml","vehicledata") xmlNodeGetAttribute(xmlFile,"vehicledata") regards.
SimpleNoob Posted February 14, 2016 Author Posted February 14, 2016 One question, xmlLoadFile dont have only one argument? i mean, in the wiki says that only need the filepath, what is vehicledata?
SimpleNoob Posted February 14, 2016 Author Posted February 14, 2016 Sorry for the double post, how i can get all the data into one child? i have this created "test"> "test2"> "bull"> with this function setFileChild(player,cmd,data) local node = xmlLoadFile("vehicle.xml") local subnode = xmlCreateChild(node,"vehicle") local sucess = xmlNodeSetAttribute(subnode,"vehicletest",data) xmlSaveFile(node) xmlUnloadFile(node) end addCommandHandler("data",setFileChild) how can get all into "vehicle" child and output all?
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