xeon17 Posted August 9, 2014 Share Posted August 9, 2014 Hi guys i want to know how to save color of a radararea in a XML file , for me XML look easiest way to do it because i don't know anything about SQL or Mysql Can anyone give me example to save color of a radar area in xml file , and explain me how everything work. Ty Link to comment
Et-win Posted August 9, 2014 Share Posted August 9, 2014 local file = xmlCreateFile("file.xml", "data") local child = xmlCreateChild(file, "radararea") xmlNodeSetAttribute(child, "colorR", yourcolorR) xmlNodeSetAttribute(child, "colorG", yourcolorG) xmlNodeSetAttribute(child, "colorB", yourcolorB) xmlSaveFile(file) xmlUnloadFile(file) Fast-typed, can be wrong, but doubt it. Here are all XML functions: https://wiki.multitheftauto.com/wiki/Xml Link to comment
xeon17 Posted August 9, 2014 Author Share Posted August 9, 2014 It's still hard for me but , i'll check every function . Should i put my xml code in the Lua file , where i created the radar area or there is any way i can save all radar areas on server? Link to comment
Et-win Posted August 9, 2014 Share Posted August 9, 2014 local gAreas = getElementsByType("radararea") for placeNumber, areaData in ipairs(gAreas) do --Get stuff and place them into XML end --Later, when you want to receive them: local xmlLoadFile("file.xml") local child = xmlFindChild(file, local gChildren = xmlNodeGetChildren(child) for placeNumber, childrenData in ipairs(gChildren) do --Get attributes (Like position, colors, etc.) and use them end Just make a random XML file, and try creating some childs and finding them. Also with attributes. Explanations are on wiki. 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