AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   VIP Manager + API (https://forums.alliedmods.net/showthread.php?t=176850)

Exolent[jNr] 01-23-2012 17:42

VIP Manager + API
 
8 Attachment(s)
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.

stevenisecko138 01-23-2012 18:22

Re: VIP Manager + API
 
amazing work

Magic_Carpet 01-23-2012 18:41

Re: VIP Manager + API
 
Nice plugin!

kramesa 01-23-2012 18:43

Re: VIP Manager + API
 
GJ!

joshknifer 01-23-2012 18:52

Re: VIP Manager + API
 
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.

kramesa 01-23-2012 19:41

Re: VIP Manager + API
 
130 views? WTF?

lucas_7_94 01-23-2012 19:42

Re: VIP Manager + API
 
What is the problem , the style coding from exolent is awesome.

pacheco 01-23-2012 20:12

Re: VIP Manager + API
 
Wow, nice Exolent!

SparkyFromiFun 01-24-2012 03:15

Re: VIP Manager + API
 
i'm excited with this work, but how i can it made working if i use a amxbans?

OxfordL 01-24-2012 05:04

Re: VIP Manager + API
 
Very nice and interesting.


All times are GMT -4. The time now is 04:59.

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