How do I create text to display on screen, with Derma, without a background?

The title almost fills in all the info.
I want to make an adverter, much like Assmod’s, but I already have a HUD box created.
So I just need text to appear, how would I approach this?


I believe this is what you’re looking for: **[Surface.DrawText](**

You should probably use one of the various text drawing functions. Its not derma but its better suited for this imo.

So, I should go along with Derma?

Like Said it would probably be better to use one of the text drawing functions, here are a few:

local adverts = {“Advert #1”, “Advert #2”, “Advert #3”, “Advert #4”, “Advert #5”, “Advert #6”}; /fill this table with your advertisements/
local cura = adverts[math.random(1, #adverts)]; /Generate first advertisement to display/
local currentt = CurTime() /Grab the current time/

/function used to generate a new advertisement from the table, when called/
function GenerateNewAdvertisement()
local newa = adverts[math.random(1, #adverts)]

return tostring(newa);


/Every 180 seconds, call the function to generate a new advertisements/
hook.Add(“Tick”, “UpdateAdvertisement”, function()
if( CurTime() - currentt > 180 ) then
cura = GenerateNewAdvertisement();
currentt = CurTime()

/Draw our roudned boxes, and the text/
hook.Add(“HUDPaint”, “Advertise_Adverts_Table”, function()
if( !cura || cura == nil ) then return; end

local w, h = surface.GetTextSize( cura );

draw.RoundedBox(6, ScrW() - 215, ScrH() - (ScrH() - 15), w + 31, h + 10, Color(255, 255, 255));
draw.RoundedBox(6, ScrW() - 212, ScrH() - (ScrH() - 17), w + 25, h + 6, Color(0, 0, 0));

draw.SimpleTextOutlined(tostring(cura), "TargetID", ScrW() - 200, ScrH() - (ScrH() - 19), Color(255, 255 ,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 0.5, Color(0, 255, 0));


Small little advertiser, somewhat ugly, I’m sure you can get someone help you to redesign it.

Tinu-c, thanks alot! I’ll review the code and try to learn. I just believe this is too advanced for me at the moment, and thanks to all the help! :slight_smile:

Getting: [addons\headbob\lua\autorun\advert.lua:7] unexpected symbol near ‘�’

Edit: Fixed, thanks, it wurksss :smiley:

No problem, the code is pretty ugly, could be fixed but if it works.