Derma problems.

Here’s the problem, I’m not a lua coder I have messed with this for awhile now, this was coded by someone else for my server and he has gone on vacation I’m trying to make it a bit neater. I’m trying to place the buttons on each side of the the frame with no result,
how it looks now is kinda clunky, I’m just trying to make it look neater, any input would be appreciated.


local PANEL = {}
local matBlurScreen = Material( "pp/blurscreen" )
 function PANEL:Init()
end
 function PANEL:Paint() 
    local x, y = self:ScreenToLocal( 0, 0 )
     
    // Background
    surface.SetMaterial( matBlurScreen )
    surface.SetDrawColor( 255, 255, 255, 255 )
     
    matBlurScreen:SetMaterialFloat( "$blur",2 )
    render.UpdateScreenEffectTexture()
     
    surface.DrawTexturedRect( x, y, ScrW(), ScrH() )
     
    surface.SetDrawColor( 60, 60, 60, 150 )
    surface.DrawRect( x, y, ScrW(), ScrH() )
     
    // Border
    surface.SetDrawColor( 20, 20, 20, 255 )
    surface.DrawOutlinedRect( 0, 0, self:GetWide(), self:GetTall() )
     
    return true
end
 vgui.Register( "DFrameTransparent", PANEL, "DFrame" )

local function RPNameDerma()
	local frame = vgui.Create("DFrameTransparent")
	frame:SetSize(290,50)
	frame:Center()
	frame:ShowCloseButton(false)
	frame:SetDeleteOnClose(true)
	frame:SetDraggable(false)
	frame:SetTitle("Please Set a RP Name")
	frame:MakePopup()
	frame:Center()
	local rpnameTextbox = vgui.Create("DTextEntry", frame)
	rpnameTextbox:SetText("")
	rpnameTextbox:SetSize(200,20)
	rpnameTextbox:SetPos(5,25)
	local Confirm = vgui.Create( "DButton", frame )
	Confirm:SetSize( 80, 20 )
	Confirm:SetPos( 205, 25 )
	Confirm:SetText( "Set Name" )
	Confirm.DoClick = function( button )
		if rpnameTextbox:GetValue() == "" or rpnameTextbox:GetValue() == " " then return end
		RunConsoleCommand("say","/rpname " .. tostring(rpnameTextbox:GetValue()))
		LocalPlayer():SetPData("rpname","done")
		frame:Close()
	end
end
timer.Create( "doname", 2, 1, function()
if LocalPlayer():GetPData("rpname") == nil then
	RPNameDerma()
end
end)
local function DeathDerma()
	local frame = vgui.Create("DFrameTransparent")
	frame:SetSize(420,90)
	frame:Center()
	frame:ShowCloseButton(false)
	frame:SetDeleteOnClose(true)
	frame:SetDraggable(false)
	frame:SetTitle("You Died")
	frame:MakePopup()
	frame:Center()
	local Info = vgui.Create("DLabel",frame)
	Info:SetText("NLR, forget everything. Continue or report RDM")
	Info:SetPos(5,25)
	Info:SetFont("ScoreboardText")
	Info:SizeToContents()
	Info:SetColor(Color(255,255,255,255))
	local Continue = vgui.Create( "DButton", frame )
	Continue:SetSize( 60, 20 )
	Continue:SetPos( 5, 65 )
	Continue:SetText( "Continue" )
	Continue.DoClick = function( button )
		RunConsoleCommand("death_rdm","0")
		frame:Close()
	end
	local RDM = vgui.Create( "DButton", frame )
	RDM:SetSize( 60, 20 )
	RDM:SetPos( 120, 65 )
	RDM:SetText( "RDM" )
	RDM.DoClick = function( button )
		RunConsoleCommand("death_rdm","1")
		frame:Close()
	end
end
usermessage.Hook("deathderma",DeathDerma)

Code is below. To move the buttons inwards towards each other, increase the value of the margin variable on line 60 (Near the top of the DeathDerma function).

[lua]
local PANEL = {}
local matBlurScreen = Material( “pp/blurscreen” )
function PANEL:Init()
end
function PANEL:Paint()
local x, y = self:ScreenToLocal( 0, 0 )

