Help with Derma!

hey im trying to make a derma which pops up when you say in chat “/servers” i want the buttons to connect to another server…

Buuuutt its not working :S if anyone could help please :slight_smile:

i think you need to link a function to AddChatCommand like:
[lua]
function derma_open()
local Frame_create = vgui.Create( “DPanel”, DermaPanel )
TestingPanel:Center(true)
TestingPanel:SetSize( 250, 250 )
TestingPanel:SetTitle(“Connect To Other Servers”)
TestingPanel:SetVisible(true)
TestingPanel:SetDraggable(false)
TestingPanel:ShowCloseButton(true)
TestingPanel:SetBackgroundBlur(true)
TestingPanel:SetDeleteOnClose(true)
TestingPanel.Paint = function() – Paint function
surface.SetDrawColor( 50, 50, 50, 255 ) – Set our rect color below us; we do this so you can see items added to this panel
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) – Draw the rect
end

local PropertySheet = vgui.Create( “DPropertySheet” )
PropertySheet:SetParent( DermaPanel )
DermaFrame:Center()
PropertySheet:SetSize( 340, 315 )

local SheetItemOne = vgui.Create( “DButton”, frame_create )
DermaButton:SetText( “Connect” )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( “connect 80.84.53.101:27015” )
end

local SheetItemOne = vgui.Create( “DButton”, frame_create )
DermaButton:SetText( “Connect” )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( “connect 92.48.112.44:27016” )
end

PropertySheet:AddSheet( “Official RealisticRP |PHX|WIRE|”, SheetItemOne, “gui/silkicons/world”, false, false, “Connect To Official RealisticRP Server” )
PropertySheet:AddSheet( “Madbobby109’s Roleplay Community ||Serious Roleplay||”, SheetItemTwo, “gui/silkicons/group”, false, false, “Connect To Madbooby109’s Server” )

end

AddChatCommand("/servers", derma_open)[/lua]

-snip-

This code is messed up.

[lua]function frame_create()
TestingPanel = vgui.Create( “DPanel”, DermaPanel )
TestingPanel:Center(true)
TestingPanel:SetSize( 250, 250 )
TestingPanel:SetTitle(“Connect To Other Servers”)
TestingPanel:SetVisible(true)
TestingPanel:SetDraggable(false)
TestingPanel:ShowCloseButton(true)
TestingPanel:SetBackgroundBlur(true)
TestingPanel:SetDeleteOnClose(true)
TestingPanel.Paint = function() – Paint function
surface.SetDrawColor( 50, 50, 50, 255 ) – Set our rect color below us; we do this so you can see items added to this panel
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) – Draw the rect
end

PropertySheet = vgui.Create( “DPropertySheet” )
PropertySheet:SetParent( DermaPanel )
PropertySheet:Center()
PropertySheet:SetSize( 340, 315 )

local SheetItemOne = vgui.Create( “DButton”, TestingPanel )
DermaButton:SetText( “Connect” )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( “connect 80.84.53.101:27015” )
end

local SheetItemOne = vgui.Create( “DButton”, TestingPanel )
DermaButton:SetText( “Connect” )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( “connect 92.48.112.44:27016” )
end

PropertySheet:AddSheet( “Official RealisticRP |PHX|WIRE|”, SheetItemOne, “gui/silkicons/world”, false, false, “Connect To Official RealisticRP Server” )
PropertySheet:AddSheet( “Madbobby109’s Roleplay Community ||Serious Roleplay||”, SheetItemTwo, “gui/silkicons/group”, false, false, “Connect To Madbooby109’s Server” )

end)

AddChatCommand("/servers", frame_create)[/lua]

thanks for pointing out the obvious :slight_smile: can you help?

[editline]06:33PM[/editline]

wat.

yeah but it still is messed up, i put it in lua/autorun/client but it still doesnt show when i say /servers

So, you shouldnt say that it’s working.

[editline]06:35PM[/editline]

Anyways, Im pretty sure ChatCommands are serverside.

[editline]06:35PM[/editline]

Lemme see if I can do some of my magic :stuck_out_tongue:

[editline]06:41PM[/editline]


function DermaThingi() 
	TestingPanel:SetVisible(true)
end

AddChatCommand("/servers", DermaThingi)


TestingPanel = vgui.Create( "DPanel", DermaPanel )
TestingPanel:Center(true)
TestingPanel:SetSize( 250, 250 )
TestingPanel:SetTitle("Connect To Other Servers")
TestingPanel:SetVisible(true)
TestingPanel:SetDraggable(false)
TestingPanel:ShowCloseButton(true)
TestingPanel:SetBackgroundBlur(true)
TestingPanel:SetDeleteOnClose(true)
TestingPanel.Paint = function() -- Paint function
surface.SetDrawColor( 50, 50, 50, 255 ) -- Set our rect color below us; we do this so you can see items added to this panel
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) -- Draw the rect
end

PropertySheet = vgui.Create( "DPropertySheet" )
PropertySheet:SetParent( DermaPanel )
PropertySheet:Center()
PropertySheet:SetSize( 340, 315 )

