Thread: MySQL Polls
View Single Post
Author Message
Cep}|{
Member
Join Date: Nov 2009
Old 01-16-2010 , 01:24   MySQL Polls
Reply With Quote #1

Polls mod based on MySQL

[IMG]http://img341.**************/img341/6471/mysqlpolls.jpg[/IMG]

Description:

Mod for in-game voting on MySQL. Easily display the results of voting on your site (in real-time).

Cvars:

sm_mysql_polls_version - Plugin version
sm_mysql_polls_check_client_by "0" - Checking voted client by SteamID or IP. 0 - SteamID, 1 - IP. Default: "0"
sm_mysql_polls_dbconfig "mysql_polls" - Name of database config in addons/sourcemod/configs/database.cfg. Default: "mysql_polls"
sm_mysql_polls_enable "1" - Enable\Disable this plugin. Default: "1"
sm_mysql_polls_prefix "sm_mysql_p" - Table prefix in database. Default: "sm_mysql_p"
sm_mysql_polls_server_id "1" - Server ID for multiservers polls. Default: "1"


DB structure description:

Table prefix_polls:
`id` - poll ID
`name` poll name, for your site
`title` poll title, for in-game poll menu
`time` time creating a poll, for your site
`stat` poll status (0 - inactive\1 - active)
`server_id` server ID for multiservers polls ("1","2","public1" etc.) (see cvars in cfg/sourcemod/mysql_polls.cfg)

Table prefix_variants:
`id` - variant ID
`poll_id` - poll ID
`name` - variant name, for in-game menu

Table prefix_votes:
`id` - vote ID
`poll_id` - poll ID
`time` - voted time
`variant` - variant ID
`steam` - SteamID player voted
`ip` - IP player voted
`name` - nickname player voted

If there are no tables, they will be created automatically )

Version history:


v1.4 (11.19.2010) - Fixed problem with names containing a ' (single quotes)
and:
Quote:
Originally Posted by crazydog
-It asks the newest questions first
-Adds an "Ask me Later" option as the first choice in the poll
-Does not toss up a vote until the player's first death on the server (For our server, I check if mp_friendlyfire is 0 since we use pre round mayhem).
-Asks 2 questions per client per connection
Installation:

1. Edit your addons/sourcemod/configs/databases.cfg file and add a new section (or declare existing in sm_mysql_polls_dbconfig):
Code:
    "mysql_polls"
    {
        "driver"            "mysql"
        "host"            ""
        "database"      ""
        "user"            ""
        "pass"            ""
        //"timeout"            "0"
        "port"            "3306"
    }
2. Upload the plugin in the 'addons/sourcemod/plugins/' folder and refrash plugin list or change map or restart server.

Web-interface - http://forums.alliedmods.net/showpos...7&postcount=13 (Thanks To crazydog)
Attached Files
File Type: sp Get Plugin or Get Source (mysql_polls.sp - 1484 views - 8.1 KB)
__________________

Last edited by Cep}|{; 11-20-2010 at 01:06. Reason: Update to 1.4
Cep}|{ is offline