Jump to content

Fetching Maps from a Website


Recommended Posts

addEventHandler("onResourcePreStart", rootElement,
	function (startingResource)
	  fetchRemote("http://link.com/maps/",  
         function(data, errno)  
               if errno == 0 then outputChatBox("Error fetching maps: " .. errno) return end  
         end) 

		--Is starting resource a gamemode?
		if isGamemode(startingResource) then
			--Check if another gamemode is running already
			if getRunningGamemode() and getRunningGamemode() ~= startingResource then
				-- Initiate a new changemode sequence and cancel this event
				outputMapManager( "Initiating changemode from '" .. getResourceName(getRunningGamemode()) .. "' to '" .. getResourceName(startingResource) .. "'" )
				changeGamemode(startingResource)
				cancelEvent(true)
			end
		elseif isMap(startingResource) then
			--Check if another map is running already
			if getRunningGamemodeMap() and getRunningGamemodeMap() ~= startingResource then
				-- Initiate a new changemap sequence and cancel this event
				if isGamemodeCompatibleWithMap ( getRunningGamemode(), startingResource ) then
					outputMapManager( "Initiating changemap from '" .. getResourceName(getRunningGamemodeMap()) .. "' to '" .. getResourceName(startingResource) .. "'" )
					changeGamemodeMap(startingResource)
				end
				cancelEvent(true)
			end
		end
	end
)

So this is the default mapmanager, can't really figure out how to actually fetch the maps, so maps are uploaded via .ZIP format on to the website, and I'm trying to get all the maps, and load them instead of the default location [maps]. How should I do it?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...