Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

[forums.alliedmods.net] VIP Manager + API


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 494
  • Lokalizacja:AMXX.PL
Offline

Napisano 23.01.2012 23:42

VIP Manager + API
Version 0.0.1
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.
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.

Admin Commands:

vip_adduser <name, #userid, authid> <type>

  • Adds user to vip_users.ini and SQL database (if applicable)
  • Player must be connected to server
  • <type> can be 'name', 'steamid', or 'ip'
  • Remember to use quotations around both inputs!
  • Requires rcon flag 'l'
vip_addauth <type> <auth>
  • Adds an authorization to vip_users.ini and SQL database (if applicable)
  • <type> can be 'name', 'steamid', 'ip', or 'tag'
  • Remember to use quotations around both inputs!
  • Requires rcon flag 'l'
vip_reload
  • Reloads the users from the file and checks authorizations for all users
  • 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);

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:

Original release

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.



Attached Files Dołączona grafika Get Plugin or Get Source (vip_manager.sma - 10.5 KB) Dołączona grafika vip.inc (1.3 KB) Dołączona grafika vip.cfg (743 Bytes) Dołączona grafika vip_users.ini (802 Bytes) Dołączona grafika Get Plugin or Get Source (vip_features.sma - 1.2 KB) Dołączona grafika Get Plugin or Get Source (vip_models.sma - 1.5 KB)

Wyświetl pełny artykuł




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych