I have been trying to create a tool menu but I can't figure out how to make it look like the garrysmod tool menu. Can anyone help? At the moment I have this, which changes the palyer's tool when they click it, but all of the items are grey, unlike the garysmod menu where they alternate colour.
[lua]
local tools = {}
tools[1] = "wire"
tools[2] = "rope"
tools[3] = "dynamite"
tools[4] = "button"
text = {}
text["wire"] = "Hola"
local frame = vgui.Create("DFrame")
frame:Center()
frame:SetSize(440,400)
frame:SetTitle("Spawn Menu")
frame:MakePopup()
local ToolIconCategory = vgui.Create("DCollapsibleCategory", frame)
ToolIconCategory:SetPos(10, 200)
ToolIconCategory:SetSize(200, 160)
ToolIconList = vgui.Create("DPanelList", frame)
ToolIconList:EnableVerticalScrollbar( true )
ToolIconList:EnableHorizontal( false )
ToolIconList:SetDrawBackground( false )
ToolIconList:SetAutoSize( true )
for k,v in pairs(tools) do
local icon = vgui.Create( "ToolMenuButton", IconList )
if text[v] then
icon:SetText( text[v] )
else icon:SetText(v)
end
icon.OnSelect = function( icon ) surface.PlaySound( "ui/buttonclickrelease.wav" ) RunConsoleCommand("gmod_toolmode", v) end
ToolIconList:AddItem( icon )
end
[/lua]
bump
Sorry, you need to Log In to post a reply to this thread.