AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   Advertisements - MySQL Updated 2/5/09 (https://forums.alliedmods.net/showthread.php?t=84844)

strontiumdog 02-01-2009 18:48

Advertisements - MySQL Updated 2/5/09
 
2 Attachment(s)
Introduction
This is a wrapper for Tsunami's Advertisements plugin.
It is essentially additional code that queries a database at the beginning of every map, and then runs the ads, as per Tsunami's plugin.
Included is a Web interface, allowing Admins to create their ads in a single place, but having them received by all the servers.

If you have a single server, then you do not need this plugin, and I suggest you install the original Advertisements plugin.

A brief history
I wrote this in December because I was getting so fed up changing ads on all 18 of our our servers. One little mistake and the whole thing had to be fixed. In addition, our admins were asking for the opportunity to add their own ads.
Of all the Advertisements plugins out there, Tsunami's was easily the best and so rather than reinventing the wheel, I adapted his plugin, in true SourceMod fashion.
I never had any plans to release it, but when many, many people began asking for it, I had to ask Tsunami if it would be OK to release it.
So a big thanks to him.

If you have bugs with THIS plugin, then report them here and not in the original Ads plugin.


Additional Requirements

Web Server

MYSQL 5.0+
PHP 5.0+
Some knowledge of setting up MySQL databases, phpMyAdmin and installing PHP scripts is required.

Source Dedicated Server
MetaMod
SourceMod 1.1+


Installation
Web Interface
  • Create a new SQL database, and make note of the database name, the database username, the database password and the database hostname.
  • Unzip adsmysql from the zipped file onto your desktop and edit:
    • include/config.php
      adding all the database data, any email data and the name of your community
  • Upload all the contents of adsmysql from the zip file to your web server where you want AdsMySQL installed.
  • Using adsmysql.sql, import the MYSQL data into your new database (using phpMyAdmin)
  • Check it is all working by going to http://www.yourdomain.com/adsmysql and log in as Administrator, password Administrator.
    Go to the Admin center and create a new user, then give them level 9 Admin. Usernames and passwords must be longer than six characters. Then delete the Administrator user.
  • Log in as the new Admin and add a couple of advertisements to test run the web interface.
Game Server
  • Edit your addons/sourcemod/configs/databases.cfg file and add a new section:

    Code:

            "admintools"
        {
            "driver"            "mysql"
            "host"            ""
            "database"            ""
            "user"            ""
            "pass"            ""
            //"timeout"            "0"
            "port"            "3306"
        }

    filling in the information with all the database data.
  • Upload adsmysql.smx to addons/sourcemod/plugins folder
  • Restart the game server and check for any errors in the logs
CVARS
Change time between ads (default 45 seconds)

sm_adsmysql_interval "30"

Web Interface

The web interface has nine levels of admin. Level 9 admins have full access. Level 3 can add and edit database entries but cannot delete them.

You can change the sequence of ads up and down by using the arrow buttons on the right.

The banner is located in the adsmysql/images and is called logo02.jpg. It is an 800x100 image.

Site in use: http://www.theville.org/admintools/ads.php


Game Server Interface
Ads only get reloaded from the database at the beginning of each map.
Admins get a menu command under Server Commands which will allow them to manually reload the ads in the middle of a game.
  • sm_reloadads - Reloads the ads from within the game

Writing Ads

The Interface is simple to use:

http://i56.photobucket.com/albums/g1...ha/ads0003.jpg

Advert Type: Only Hint text, Says and Csays are supported in this current version.
Say text supports the following colors:
{DEFAULT}, {TEAM}, {GREEN} and {LIGHTGREEN}
For a full explanation on how to type in all tags, check out Tsunami's original plugin notes, under Text: http://forums.alliedmods.net/showthread.php?t=67885

Ad Visibility: For simplicity, there are three levels:
  • Admins only
  • Not visible by Admins
  • All players
Admins are defined as those with Reserved Slot status.

Game Type: Ads can be sent to all servers, or only certain servers running that particular game.
Currently supported
  • CSS
  • DoDS
  • TF2
  • Insurgency
  • Pirates, Knights and Vikings.
If you need other games added to the interface, then ask for them in this thread.

Notes

This has been thoroughly tested over the past few months on TF2, DoDS, CSS, Zombie Panic Source, Age of Chivalry, Pirates, Vikings and Knights 2 and Insurgency.

Tsays have been omitted from this version. We never use them in our community because they are short, and easily missed. If there is sufficient interest, I will add them back in.

Has been installed by other communities (as test run guinea pigs!) without issues.

Bear with me on this one! I had to rip it out of an 'Admin Center' plugin that I have written, that incorporates:
  • CommsTools - Permanent Muting/Gagging/Silencing across servers
  • Advertisements via MySQL - this plugin
  • Admin Tracker - tracks all your admins and the amount of time they spend on servers
It makes it easier to install and manage.


Credits
Thanks to Tsunami for allowing me to adapt a good chunk of his code in this plugin.

Thanks also to msleeper and mauirixxx for helping me test the install.

Changelog
Server Plugin
v1.2.100
Released to community

Web Server Interface
v1.3
Released

v1.4
+ Added top say
+ Automatically adds a space after a brace to ensure tsay works
+ Added Age of Chivalry, HL2DM, ZPS
+ Fixed minor security bug
+ Added definition so Server Ops can choose what to call Admins (include/config.php)
+ Added Left4Dead to 'edit ads' page
+ Fixed up HTML layout
+ Fixed bug where ads could not be added due to duplicate ids
+ Added ID column to help in sequencing
+ Changed icon for All games

v1.5
+ Fixed sequence arrows in IE
+ Fixed for some PHP interpreters where <? can't be used for PHP scripts.

DontWannaName 02-01-2009 21:44

Re: Advertisements - MySQL - v1.2.100
 
Do we need to still have tsunamis plugin on or just this? Does it support L4D? Can I add this to a database that has SB installed already?

strontiumdog 02-01-2009 22:36

Re: Advertisements - MySQL - v1.2.100
 
Just this plugin is needed.

Single Server = Tsunami's plugin
Multiple Servers = run this one.

This is a complicated install for many people, and many game servers do not have access to a web server so it might be a daunting install for many new server admins.

Testing with L4D....

The database is your call. It can be added to any existing database, provided the table names are not the same.

Icettiflow 02-01-2009 22:42

Re: Advertisements - MySQL - v1.2.100
 
Another great release. Thanks SD.

msleeper 02-02-2009 00:45

Re: Advertisements - MySQL - v1.2.100
 
Excellent release, a MUST HAVE for multiple server owners who run advertisements!

Mosalar 02-02-2009 01:03

Re: Advertisements - MySQL - v1.2.100
 
Again, thank you for everything you have brought to the sm community.

It is not allowing me any more than 4 ads. Did I goof somewhere?

strontiumdog 02-02-2009 01:49

Re: Advertisements - MySQL - v1.2.100
 
What's your URL?

Mosalar 02-02-2009 01:58

Re: Advertisements - MySQL - v1.2.100
 
Pm sent your way..

*EDIT*
Created another db and I can add plenty of ads, must have mucked the first one up...

Sgt-Mess 02-02-2009 03:17

Re: Advertisements - MySQL - v1.2.100
 
Can you use this to relay only certain messages of advertisements with the MySql to all your servers, and at the same time still use the single server version.

I only as this because I think it would be a great feature, because some servers might have adverts for things other servers on your database might not need.

Like things from css, that wouldn't be on for say a team fortress 2 server.

ottobohn 02-02-2009 09:25

Re: Advertisements - MySQL - v1.2.100
 
Finally, mysql adverts..gets my nipples hard. Ty for a good plugin and the other thing.

otto


All times are GMT -4. The time now is 00:22.

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