Can someone give me an example of a derma menu with a icon and 2 rows of text on the right.
[lua]function MyPanel() – Make a function so we can call the menu later
– The initial frame that holds everything
local frame = vgui.Create(“DFrame”) – Make the frame
frame:SetSize(600,600) – The frame is 600x600 units
frame:Center() – Instead of frame:SetPos(), using Center() is convenient as it automatically centers it
frame:SetTitle(“Test Menu”) – Shows up at the top of the menu
frame:MakePopup() – This allows the player to use their mouse
frame.Paint = function() – Paint allows us to override the drawing of the frame to both draw text and make it look cooler
draw.RoundedBox(3,0,0,frame:GetWide(),frame:GetTall(),Color(0,0,0,200)) -- This draws a black, semi transparent frame that looks cool :D draw.DrawText("Text line 1
Text line 2
Text line 3
– This draws the text you want at the very center of the frame.
– This is the icon you’re looking for
local icon = vgui.Create(“DImage”,frame) – Make an image, and the “,frame” parents it to the frame
icon:SetPos(10,10) – Put it at 10,10 relative to the frame
icon:SetImage(“console/gmod_logo”) – DImages use materials to show an image, so we use the gmod logo
concommand.Add(“mymenu”,MyPanel) – Allows us to open the menu with a concommand[/lua]
I’m gonna use the hook call feature. Gonna work off this. TY
You mean hook.Add? Bear in mind that this can only be called from the client; you can’t make a hook serverside and open the menu there, unless you use ply:ConCommand().
Here’s how and what I was talking about.
The key that calls the menu.
The bottom of the menu where you had concommand
I was talking about hook call feature, By this I mean when a key is pressed it calls the hook via the key.
I’m not creating a new bind, I’m using a key already used.