Raised This Month: $23 Target: $400

Advertisements 2.0 (Updated 2016/03/23)

Post New Thread Reply   
Thread Tools Display Modes
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Plugin ID:
Plugin Version:
Plugin Category:
General Purpose
Plugin Game:
Plugin Dependencies:
    Servers with this Plugin:
    Plugin Description:
    Display advertisements.
    Old 03-03-2008 , 12:08   Advertisements 2.0 (Updated 2020/07/30)
    Reply With Quote #1

    This is a simple advertisements plugin. It supports center, chat, hint, menu and top messages.

    sm_advertisements_enabled (0/1, def 1)
    Enable/disable displaying advertisements.

    sm_advertisements_file (def "advertisements.txt")
    File to read the advertisements from. Useful if you're running multiple servers from one installation, and want to use different advertisements per server.

    sm_advertisements_interval (def 30)
    Amount of seconds between advertisements.

    Server command to reload the advertisements from advertisements.txt.

    By default the plugin reads the advertisements from configs/advertisements.txt, which has this format:

            "chat"        "{green}[email protected]"
            "top"         "www.domain.com"
            "flags"       "a"
    Make sure to save this file as UTF-8 (without BOM), otherwise special characters will not work!


    The following types are supported:

    center: A center message, like sm_csay.
    hint: A hint message, like sm_hsay.
    menu: A menu message, like sm_msay, but without the title or the Exit-option. Pressing 0 will still hide the message, but it will block 1-9 from switching weapons while it's showing.
    chat: A chat message, like sm_say. A list of supported colors can be found on https://github.com/KissLick/ColorVariables.
    top: A top-left message, like sm_tsay. It supports any of the colors listed on https://www.doctormckay.com/morecolors.php, or custom colors with {#abcdef}.

    Multiple types per advertisement are allowed, so you can show a different message in multiple places at the same time.


    The message supports the following variables: {currentmap}, {date}, {time}, {time24} and {timeleft}. Next to that you can print the value of any cvar by enclosing the name with {}, for example {sm_nextmap} would show the name of the next map. Use \n for newlines, which works for center, chat and menu messages. Note: \n does not work in chat messages on CS:GO!

    A couple of examples are given in the supplied advertisements.txt.


    This field is optional. It accepts a list of flags of admins that will not see the advertisement if they have any of those flags. If left empty, only admins will see the advertisement. If omitted everyone will see the advertisement.

    Download | Source Code



    Last edited by DJ Tsunami; 07-30-2020 at 09:00.
    DJ Tsunami is online now
    Senior Member
    Join Date: Dec 2007
    Old 03-03-2008 , 12:34   Re: Advertisements
    Reply With Quote #2

    Excellent plugin! It's short and concise and efficient. I'll be using this.

    And for chat colors, precede the text you want colored with the color code (i.e. PrintToChatAll("%cThis is green", COLOR_GREEN), where COLOR_GREEN is defined as 4).

    FrostbyteX is offline
    Veteran Member
    Join Date: Nov 2006
    Old 03-03-2008 , 12:43   Re: Advertisements
    Reply With Quote #3

    Nice work
    Thank you.

    Coloured chat messages would be a great addition

    Anyway I've dropped ^BugS^ Ads plugin now and installed this one
    Extreme_One is offline
    DJ Tsunami
    DJ Post Spammer
    Join Date: Feb 2008
    Old 03-03-2008 , 13:12   Re: Advertisements
    Reply With Quote #4

    Thanks guys, I thought this would be such a basic feature, and since we already had the functions for it it was very easy to make. I'll definitely look into the colors.
    DJ Tsunami is online now
    Veteran Member
    Join Date: Oct 2005
    Location: Netherlands
    Old 03-03-2008 , 14:10   Re: Advertisements
    Reply With Quote #5

    Tsunami AWESOME job mate, no irritating TICK sound when a chat ad appears and works very well! Thank you.
    tcviper is offline
    Send a message via MSN to tcviper
    SourceMod Developer
    Join Date: Jul 2007
    Old 03-03-2008 , 14:57   Re: Advertisements
    Reply With Quote #6

    The reload command doesn't seem to work. It still prints out the same exact things as before I used it.
    - See edit

    Also, I added in {FF}. Here's the code I used.

            if (StrContains(sBuffer, "{FF}")) {
                new Handle:ffConVar, ffSetting, String:sFF[6];
                ffConVar = FindConVar("mp_friendlyfire");
                ffSetting = GetConVarInt(ffConVar);
                switch (ffSetting) {
                    case 0:
                        Format(sFF, sizeof(sFF), "OFF");
                    case 1:
                        Format(sFF, sizeof(sFF), "ON");
                ReplaceString(sBuffer, sizeof(sBuffer), "{FF}", sFF);

    Nevermind about the reload thing. I was saving the file to the wrong place like a fool.

    Last edited by bl4nk; 03-05-2008 at 16:09.
    bl4nk is offline
    Join Date: Dec 2006
    Old 03-03-2008 , 15:08   Re: Advertisements
    Reply With Quote #7

    Nice work. Includes more features than the old advertisements plugin (which is no longer supported since the author has gone AWOL).

    pRED* is offline
    DJ Tsunami
    DJ Post Spammer
    Join Date: Feb 2008
    Old 03-03-2008 , 15:09   Re: Advertisements
    Reply With Quote #8

    Thanks for approving, and thanks for the code bl4nk, I will incorporate it.
    DJ Tsunami is online now
    Senior Member
    Join Date: May 2004
    Old 03-03-2008 , 15:22   Re: Advertisements
    Reply With Quote #9

    Great and absolutely missing! Hope you keep supporting it.
    [Arnold] is offline
    Senior Member
    Join Date: Dec 2007
    Old 03-03-2008 , 15:22   Re: Advertisements
    Reply With Quote #10

    Instead of {FF}, it would be nice to have a method for putting cvar values into the string, such as [mp_friendlyfire] and [sv_contact].
    FrostbyteX is offline

    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump

    All times are GMT -4. The time now is 06:10.

    Powered by vBulletin®
    Copyright ©2000 - 2020, vBulletin Solutions, Inc.
    Theme made by Freecode