Raised This Month: $51 Target: $400
 12% 

Adverts system


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Wiebbe
Junior Member
Join Date: Jul 2007
Old 07-03-2007 , 16:40   Adverts system
Reply With Quote #1

Adverts
version 1.0.1

by Wiebbe (with alot of help from Ferrets code)

Description
This plugin is just like the BAT SourceMOD plugin which can show adverts on the server. This plugin will read a ini file with all adverts located on a single line and display them in a linear order. The ads are rotated on a time basis which is set using a Cvar. It also allows to use certain replaceable texts to fill up the ads and make them more dynamic.

Before i receive alot of flaming, i am kinda new to this sort of plugin coding and i used code from other pieces of plugins. The adverts system was not available yet so i decided to use different parts from different coders. I used the "message type" part from the Exclusion chat, i used the variable code from Mapchooser and Nextmap. I dont claim i wrote everything from scratch but it works like a charm for me and i wanted to share it. It can most likely be made a lot better but this works for me!

So credit where credit is due!

Cvars

  • sm_adverts_file
    • File where the ads are taken from
    • Default: configs/adverts.ini
  • sm_adverts_time
    • Rotation time for the ads
    • Default: 300 seconds (5 minutes)
  • sm_adverts_enabled
    • Disables or Enables the showing of the ads
    • Default: Enabled (1)
  • sm_adverts_msgtype
    • How is the message showed on the server?
      • 1: Normal chat - green color
      • 2: Hint text
      • 3: Center on screen text
      • 4: Panel on top
    • Default: Normal chat (1)
Requirements

You NEED the adverts.ini, place this in the: "configs/" directory from sourcemod!

Just add a new ad on each time. Each ad can be 192 characters because this is the maximum the chat can be itself. there is a Maximum of 128 ads which i thougt would be enought.

Optional
If you have the nextmap plugin installed the advert plugin will be able to read the "nextmap" from the Cvar and use it as an Dynamic.

Nextmap: http://forums.alliedmods.net/showthread.php?t=56689


Changelog
  • 02-07-07 - First release
  • 02-07-07 - 1.0.1
    • Removed the dependacy on Nextmap (it does use it if its available)
    • Fixed some comments
    • Made the GetGameTime start on OnMapStart.
Attached Files
File Type: ini adverts.ini (199 Bytes, 5317 views)
File Type: sp Get Plugin or Get Source (adverts.sp - 8723 views - 6.8 KB)

Last edited by Wiebbe; 07-03-2007 at 17:16.
Wiebbe is offline
Wiebbe
Junior Member
Join Date: Jul 2007
Old 07-03-2007 , 16:43   Re: Adverts system
Reply With Quote #2

And i wanted to post a question, this plugin works like a charm, but during compile it does give out a warning. Could anyone tell me how to fix this?

Even with the warning it never crashed in the 2/3 hours i had it running so it does work..
Wiebbe is offline
^BuGs^
Senior Member
Join Date: May 2007
Old 07-03-2007 , 16:45   Re: Adverts system
Reply With Quote #3

Warnings are allowed. They usually say something is not used. Good job.
__________________
Sourcemod Plugin Author and Plugin Approver
"The correct way is MAXPLAYERS + 1"
I will not take bugs/new idea reports over the forums. Please use the issue list.
^BuGs^ is offline
ferret
SourceMod Developer
Join Date: Dec 2004
Location: Atlanta, GA
Old 07-03-2007 , 16:52   Re: Adverts system
Reply With Quote #4

Just some suggestions:
  • Fix the comments at the top, still says Mapchooser and describes Mapchooser
  • remove reliance on Nextmap. If you can't find nextmap, just don't replace your nextmap dynamic. Then the plugin works with or without, rather than requiring a plugin that only needed for one small peice.
  • You should probably set g_fStartTime in OnMapStart too, just to be sure.
__________________
I'm a blast from the past!
ferret is offline
Wiebbe
Junior Member
Join Date: Jul 2007
Old 07-03-2007 , 17:07   Re: Adverts system
Reply With Quote #5

Quote:
Originally Posted by ferret View Post
Just some suggestions:
  • Fix the comments at the top, still says Mapchooser and describes Mapchooser
  • remove reliance on Nextmap. If you can't find nextmap, just don't replace your nextmap dynamic. Then the plugin works with or without, rather than requiring a plugin that only needed for one small peice.
  • You should probably set g_fStartTime in OnMapStart too, just to be sure.
Im embaressed by the comments :>

Sounds like a good idea for the nextmap plugin, ill implement those idea's.
Wiebbe is offline
bobbobagan
SourceMod Donor
Join Date: May 2007
Location: New Zealand
Old 07-04-2007 , 21:28   Re: Adverts system
Reply With Quote #6

can you add a {tickrate} command so it can read what the tickrate of your server is? thanks
__________________
bobbobagan is offline
Send a message via Skype™ to bobbobagan
yester64
Senior Member
Join Date: May 2007
Old 07-05-2007 , 14:44   Re: Adverts system
Reply With Quote #7

well, have it like mani. add tikrate, nextmap etc.
but actually i really would like to see to specify the timerate it will be displayed.
otherwise its a great plugin. once we really need.

Quote:
Originally Posted by bobbobagan View Post
can you add a {tickrate} command so it can read what the tickrate of your server is? thanks
__________________
yester64 is offline
Wiebbe
Junior Member
Join Date: Jul 2007
Old 07-05-2007 , 18:48   Re: Adverts system
Reply With Quote #8

Quote:
Originally Posted by yester64 View Post
well, have it like mani. add tikrate, nextmap etc.
but actually i really would like to see to specify the timerate it will be displayed.
otherwise its a great plugin. once we really need.
i will add tickrate, anything else you can think off?

Nextmap is already in btw ;)

I will see if i can work the location stuff..
Wiebbe is offline
TSCDan
Senior Member
Join Date: Jan 2005
Location: NY, USA
Old 07-05-2007 , 15:38   Re: Adverts system
Reply With Quote #9

Instead of only having one display location, perhaps multiple locations at once?
TSCDan is offline
Send a message via AIM to TSCDan Send a message via MSN to TSCDan Send a message via Yahoo to TSCDan
Extreme_One
Veteran Member
Join Date: Nov 2006
Old 07-06-2007 , 07:45   Re: Adverts system
Reply With Quote #10

I'd also like the ability for adverts to be shown in multiple positions.

But that top panel placement often obscures the radar so I'd love it if you could make the top panel advert only display for dead players (or spectators) whilst the other advert positions are displayed to all.
__________________
Extreme_One is offline
Reply



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 12:04.


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