variable for derma


concommand.Add('OpenAdvertisements', function() 
	local Advertisements = vgui.Create( "DFrame" ) -- Creates the frame itself
	Advertisements:SetPos( 50, 50 )
	Advertisements:SetSize( 1250, 850 )
	Advertisements:SetTitle( "[WN] Advertisements" ) -- Title of the frame
	Advertisements:SetDraggable( true )
	Advertisements:ShowCloseButton(false) -- Don't show the close button so the users can't just "X-out" of your frame
	Advertisements:MakePopup()

	local html = vgui.Create("HTML", Advertisements)
	html:Dock(FILL)
	html:OpenURL("http://motdgd.com/motd/?user=1924")                

	local DermaButton = vgui.Create("DButton", Advertisements)
	DermaButton:Dock(BOTTOM)
	DermaButton:SetSize( 150, 50 )
	DermaButton:SetDisabled( true ) -- Should have this set to true to have the button disabled.
	DermaButton.DoClick = function() 
		Advertisements:Remove()
	end
	DermaButton:SetText('Close in (30)')


	local time = 30 -- This needs to be set for the time you want the button to be unclickable. It should be local.
	-- timer.Create has 4 args: name, duration, reps, and the function that is called. If you want it to decrease by one every second, you need to have the reps set to 30 (30*1 second = 30 seconds) and the duration set to 1.
	timer.Create( LocalPlayer():EntIndex().."button", 1, 30, function() 
		time = time - 1
		 if ( time == 0 ) then
			DermaButton:SetDisabled( false )
			DermaButton:SetText( "Close" )
		else
			DermaButton:SetText( "Close in (" .. time ..")" )-- and this set to false to enable the button
		end
	end)
end)

How do i make things like the title, the url, and the time for waiting. A variable i want to be able to change all of this things without having to keep looking for it in the code. I just want to be at the top like

URL = google.com
Title = google
TIme = 30


local tables = { url = "www.google.com", title = "Google", time = 30 }

then you can just access it like,


for k,v in pairs( tables ) do

print( v.url )
print( v.title )
print( v.time )

end


or you can just do



local url = "google.com"
local title  ="google"
local time = 30

print(url)
print(title)
print(time)


do you put quotes around the stuff like that?

local url = “google.com
local title =“google”
local time = 30

because what i looking for is like



local url = "google.com"

local html = vgui.Create("HTML", Advertisements)
	html:Dock(FILL)
	html:OpenURL( url ) 

Yes. Make sure to include the http://www

So do the quotes need to be there?

Yes.

local url = “www.google.com

if i print this it will output www.google.com

so if i do html:OpenURL( url ) it gets read like this:
html:OpenURL( “www.google.com” )

How do you make derma text size bigger?

I’ve seen this same thread a few times now - you should draw the time left inside .paint = function() because that gets called every frame the derma is open

Now that i have all this set, How do i make it so if someone types !show this command runs?

Serverside:

[lua]hook.Add(“PlayerSay”, “OpenAdvertisements”, function(pl, text)
if (text:lower() == “!show”) then
pl:ConCommand(“OpenAdvertisements”);
return false;
end
end);[/lua]

How do you make it serverside, Sorry im new to all of this

Just put it into a file in lua/autorun/server/ and the server will automatically load it when it starts