John_Scott Posted October 30, 2014 Share Posted October 30, 2014 Hi! First thing: I would like to create a few markers to my sevrvers and set a category to everyone, like: <marker posX="2158.87" posY="943.16" posZ="11.5" type="arrow" category="gunshop"/> Now, i just need to playce all of these markers to the server, but IDK how to load all lines from this file. Second thing: I would like to add a category to all marker, to decide it's a gunshop, a vehicleshop, or what?! How can I get this value in the onMarkerHit function, like this?: if (*markertype == "gunshop") then *Show gunshop GUI* elseif (*markertype == "vehicleshop") then *Show vehicleshop GUI end Thanks for all help! Link to comment
ALw7sH Posted October 30, 2014 Share Posted October 30, 2014 xmlLoadFile xmlFindChild xmlNodeGetAttribute xmlUnloadFile Link to comment
John_Scott Posted October 30, 2014 Author Share Posted October 30, 2014 xmlLoadFile xmlFindChild xmlNodeGetAttribute xmlUnloadFile If you no have enought time to give me a true answer, why give me any answer? I know these functions, but I can't use to what I would like. Link to comment
Woovie Posted October 30, 2014 Share Posted October 30, 2014 xmlLoadFile xmlFindChild xmlNodeGetAttribute xmlUnloadFile If you no have enought time to give me a true answer, why give me any answer? I know these functions, but I can't use to what I would like. You didn't state you knew these functions. We encourage learning, not leeching. function markerLoader() local types = {"posX", "posY", "posZ", "type", "category"} local mapPositions = xmlLoadFile ("filename.xml") local mapTable = {} for k,v in ipairs(xmlNodeGetChildren(mapPositions)) do mapTable[k] = {} for j,l in ipairs(types) do table.insert(mapTable[k],xmlNodeGetAttribute(mapPositions,l)) end local marker = createMarker(mapTable[k][1], mapTable[k][2], mapTable[k][3], mapTable[k][4]) setElementData (marker, "category", mapTable[k][5]) end end No promises that this works. I wrote it real quick on a lunch break. It should load an XML like so. <markers> <marker posX="2158.87" posY="943.16" posZ="11.5" type="arrow" category="gunshop"/> <marker posX="2158.87" posY="943.16" posZ="11.5" type="arrow" category="gunshop"/> <marker posX="2158.87" posY="943.16" posZ="11.5" type="arrow" category="gunshop"/> <marker posX="2158.87" posY="943.16" posZ="11.5" type="arrow" category="gunshop"/> </markers> 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