Can someone give me an example of a derma menu with a icon and 2 rows of text on the right.
Try this:
[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\nText line 2\nText line 3\n","ScoreboardText",frame:GetWide()/2,frame:GetTall()/2,Color(255,0,0,255),1)
-- This draws the text you want at the very center of the frame.
end
-- 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:SetSize(100,100)
icon:SetImage("console/gmod_logo") -- DImages use materials to show an image, so we use the gmod logo
end
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
No problem.
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().
Watch me.
Here's how and what I was talking about.
The key that calls the menu.
[lua]function GM:ShowHelp(ply)
umsg.Start("playermenu", ply)
umsg.End()
end[/lua]
The bottom of the menu where you had concommand
[lua]usermessage.Hook("playermenu", Menu)[/lua]
I was talking about hook call feature, By this I mean when a key is pressed it calls the hook via the key.
[editline]10:01PM[/editline]
I'm not creating a new bind, I'm using a key already used.
Sorry, you need to Log In to post a reply to this thread.