Speak Posted November 4, 2013 Posted November 4, 2013 because it does not work I have no errors client function startLoaderMap() outputChatBox("oii") triggerServerEvent("onDownloadingMap",getLocalPlayer()); end addCommandHandler("oie",startLoaderMap) object = {} function goDownloadMap(Objects, object) outputChatBox("OI") for i, v in ipairs(Objects) do local object = createObject(v.model, v.posX, v.posY, v.posZ, v.rotX, v.rotY, v.rotZ) if object then table.insert(Objects, object) end end end addEvent("goDownloadMapDM",true) addEventHandler("goDownloadMapDM",root,goDownloadMap) Server local g_Maps = {}; for k,v in ipairs(getResources()) do if (getResourceInfo(v,"type") == "map") and (getResourceInfo(v,"gamemodes") == "race") and getResourceInfo(v,"name") then local name = getResourceInfo(v,"name") if name then if name:find("[DM]",1,true) then g_Maps[#g_Maps+1] = {getResourceName(v),name,0} end end end end local debug = " DEPURAÇÃO " local debug = outputDebugString("DEBUG OBJECTS".. debug ..--[[Objects ..".. Spawnpoints]]"DEBUG SPAWNPOINTS") local Spawnpoints = {} local Objects = {} addEvent("onDownloadingMap", true) addEventHandler("onDownloadingMap", getRootElement(),function(MapID) local mapName = false MapID = math.random(1,#g_Maps); local mapMeta = xmlLoadFile(":"..mapName.."/meta.xml") local messageNodes = xmlNodeGetChildren(mapMeta) for i,node in ipairs(messageNodes) do if xmlNodeGetName(node) == "object" then table.insert(Objects,{ model = tonumber(xmlNodeGetAttribute(node, "model")), posX = tonumber(xmlNodeGetAttribute(node, "posX")), posY = tonumber(xmlNodeGetAttribute(node, "posY")), posZ = tonumber(xmlNodeGetAttribute(node, "posZ")), rotX = tonumber(xmlNodeGetAttribute(node, "rotX")), rotY = tonumber(xmlNodeGetAttribute(node, "rotY")), rotZ = tonumber(xmlNodeGetAttribute(node, "rotZ")) }) end if xmlNodeGetName(node) == "spawnpoint" then table.insert(Spawnpoints,{ vehicle = tonumber(xmlNodeGetAttribute(node, "vehicle")), posX = tonumber(xmlNodeGetAttribute(node, "posX")), posY = tonumber(xmlNodeGetAttribute(node, "posY")), posZ = tonumber(xmlNodeGetAttribute(node, "posZ")), rotX = tonumber(xmlNodeGetAttribute(node, "rotX")), rotY = tonumber(xmlNodeGetAttribute(node, "rotY")), rotZ = tonumber(xmlNodeGetAttribute(node, "rotZ")) }) end xmlUnloadFile(mapMeta) end triggerLatentClientEvent(source,"goDownloadMapDM",100000,false,root,Objects,object) queLixo() end)
Speak Posted November 5, 2013 Author Posted November 5, 2013 Who made the script? I made the script below works but only loads a map addEvent("onDownloadingMap", true) addEventHandler("onDownloadingMap", getRootElement(),function() local xml = xmlLoadFile("maptest.map") local messageNodes = xmlNodeGetChildren(xml) for i,node in ipairs(messageNodes) do if xmlNodeGetName(node) == "object" then table.insert(Objects,{ model = tonumber(xmlNodeGetAttribute(node, "model")), posX = tonumber(xmlNodeGetAttribute(node, "posX")), posY = tonumber(xmlNodeGetAttribute(node, "posY")), posZ = tonumber(xmlNodeGetAttribute(node, "posZ")), rotX = tonumber(xmlNodeGetAttribute(node, "rotX")), rotY = tonumber(xmlNodeGetAttribute(node, "rotY")), rotZ = tonumber(xmlNodeGetAttribute(node, "rotZ")) }) end if xmlNodeGetName(node) == "spawnpoint" then table.insert(Spawnpoints,{ vehicle = tonumber(xmlNodeGetAttribute(node, "vehicle")), posX = tonumber(xmlNodeGetAttribute(node, "posX")), posY = tonumber(xmlNodeGetAttribute(node, "posY")), posZ = tonumber(xmlNodeGetAttribute(node, "posZ")), rotX = tonumber(xmlNodeGetAttribute(node, "rotX")), rotY = tonumber(xmlNodeGetAttribute(node, "rotY")), rotZ = tonumber(xmlNodeGetAttribute(node, "rotZ")) }) end end xmlUnloadFile(xml) triggerLatentClientEvent(source,"goDownloadMapDM",100000,false,root,Objects,object) queLixo() end ) thanks for replying @ Castilho
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