Custom images on maps
#1
I noticed that you can change individual pixels on maps using SetPixel in cMap. I had an idea of creating a plugin (similar to Bukkit plugins) that downloads an image from the internet, resizes it to the size of a map, fetches the colors from the pixels in the image and places them on the map with SetPixel. However, I have no idea how to manipulate the image easily with Lua. Does anyone have any ideas?

(Map in this case is the map item that you can hold in your hand and place)

The code I have written so far. It currently only downloads the image:

Code:
Connect = {} function Initialize(Plugin) Plugin:SetName(g_PluginInfo.Name) dofile(cPluginManager:GetPluginsPath() .. "/InfoReg.lua") RegisterPluginInfoCommands() LOG("Initialised " .. Plugin:GetName()) return true end function HandleMapImageCommand(Split, Player) if Split[2] == nil then Player:SendMessageInfo("Usage: " .. Split[1] .. " <imageurl>") else local URL = Split[2] local FileName = URL:match("([^/]+)$") cUrlClient:Get(Split[2], function(Body, Data) local Image = io.open(FileName, "wb") Image:write(Body) Image:close() local Image = nil end ) end return true end function OnDisable() LOG("Disabled " .. cPluginManager:GetCurrentPlugin():GetName() .. "!") 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: 1 Guest(s)