ULX

Author Topic: Console Command by Button  (Read 2645 times)

0 Members and 1 Guest are viewing this topic.

Offline riki137

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
  • lol wuttermelon
    • SapphireWebsites
Console Command by Button
« 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

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Console Command by Button
« Reply #1 on: September 15, 2010, 07:58:17 AM »
RunConsoleCommand is your best option.
Experiencing God's grace one day at a time.

Offline riki137

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
  • lol wuttermelon
    • SapphireWebsites
Re: Console Command by Button
« Reply #2 on: September 15, 2010, 08:12:54 AM »
Thanks, i'm really just a beginner  ::)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Console Command by Button
« Reply #3 on: September 15, 2010, 08:53:51 AM »
No problem, just spend some time exploring the gmod wiki. :)
Experiencing God's grace one day at a time.