Using the hook menu
Example:
Menu line: Name_player Image Kills
-- save the background image somewhere
bg = {}
function superMenu(pid)
menu(pid,"My Image Menu@i,1,2,3,4,5,6,7,8,9")
local img = image("pixel.png", 0, 0, 2, pid)
imagescale(img, 2000, 2000) -- fill whole screen
imagecolor(img, 0, 0, 0) -- gray looking
imagealpha(img, 0.9) -- kinda transparent
bg[pid] = img -- save image so we can delete it later
--[[
Draw Stuff for each button
]]--
end
function superMenuClose(pid)
local img = bg[pid]
if (img) then freeimage(img); bg[pid] = nil; end
--[[
Freeimage Stuff for each button
]]
end
addhook("menu","Hmenu")
function Hmenu(pid, t, b)
if (t=="My Image Menu") then
--[[
For each button press code
]]
msg2(pid,"You pressed "..b.." in my super menu :D")
superMenuClose(pid)
end
end
-- Open Menu for player pid=1
superMenu(1)