Raised This Month: $95 Target: $400
 23% 

VIP Manager + API


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose        Approver:   Arkshine (91)
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-23-2012 , 18:42   VIP Manager + API
Reply With Quote #1

VIP Manager + API
Version 0.0.6
by Exolent



Introduction:
I've seen many plugins written for VIPs that are redundant at declaring who is VIP but also lack many features.
This plugin was designed to allow server owners to easily declare VIPs in multiple methods (.ini file, admin flag, and SQL support) and allow plugin developers to build VIP features from that base.
VIP users can also have an expiration date for those with donating VIPs.
It is easily extendable as you can see in some of the attached plugins below.

Customization:
For all customization, see the vip.cfg file attached.

Installation:
1. Install vip_manager.amxx anywhere in your plugins.ini and be sure to place the .amxx file in your plugins directory.
2. Place vip.cfg file in the addons/amxmodx/configs directory
3. Place vip_users.ini file in the addons/amxmodx/configs directory[/list]

File Setup:
Setting up VIPs via the file system is just as simple as admins.
Open up vip_users.ini and follow the steps shown inside the file.
If modifying VIPs and you want current players to take affect to privileges, use the vip_reload command when finished editing.

SQL Setup:
Setting up VIPs in an SQL environment is not difficult at all.
1. You will need to edit the vip.cfg file to have your SQL configuration properly set up.
2. Run the plugin on the server at least once so that the table is created in your SQL database.
3. You can manually go into the table (not recommended) and add VIPs, or use the vip_addauth/vip_adduser commands to set up the VIPs.
4. Changes to the SQL database should be shown in the server immediately. However, players currently in the server during changes won't be affected until next map or if vip_reload is called.

Web Tool Setup:
There is a web tool attached to this post as vip_manager.zip.
It allows you to manage your SQL database easily for adding, editing, and deleting VIP users.

Requirements:
  • PHP 5.1.0 or higher
  • Permissions to access your database
Installation:
  1. Download and unzip the package.
  2. Open the file /_inc/config.php and edit your settings accordingly.
  3. Place the files on your web server.