// Background
surface.SetMaterial( matBlurScreen )
surface.SetDrawColor( 255, 255, 255, 255 )
 
matBlurScreen:SetMaterialFloat( "$blur",2 )
render.UpdateScreenEffectTexture()
 
surface.DrawTexturedRect( x, y, ScrW(), ScrH() )
 
surface.SetDrawColor( 60, 60, 60, 150 )
surface.DrawRect( x, y, ScrW(), ScrH() )
 
// Border
surface.SetDrawColor( 20, 20, 20, 255 )
surface.DrawOutlinedRect( 0, 0, self:GetWide(), self:GetTall() )
 
return true

end
vgui.Register( “DFrameTransparent”, PANEL, “DFrame” )

local function RPNameDerma()
local frame = vgui.Create(“DFrameTransparent”)
frame:SetSize(290,50)
frame:Center()
frame:ShowCloseButton(false)
frame:SetDeleteOnClose(true)
frame:SetDraggable(false)
frame:SetTitle(“Please Set a RP Name”)
frame:MakePopup()
frame:Center()
local rpnameTextbox = vgui.Create(“DTextEntry”, frame)
rpnameTextbox:SetText("")
rpnameTextbox:SetSize(200,20)
rpnameTextbox:SetPos(5,25)
local Confirm = vgui.Create( “DButton”, frame )
Confirm:SetSize( 80, 20 )
Confirm:SetPos( 205, 25 )
Confirm:SetText( “Set Name” )
Confirm.DoClick = function( button )
if rpnameTextbox:GetValue() == “” or rpnameTextbox:GetValue() == " " then return end
RunConsoleCommand(“say”,"/rpname " … tostring(rpnameTextbox:GetValue()))
LocalPlayer():SetPData(“rpname”,“done”)
frame:Close()
end
end
timer.Create( “doname”, 2, 1, function()
if LocalPlayer():GetPData(“rpname”) == nil then
RPNameDerma()
end
end)
local function DeathDerma()
local frame = vgui.Create(“DFrameTransparent”)
local margin = 20 – INCREASE THIS VALUE TO INCREASE THE MARGIN. THIS WILL BRING THE BUTTONS CLOSER TOGETHER
frame:SetSize(350,90)
frame:Center()
frame:ShowCloseButton(false)
frame:SetDeleteOnClose(true)
frame:SetDraggable(false)
frame:SetTitle(“You Died”)
frame:MakePopup()
frame:Center()
local Info = vgui.Create(“DLabel”,frame)
Info:SetText(“NLR, forget everything. Continue or report RDM”)
Info:SetPos(50,25)
Info:SetFont(“ScoreboardText”)
Info:SizeToContents()
Info:SetPos(frame:GetWide()/2-Info:GetWide()/2, 25)
Info:SetColor(Color(255,255,255,255))
local Continue = vgui.Create( “DButton”, frame )
Continue:SetSize( 100, 20 )
Continue:SetPos( margin, 65 )
Continue:SetText( “Continue” )
Continue.DoClick = function( button )
RunConsoleCommand(“death_rdm”,“0”)
frame:Close()
end
local RDM = vgui.Create( “DButton”, frame )
RDM:SetSize( 100, 20 )

RDM:SetPos( frame:GetWide()-RDM:GetWide()-margin, 65 )
RDM:SetText( "RDM" )
RDM.DoClick = function( button )
	RunConsoleCommand("death_rdm","1")
	frame:Close()
end

end
usermessage.Hook(“deathderma”,DeathDerma)
[/lua]

Thank you that worked great! How would I go about fading the button out for a few seconds
(unclickable) then having the button clickable?

To disable/enable the button you can use Button:SetDisabled() with true or false as the argument. As for fading buttons, you cannot change the opacity of a default derma button. You’d have to use Button:SetVisible() or use the Paint function to draw your own button. I don’t have the time to code it for you at present, but maybe someone else might. Either that or you’ll have to wait for your coder to get back and explain your needs to them.