GAS - Garrysmod Advert System

Someone requested an advert system that is stand-alone from ULX, so I decided to make GAS.

[release]
V4 released

GAS is a stand-alone advert system designed for server owners. It allows for messages/adverts to be periodically displayed on the clients screen and temporary messages/adverts to be displayed once, each advert can be displayed for any length of time.
Adverts are queued while other adverts are currently being displayed, so that they don’t overlap or cancel.

Usage is simple:


AdvertSystem.TemporaryAdvert( message, length, type,  [color], [ply] )

creates a new temporary advert of type type that will be displayed only once for length amount of seconds on ply’s screen, the color parameter and the ply parameter are optional (If nil, color will default to white and ply will default to all players.


AdvertSystem.NewAdvert( uniqueID, message, length, delay, type, [color], [ply] )

creates a periodic advert or type type with unique ID uniqueID, which will be displayed every delay seconds for length amount of seconds on ply’s screen, again, the color and ply parameters are optional (same behaviour as above).


AdvertSystem.DeleteAdvert( uID )

will delete the advert with unique ID uID, any adverts with this uniqueID that are queued will still display.

Types include:

GAS_MESSAGE
GAS_WARNING
GAS_INFORMATION

Examples:

[lua]AdvertSystem.NewAdvert( “message1”, “This is shown every 20 seconds for 10 seconds”, 20, 10, GAS_MESSAGE)[/lua]

http://img24.imageshack.us/img24/2398/gmflatgrass0013.jpg[/media]

[lua]AdvertSystem.NewAdvert( “message1”, “This is a warning”, 20, 10, GAS_WARNING )[/lua]
[media]http://img24.imageshack.us/img24/9656/gmflatgrass0014j.jpg[/media]

[lua]AdvertSystem.NewAdvert( “message1”, “Welcome to my server :)”, 20, 10, GAS_INFORMATION)[/lua]
[media]http://img197.imageshack.us/img197/6435/gmflatgrass0015p.jpg

Note: The “[AdvertSystem]” prefix can be changed in “lua/autorun/ad_init.lua” and disabled using convar advert_prefix_enabled 0/1.

Adverts can be disabled by the server owner using “adverts_enabled 0” in the console and re-enabled with “adverts_enabled 1”.

http://www.garrysmod.org/img/?t=dll&id=86780[/release]

nooooooo! ads? whyyyyyyy!

just kidding.

it doesnt seem annoying at all. heck, these dont seem like ads at all.

Great, now release your melon and all is well :smiley:

Will do.

[editline]09:10PM[/editline]

When the time is right :smug:

[editline]09:14PM[/editline]

More of an announcement system, but the person that requested it called them adverts, so that’s what I called them :smile:

This is awesome, I love you.

[editline]06:30PM[/editline]

The ulx SVN’s adverts are broken, this is just what I needed.

:psyduck:

Why would you use the ULX SVN when even the dev team themselves said it wasn’t complete/bug-free?

-snip-

A snip without an edit. That’s new :v:

I love this :V

Not really, I noticed that if you edit your messages within a minute of your original post, it won’t show the edit line.

Constructive criticism would be nice, instead of being rated dumb.

Pretty much does what any other advert mod would :stuck_out_tongue:

Still, its good to see someone making effort to help, although i already gave the guy what he asked for.

The point of it is to do what any other advert mod does, what else can advert mods do?

And, although you did give what the guy was looking for, It wasn’t very flexible, only allowing for adverts to be displayed at set intervals.
Anyway, I made this in less than half an hour, I didn’t expect people to like it. I only posted it in a new thread because the one in requests was locked.

Set intervals? Oh right… so saying Change pl.Adverttime = CurTime() + 300 to whatever you want is “SET” intervals? :3:

What if you want to display multiple adverts at different intervals? You would have to have many pl.AdvertTime for the each advert and set them to CurTime() + delay or all adverts will display at the same time.

What happens if you display multiple adverts at one time? Do they stack or overlap or…?

They queue and display one after another.

I like the Gui bar you use to display the adverts, however it would be nice if there was an option to turn off the [AdvertSystem] message prefix - without going and removing it manually.

With a convar?

adverts_prefix_enabled 0/1

[editline]08:27PM[/editline]

Done, updated OP.

Nice, if I were running a server without an admin mod with notices built in, I would use this.