HOW TO MAKE CHAT ADVERTS!?

Recently, someone gave me code and it didnt work, can someone tell me how to make adverts like “Dont break the rules” display every like minute or so. Where does that code belong and what should it be named? thanks


(User was banned for this post ("all caps thread title" - postal))

-snip-

Took me about 5 seconds to write

[lua]
local ADVERTS = {
“Don’t Break Rules”,
“I am your king”,
“Hitler did nothing wrong”,
“$VV@Q”,
}

local curAd = 0

timer.Create(“advertTimer”, 120, 0, function()
curAd = curAd + 1
if curAd > #ADVERTS then curAd = 1 end

PrintMessage(HUD_PRINTTALK, ADVERTS[curAd])

end)
[/lua]

Use ulx…

Causing the death of 6 million people is doing nothing wrong?

Okay.

I think it might have been a joke

Definitely a joke.

Or just use ulx and ulib…

What if he isn’t using ulx/ulib?

Or if he wants to have more configuration?

Or if he doesn’t want to hear the same response that’s already been given?

ULX and ULib uses almost the same code as him. Have you even seen how ULX handles adverts?

What file do i place this in??? Is it in certain lua file?

Make a new file in lua/autorun/server, called whatever you want.

I would have used BroadcastLua in conjunction with a table and chat.addtext for colors, but this is the simpler way.



if SERVER then AddCSLuaFile() return end

local adverts = {
{Color(255,0,0), "omg an advert!!"},
{Color(255,0,255), "wait what ", Color(255,255,0)," another one?!?"}
}
local index = 0
local function advertise()
timer.Simple( 60, advertise )
chat.AddText( unpack( adverts[ index % #adverts + 1 ] ) )
index = index + 1;
end
advertise()


Typed that up on my phone… lua/autorun
If you can’t figure out how to add or remove adverts please refrain from asking and making me cry.

I’m Jewish and I don’t find that funny. Sorry to the people who rate me dumb for defending my religion? It’s completely anti-semetic and plain wrong.

Maybe if you are lucky the thread will get moved and renamed before you are banned

Dude, it’s a joke. I’m Christian and I could care less if people made fun of God/Jesus. That’s because religion is a PERSONAL belief, not a global one.