Advertisements 2.1 (Updated 2021/02/06)
11 Attachment(s)
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) Number of seconds between advertisements. sm_advertisements_random (0/1, def 0) Enable/disable random advertisements. When enabled, advertisements are randomized on every map change and reload. sm_advertisements_reload Server command to reload the advertisements. By default the plugin reads from addons/sourcemod/configs/advertisements.txt, which has this format: Code:
"Advertisements" Types The following types are supported: center: A center message, like sm_csay. chat: A chat message, like sm_say. A list of supported colors can be found on https://github.com/PremyslTalich/ColorVariables. 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. 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. Message The message supports the following variables: {currentmap}, {nextmap}, {date}, {time}, {time24} and {timeleft}. Next to that you can print the value of any cvar by enclosing the name with {}, for example {mp_friendlyfire}. Use \n for newlines, which works with center, chat, hint and menu messages. A couple of examples are given in the supplied advertisements.txt. Flags This field is optional. It accepts a list of flags of players who 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
Changelog
https://img.shields.io/github/workfl...ts/CI/main.svg https://img.shields.io/github/releas...rtisements.svg https://img.shields.io/github/downlo...ents/total.svg |
Re: Advertisements
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). Steve |
Re: Advertisements
Nice work :D
Thank you. Coloured chat messages would be a great addition :) Anyway I've dropped ^BugS^ Ads plugin now and installed this one :up: |
Re: Advertisements
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.
|
Re: Advertisements
Tsunami AWESOME job mate, no irritating TICK sound when a chat ad appears and works very well! Thank you.
|
Re: Advertisements
- See edit Also, I added in {FF}. Here's the code I used. Code:
if (StrContains(sBuffer, "{FF}")) { Nevermind about the reload thing. I was saving the file to the wrong place like a fool. :oops: |
Re: Advertisements
Nice work. Includes more features than the old advertisements plugin (which is no longer supported since the author has gone AWOL).
Approved. |
Re: Advertisements
Thanks for approving, and thanks for the code bl4nk, I will incorporate it.
|
Re: Advertisements
Great and absolutely missing! Hope you keep supporting it.
|
Re: Advertisements
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].
|
Re: Advertisements
Quote:
|
Re: Advertisements
I could do that Frostbyte, but it's nicer to have it say on/off than 1/0 isn't it? And don't make me do {IF}{ELSE} :P I'll think about it anyway.
|
Re: Advertisements
Any chance you can have {TIMELEFT} read the number of rounds remaining if the map's set to mp_timelimit 0 and suffix with the word Rounds when appropriate?
X Rounds if mp_timelimit 0 (I need to use mp_maxrounds instead of mp_timelimit for cp_badlands :| ) |
Re: Advertisements
Quote:
|
Re: Advertisements
i set the interval to 300, but ads are still appearing every 30 secs
|
Re: Advertisements
Sweet ! thanks!
|
Re: Advertisements
awesome plugin, works great. :D
seemed like bugs thought of a way to color that chat messages, maybe u can thief some his code. XD |
Re: Advertisements
fattitj: It needs a mapchange, I didn't bother to make it update when you change the cvar. I'll obviously look into everything else mentioned, it's just alot of requests, so one feature at a time :)
|
Re: Advertisements
Do you guys know where I can find a list of the color constants? I found like COLOR_DEFAULT (1), COLOR_TEAM (3) and COLOR_GREEN (4) for SourceMod, and COLOR_NORMAL, COLOR_RED, COLOR_BLUE, COLOR_GRAY and COLOR_GREEN for AMX, but I'm not sure if those all work for SourceMod too. Plus I got 3 shades of green for 3, 4 and 5... I'm guessing I can't use all the colors that work for sm_tsay :(
|
Re: Advertisements
DJ, the COLOR_GREEN, COLOR_TEAM and COLOR_DEFAULT are all colors for chat messages. Their color is exactly as they are defined, and are used as I posted above.
As far as I'm aware, those are the only chat message colors available. Steve |
Re: Advertisements
I'm pretty sure COLOR_TEAM won't work for PrintToChatAll
This thread could prove useful: http://forums.alliedmods.net/showthread.php?t=66654 |
Re: Advertisements
It works, but it's always light green because the message is sent by the server. To be able to have red and blue text (using TF2 as an example, not sure what those colors are in other games) I'd have to send it from a currently playing client with SayText2, which means that if no one is playing those colors won't work. So I'm not sure if that's what you guys want... Implementing the 3 shades of green is easy, so.
|
Re: Advertisements
Quote:
|
Re: Advertisements
Nope, when I target it at me when sending it from the server it's still light green. I could of course loop through the users and use them as both the target and sender, but that would be a lot of commands if it can also be done with one (but without the team colors)... I don't know, on the other hand it doesn't get executed that often so I'm sure SM could handle it.
Edit: alright, what I did now was loop through every player, and use light green if they're a spectator, and their team color if they're playing. I guess that's the best way to do it. |
Re: Advertisements
Alright, version 0.2 is up now. I've done everything requested except:
|
Re: Advertisements
Cool! Glad to see colours. Thank you.
Who is the plugin looking at for the {TEAM} colour? Are you saying it will display the colour differently for everyone on the server depending on what team they're on or whether they're in spec? |
Re: Advertisements
Yes, to take the example of TF2: if the player that the advertisement is sent to is on Blue it will use the blue color, if he's on Red the red color, and if he's in spectate it's light green.
|
Re: Advertisements
It works really well DJ Tsunami.
Thank you. +1 karma :D |
Re: Advertisements
Using Advertisement version 0.2 compiled with Sourcemod version 1924
Errors: L 03/10/2008 - 00:00:00: [SM] Native "StartMessage" reported: Invalid message name: "SayText2" L 03/10/2008 - 00:00:00: [SM] Displaying call stack trace for plugin "advertisements.smx": L 03/10/2008 - 00:00:00: [SM] [0] Line 210, C:\Users\cozmicshredder\Documents\GAMESERVERS \SOURCEMOD\sourcemod-r1924\addons\sourcemod\scripting\include\user messages.inc::StartMessageOne() L 03/10/2008 - 00:00:00: [SM] [1] Line 199, advertisements.sp::SayText2() L 03/10/2008 - 00:00:00: [SM] [2] Line 134, advertisements.sp::Timer_DisplayAds() |
Re: Advertisements
That's an Insurgency issue who uses a different way of displaying msgs, thats why its not working ;)
|
Re: Advertisements
I just downloaded the smx provided on the first post and installed. Only C,M and T messages work in Insurgency for me. :)
|
Re: Advertisements
While I was brushing my teeth I though of a new idea. Maybe people with reserved flags did have to see specified messages so they have an ad free experience?...
|
Re: Advertisements
Quote:
good ideare |
Re: Advertisements
Yeah, I can do that :) I'll try to fix up and add some stuff somewhere in the next few days.
|
Re: Advertisements
Ok cool thanks. btw I meant didnt have to see specific messages. Like the donate today ones :P
|
Re: Advertisements
Could be cool if specific messages were disabled for those with a specific admin flag. (reserved flag would be ideal!)
I wouldn't like to block all adverts for those with the flag. :) |
Re: Advertisements
This works fine on our tf2 server, but does not on the DoDs. Here is the error.
Code:
L 03/14/2008 - 15:47:12: [SM] Native "StartMessage" reported: Invalid message name: "SayText2" |
Re: Advertisements
Strange. From time to time the plugin skips advertising. If you switch into spec mode you get all the ads, if you join a team you don't. A "sm_advertisements_reload" doesn't help it, nor does a sm plugins reload [x]. After some time (and reconnects) you get your ads again, even after joining a team (I thought of some kind of anti-flood-problem).
Maybe you can check that. Thx in advance. |
Re: Advertisements
And also, this is not working for me:
T {CYAN}{CURRENTMAP} Advertisement text Instead of making the ad CYAN colored, it writes this in the upper left corner {CYAN}de_dust Advertisement text So the color tag is not handled. If i remove the color tag, so that the {CURRENTMAP} is the first and only, it works as it should, just that its white. The coloring only works, if there is no other tag after the color tag. |
Re: Advertisements
Hi,
Any chance to have a 24hours clock? |
All times are GMT -4. The time now is 03:22. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.