local MENU = LugentMenu local ExampleCVar = CV_RegisterVar({"example_cvar", "50", 0, {MIN = 0, MAX = 100}}) local ExampleCVar2 = CV_RegisterVar({"example_cvar2", "50", CV_FLOAT, {MIN = 0, MAX = 100*FU}}) local function ExampleAction(menu) CONS_Printf(consoleplayer, "Hello!") S_StartSound(nil, sfx_menu1, consoleplayer) end local ExampleVariable = 0 local ExampleMenu = { { x_pos = 30, y_pos = 30, header_text = "Example Menu", header_color = V_YELLOWMAP, start_item = 2, previous_page = -1, previous_item = -1, no_background = false, -- false or nil to have a default translucent background black screen, true for no background scroll = false, -- false or nil to standard menu, true for scroll menu -- ignores if "drawer" is defined entries = { -- most of these attributes are stackeable {header = true, text = "Header", y_pos = 0}, {text = "Text", y_pos = 12}, {text = "Action", action = ExampleAction, y_pos = 22}, {text = "CVar - Integer", cvar = ExampleCVar, y_pos = 32}, {text = "CVar - Float", cvar = ExampleCVar2, amount = "0.25", y_pos = 42}, {thintext = true, text = "Thin Text", y_pos = 52}, {disabled = true, text = "Disabled Text", y_pos = 62}, {text = "Color", color = SKINCOLOR_GREEN, y_pos = 72}, {text = "Player", player = 0, y_pos = 100}, {invisible = true, text = "Invisible Text & Range", range = {1000, 2000}, value = 1000, amount = 10, y_pos = 110}, {text = "Input", input = "", y_pos = 120}, {text = "Custom Options", options = {"Option 1", "Option 2", "Option 3", "Option 4"}, value = 1, y_pos = 144}, }, on_open = function(menu, page) CONS_Printf(consoleplayer, "Opened example menu!") S_StartSound(nil, sfx_menu1, consoleplayer) end, on_close = function(menu, page) CONS_Printf(consoleplayer, "Closed example menu!") S_StartSound(nil, sfx_menu1, consoleplayer) end, thinker = function(menu, page) ExampleVariable = (ExampleVariable + 1) % 1000 page.entries[10].invisible = (MENU.Cursor ~= 10) end, drawer = function(v, page) MENU:DrawStandard(v, page) v.drawString(30, 1, "Custom Drawer Support", V_YELLOWMAP|V_ALLOWLOWERCASE|V_TRANSLUCENT, "small-thin") v.drawString(30, 5, "With Thinker Support: " .. ExampleVariable, V_ALLOWLOWERCASE|V_TRANSLUCENT, "small-thin") end, } } COM_AddCommand("example_menu", function(player) MENU:OpenMenu(ExampleMenu, 1) end, COM_LOCAL)