After these steps have been taken, you should be able to go to the site (http://server.com/path/to/index.php) and manage VIP users.[/list]

Admin Commands:
vip_adduser <name, #userid, authid> <type> [password] [flags] [days]
  • Adds user to vip_users.ini and SQL database (if applicable)
  • Player must be connected to server
  • <type> can be 'name', 'steamid', or 'ip'
  • If [days] is given, then that VIP entry will expire in that amount of days
  • Remember to use quotations around all inputs!
  • Requires rcon flag 'l'

vip_addauth <type> <auth> [password] [flags] [days]
  • Adds an authorization to vip_users.ini and SQL database (if applicable)
  • <type> can be 'name', 'steamid', 'ip', or 'tag'
  • If [days] is given, then that VIP entry will expire in that amount of days
  • Remember to use quotations around all inputs!
  • Requires rcon flag 'l'

vip_reload
  • Reloads the users from the file
  • Checks authorizations for all users
  • Deletes any old entries if that feature is enabled
  • Requires rcon flag 'l'

Requirements:
AMX Mod X 1.8.1 or higher

Plugin API:
Functions:
PHP Code:
/**
 * Checks whether a player is VIP or not
 * 
 * @param        id - Unique index of player
 * 
 * @return        True if VIP, false otherwise
 * 
 * @note        This could return false in client_connect(), client_authorized(), client_putinserver(), and client_disconnect().
 *            Use the vip_authorized(), vip_putinserver() and vip_disconnect() forwards instead.
 */
native is_user_vip(id);

/**
 * Gets flags that were given to the VIP user
 * 
 * @param        id - Unique index of player
 * 
 * @return        Bitsum of ADMIN_* constants
 * 
 * @note        This could return false in client_connect(), client_authorized(), client_putinserver(), and client_disconnect().
 *            Use the vip_authorized(), vip_putinserver() and vip_disconnect() forwards instead.
 * 
 * @note        This could return 0 for no flags, yet the player could still be a VIP.
 */
native get_vip_flags(id); 
Forwards:
PHP Code:
/**
 * Called when a VIP player authorizes
 * 
 * @param        id - Unique index of player
 * 
 * @return        Return values are ignored
 */
forward vip_authorized(id);

/**
 * Called when a VIP player joins the server
 * 
 * @param        id - Unique index of player
 * 
 * @return        Return values are ignored
 */
forward vip_putinserver(id);

/**
 * Called when a VIP player disconnects
 * 
 * @param        id - Unique index of player
 * 
 * @return        Return values are ignored
 */
forward vip_disconnect(id); 
Notes:
Remember when developing with 3rd-party includes such as vip.inc, you will need to compile your plugins locally.
See here for more information.

Changelog:

0.0.6
  • Fixed adding players and auths to SQL not working
  • Added to check if auth already exists when adding player to SQL
0.0.5
  • Added password support for VIPs
  • Added vip_password_field cvar
0.0.4
  • Added flags support for VIPs
  • Added vip_default_flags cvar
  • Added date picker tool in the web tool
0.0.3
  • Fixed SQL connection and loading users from SQL
0.0.2
  • Added expired VIP support.
  • SQL checking is now saved into memory for less calls to the database.

Author Notes:
See attached plugins such as vip_features.sma and vip_models.sma for examples on using this API.
vip_models.sma is a poor way to set player models and is only there for a simple example.
All suggestions are welcome to improve this plugin, but be aware that no "special" features for VIPs will be in the API other than determining who is a VIP.

Upgrading From v0.0.1 to v0.0.5:
There was an important change on the table in the database!
If you were using SQL in v0.0.1, you will need to run this query on your database for the plugin to work properly:
Code:
ALTER TABLE `vip_users` ADD `date_remove` DATE NOT NULL DEFAULT '0000-00-00', ADD `flags` VARCHAR(26) NOT NULL DEFAULT '', ADD `password` VARCHAR(32) NOT NULL DEFAULT '';
Upgrading From v0.0.2 to v0.0.5:
There was an important change on the table in the database!
If you were using SQL in v0.0.2, you will need to run this query on your database for the plugin to work properly:
Code:
ALTER TABLE `vip_users` ADD `flags` VARCHAR(26) NOT NULL DEFAULT '', ADD `password` VARCHAR(32) NOT NULL DEFAULT '';
Flags in the vip_users.ini are added before the remove date, so be sure to update your file accordingly.
Also, the password was added before the flags in the file.

If you were using the web tool from v0.0.3, you will need to update with the one from v0.0.4+!

Upgrading From v0.0.4 to v0.0.5:
There was an important change on the table in the database!
If you were using SQL in v0.0.4, you will need to run this query on your database for the plugin to work properly:
Code:
ALTER TABLE `vip_users` ADD `password` VARCHAR(32) NOT NULL DEFAULT '';
The password was added before the flags in the users.ini, so be sure to update your file accordingly.
Attached Files
File Type: sma Get Plugin or Get Source (vip_features.sma - 6170 views - 1.2 KB)
File Type: sma Get Plugin or Get Source (vip_models.sma - 5199 views - 1.5 KB)
File Type: inc vip.inc (1.3 KB, 3374 views)
File Type: cfg vip.cfg (1.2 KB, 4479 views)
File Type: ini vip_users.ini (1.6 KB, 4398 views)
File Type: zip vip_manager.zip (68.6 KB, 5230 views)
File Type: sma Get Plugin or Get Source (vip_manager.sma - 6713 views - 24.8 KB)
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 05-02-2012 at 11:46. Reason: Updated to v0.0.6
Exolent[jNr] is offline
stevenisecko138
Senior Member
Join Date: Dec 2008
Location: CA
Old 01-23-2012 , 19:22   Re: VIP Manager + API
Reply With Quote #2

amazing work
stevenisecko138 is offline
Send a message via AIM to stevenisecko138
Magic_Carpet
Junior Member
Join Date: Nov 2011
Old 01-23-2012 , 19:41   Re: VIP Manager + API
Reply With Quote #3

Nice plugin!
Magic_Carpet is offline
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 01-23-2012 , 19:43   Re: VIP Manager + API
Reply With Quote #4

GJ!
__________________
kramesa is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 01-23-2012 , 19:52   Re: VIP Manager + API
Reply With Quote #5

Wow this is going to be so helpful for all of the VIP requests that are made. Very nice. I appreciate the features plugin as well. Nice job.
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 01-23-2012 , 20:41   Re: VIP Manager + API
Reply With Quote #6

130 views? WTF?
__________________
kramesa is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 01-23-2012 , 20:42   Re: VIP Manager + API
Reply With Quote #7

What is the problem , the style coding from exolent is awesome.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
pacheco
Senior Member
Join Date: Jul 2011
Old 01-23-2012 , 21:12   Re: VIP Manager + API
Reply With Quote #8

Wow, nice Exolent!
__________________



pacheco is offline
SparkyFromiFun
Member
Join Date: Jan 2012
Old 01-24-2012 , 04:15   Re: VIP Manager + API
Reply With Quote #9

i'm excited with this work, but how i can it made working if i use a amxbans?
__________________
My New moded Warcraft3 servers:

SparkyFromiFun is offline
OxfordL
Member
Join Date: Nov 2011
Location: Paris
Old 01-24-2012 , 06:04   Re: VIP Manager + API
Reply With Quote #10

Very nice and interesting.

Last edited by OxfordL; 01-24-2012 at 06:15.
OxfordL is offline
Reply


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 02:07.


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