local SheetItemOne = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "Connect" )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( "connect 80.84.53.101:27015" )
end

local SheetItemOne = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "Connect" )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( "connect 92.48.112.44:27016" )
end


PropertySheet:AddSheet( "Official RealisticRP |PHX|WIRE|", SheetItemOne, "gui/silkicons/world", false, false, "Connect To Official RealisticRP Server" )
PropertySheet:AddSheet( "Madbobby109's Roleplay Community ||Serious Roleplay||", SheetItemTwo, "gui/silkicons/group", false, false, "Connect To Madbooby109's Server" )


Also, I’m wondering, dont you need to Parent the 2 Property Sheets, and should you have created it before adding the buttons?

  • Might be dumb.

sorry im extreamly new to lua :slight_smile:

and awesome thanks for the code i love you

also

sorry im extreamly new to lua :slight_smile:

and awesome thanks for the code i love you

also


 function DermaThingi() 
	TestingPanel:SetVisible(true)
end

AddChatCommand("/servers", DermaThingi)


TestingPanel = vgui.Create( "DPanel", DermaPanel )
TestingPanel:Center(true)
TestingPanel:SetSize( 250, 250 )
TestingPanel:SetTitle("Connect To Other Servers")
TestingPanel:SetVisible(true)
TestingPanel:SetDraggable(false)
TestingPanel:ShowCloseButton(true)
TestingPanel:SetBackgroundBlur(true)
TestingPanel:SetDeleteOnClose(true)
TestingPanel.Paint = function() -- Paint function
surface.SetDrawColor( 50, 50, 50, 255 ) -- Set our rect color below us; we do this so you can see items added to this panel
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) -- Draw the rect
end

PropertySheet = vgui.Create( "DPropertySheet" )
PropertySheet:SetParent( DermaPanel )
PropertySheet:Center()
PropertySheet:SetSize( 340, 315 )

local SheetItemOne = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "Connect" )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( "connect 80.84.53.101:27015" )
end

local SheetItemTwo = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "Connect" )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( "connect 92.48.112.44:27016" )
end


PropertySheet:AddSheet( "Official RealisticRP |PHX|WIRE|", SheetItemOne, "gui/silkicons/world", false, false, "Connect To Official RealisticRP Server" )
PropertySheet:AddSheet( "Madbobby109's Roleplay Community ||Serious Roleplay||", SheetItemTwo, "gui/silkicons/group", false, false, "Connect To Madbooby109's Server" ) 

you forgot the local SheetItemTwo = vgui.Create not local SheetItemOne = vgui.Create

Does it work?

nop, still when i say /servers nothing pops up :frowning:

i put it in autorun/servers ill try client

[editline]07:21PM[/editline]

Halp

I’ve seen this before, hang on, let me get it.

[editline]07:46PM[/editline]

Got it, here use this:
[lua]function IsSaid( ply, text, team, death )
if (string.sub(text, 1, 8) == “/servers”) then
ply:SendLua( frame_create() ) --“frame_create” is from my code I postd a couple posts back
end – End statement
end --End function[/lua]This should go into init.lua

can anyone please help i dont understand

Do what he said ^

so which main code do i put in then? i suck at this stuff

cl_init.lua


function frame_create()
TestingPanel = vgui.Create( "DPanel", DermaPanel )
TestingPanel:Center(true)
TestingPanel:SetSize( 250, 250 )
TestingPanel:SetTitle("Connect To Other Servers")
TestingPanel:SetVisible(true)
TestingPanel:SetDraggable(false)
TestingPanel:ShowCloseButton(true)
TestingPanel:SetBackgroundBlur(true)
TestingPanel:SetDeleteOnClose(true)
TestingPanel.Paint = function() -- Paint function
surface.SetDrawColor( 50, 50, 50, 255 ) -- Set our rect color below us; we do this so you can see items added to this panel
surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) -- Draw the rect
end

PropertySheet = vgui.Create( "DPropertySheet" )
PropertySheet:SetParent( DermaPanel )
PropertySheet:Center()
PropertySheet:SetSize( 340, 315 )

local SheetItemOne = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "Connect" )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( "connect 80.84.53.101:27015" )
end

local SheetItemOne = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "Connect" )
DermaButton:SetPos( 0, 10 )
DermaButton:SetSize( 50, 30 )
DermaButton.DoClick = function ()
RunConsoleCommand( "connect 92.48.112.44:27016" )
end


PropertySheet:AddSheet( "Official RealisticRP |PHX|WIRE|", SheetItemOne, "gui/silkicons/world", false, false, "Connect To Official RealisticRP Server" )
PropertySheet:AddSheet( "Madbobby109's Roleplay Community ||Serious Roleplay||", SheetItemTwo, "gui/silkicons/group", false, false, "Connect To Madbooby109's Server" )

end

AddChatCommand("/servers", frame_create)

thanks all of you :slight_smile: i greatly appreciate what youve helped me with :slight_smile: credits go to you guys!

I’m surprised how many people contributed 0.0

Meh.

You don’t like the thanks for helping?