Ulysses

General => Developers Corner => Topic started by: riki137 on September 15, 2010, 07:18:29 AM

Title: Console Command by Button
Post by: riki137 on September 15, 2010, 07:18:29 AM
Code: [Select]
local window = vgui.Create( "DFrame" )
window:SetSize( 200,70 )
window:Center()
window:SetTitle( "DButton Test" )
window:MakePopup()
 
local button = vgui.Create( "DButton", window )
button:SetSize( 100, 30 )
button:SetPos( 50, 30 )
button:SetText( "Test Button" )
button.DoClick = function( button )
-- What function here to do a console command
end
Title: Re: Console Command by Button
Post by: Megiddo on September 15, 2010, 07:58:17 AM
RunConsoleCommand (http://wiki.garrysmod.com/?title=G.RunConsoleCommand) is your best option.
Title: Re: Console Command by Button
Post by: riki137 on September 15, 2010, 08:12:54 AM
Thanks, i'm really just a beginner  ::)
Title: Re: Console Command by Button
Post by: Megiddo on September 15, 2010, 08:53:51 AM
No problem, just spend some time exploring the gmod wiki. :)