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

	local html = vgui.Create("HTML", Advertisements)

	local DermaButton = vgui.Create("DButton", Advertisements)
	DermaButton:SetSize( 150, 50 )
	DermaButton:SetDisabled( true ) -- Should have this set to true to have the button disabled.
	DermaButton.DoClick = function() 
	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" )
			DermaButton:SetText( "Close in (" .. time ..")" )-- and this set to false to enable the button

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

Title = google
TIme = 30

local tables = { url = "", 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 )


or you can just do

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


do you put quotes around the stuff like that?

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

because what i looking for is like

local url = ""

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

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

So do the quotes need to be there?


local url = “

if i print this it will output

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

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?


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

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