Custom images on maps
#3
The code does this:
  • Add map to player inventory with damage value 1, if not existent
  • Call callback on the map
  • For loop with x,y = 1-  100, the size is by default 128 x 128
  • Set the pixel to cMap.E_BASE_COLOR_TRANSPARENT
Don't see any change, maybe a missing packet update to the player.

Add the code in a plugin and register the command:
cPluginManager:BindCommand("/testmap", "testmap", CommandTestMap, "testmap")

function CommandTestMap(a_Split, a_Player)
	if not(a_Player:GetInventory():HasItems(cItem(E_ITEM_MAP,1, 1))) then
	-- Add map
		a_Player:GetInventory():AddItem(cItem(E_ITEM_MAP, 1, 1))
	end

	a_Player:GetWorld():GetMapManager():DoWithMap(1, -- damage value = item id of map
	function(a_Map)
		a_Player:SendMessage("Callback called")
		for x = 1, 100 do
			for y = 1, 100 do
				a_Map:SetPixel(x, y, cMap.E_BASE_COLOR_TRANSPARENT)
			end
		end
	end)
	a_Player:SendMessage("Done!")
	return true
end
Reply
Thanks given by:


Messages In This Thread
Custom images on maps - by Mathias - 05-18-2017, 10:27 PM
RE: Custom images on maps - by NiLSPACE - 05-18-2017, 10:38 PM
RE: Custom images on maps - by Seadragon91 - 05-18-2017, 11:06 PM
RE: Custom images on maps - by Seadragon91 - 05-18-2017, 11:32 PM
RE: Custom images on maps - by Mathias - 05-19-2017, 01:03 AM
RE: Custom images on maps - by BillBodkin - 11-21-2019, 08:43 PM



Users browsing this thread: 2 Guest(s)