I have a !commands chat command that's not working and I have absoloutly no idea why. Help?
[CODE]--lua/autorun/client
local function CommandList()
local BackGround = vgui.Create( "DFrame" )
BackGround:SetSize( 200, 280 )
BackGround:SetPos( ScrW() * 0.5, ScrH() * 0.5 )
BackGround:SetTitle( "Commands" )
BackGround:SetVisible( true )
BackGround:SetDraggable( true )
BackGround:ShowCloseButton( true )
BackGround:MakePopup()
BackGround:Center()
BackGround.Paint = function()
draw.RoundedBox( 4, 0, 0, BackGround:GetWide(), BackGround:GetTall(), Color( 51, 51, 51, 255 ) )
draw.RoundedBox( 2, 2, 2, BackGround:GetWide()-4, 21, Color( 165, 0, 0, 255 ) )
end
local AButton = vgui.Create( "DButton", BackGround )
AButton:SetSize( 160, 40 )
AButton:SetText( "Open the forums" )
AButton:SetPos( 20, 30 )
AButton.Paint = function()
draw.RoundedBox( 8, 0, 0, AButton:GetWide(), AButton:GetTall(), Color( 255, 255, 255, 255 ) )
end
AButton.DoClick = function(ply)
LocalPlayer():ConCommand( "Forums" )
end
local BButton = vgui.Create( "DButton", BackGround )
BButton:SetSize( 160, 40 )
BButton:SetText( "Donate" )
BButton:SetPos( 20, 80 )
BButton.Paint = function()
draw.RoundedBox( 8, 0, 0, AButton:GetWide(), AButton:GetTall(), Color( 255, 255, 255, 255 ) )
end
BButton.DoClick = function(ply)
LocalPlayer():ConCommand( "Donate" )
end
local CButton = vgui.Create( "DButton", BackGround )
CButton:SetSize( 160, 40 )
CButton:SetText( "How to play TTT" )
CButton:SetPos( 20, 130 )
CButton.Paint = function()
draw.RoundedBox( 8, 0, 0, AButton:GetWide(), AButton:GetTall(), Color( 255, 255, 255, 255 ) )
end
CButton.DoClick = function(ply)
LocalPlayer():ConCommand( "TTTHelp" )
end
local DButton = vgui.Create( "DButton", BackGround )
DButton:SetSize( 160, 40 )
DButton:SetText( "Toggle spectator mode" )
DButton:SetPos( 20, 180 )
DButton.Paint = function()
draw.RoundedBox( 8, 0, 0, AButton:GetWide(), AButton:GetTall(), Color( 255, 255, 255, 255 ) )
end
DButton.DoClick = function(ply)
LocalPlayer():ConCommand( "ToggleSpectate" )
end
local EButton = vgui.Create( "DButton", BackGround )
EButton:SetSize( 160, 40 )
EButton:SetText( "Toggle Motion Blur" )
EButton:SetPos( 20, 230 )
EButton.Paint = function()
draw.RoundedBox( 8, 0, 0, AButton:GetWide(), AButton:GetTall(), Color( 255, 255, 255, 255 ) )
end
EButton.DoClick = function(ply)
LocalPlayer():ConCommand( "MotionBlurToggle" )
end
--[[ local FButton = vgui.Create( "DButton", BackGround )
FButton:SetSize( 160, 40 )
FButton:SetText( "" )
FButton:SetPos( 20, 280 )
FButton.Paint = function()
draw.RoundedBox( 8, 0, 0, AButton:GetWide(), AButton:GetTall(), Color( 255, 255, 255, 255 ) )
end
FButton.DoClick = function(ply)
LocalPlayer():ConCommand( "" )
end ]]
print( "!forums\nOpens the forums\n\n!donate\nOpens the donate page\n\n!help\nOpens up a tutorial for the game\n\n!servers\nOpens a menu with a list of our servers\n\n!spec\nToggle spectator only mode\n\n!motionblur\nToggle Motion Blur" )
end
concommand.Add( "CommandList", CommandList )[/CODE]
Uh all these are console commands, not chat commands.
[QUOTE=crazyscouter;48281760]Uh all these are console commands, not chat commands.[/QUOTE]
Ye I know, I have concommand.Add on other codes.
The problem is that the panel is simply not showing up, like I'd do CommandList in the console and I'd just get the print
[QUOTE=crazyscouter;48281806]Well, the following three functions expect booleans. That's the only thing I can think of at first glance. I'll check it out a bit more.
[lua]
BackGround:SetVisible()
BackGround:SetDraggable()
BackGround:ShowCloseButton()
[/lua][/QUOTE]
Still nothin'
Well, the following three functions expect booleans. That's the only thing I can think of at first glance. I'll check it out a bit more.
[lua]
BackGround:SetVisible()
BackGround:SetDraggable()
BackGround:ShowCloseButton()
[/lua]
I put the print command before spawning the derma panel, worked.
Sorry, you need to Log In to post a reply to this thread.