Access Manager

amxx reapi Access Manager 1.0.0

Нет прав для скачивания
Установка
  1. Переместите access_manager.txt в директорию /amxmodx/data/lang/
  2. Произведите настройки в конфигах am_users.ini и AccessManager.cfg
  3. Загрузите конфиги am_users.ini и AccessManager.cfg в директорию /amxmodx/configs/
  4. Скомпилируйте плагин (инструкция).
  5. Переместите скомпилированный access_manager.amxx в директорию /amxmodx/plugins/
  6. Закомментируйте текущий загрузчик учётных записей в файле /amxmodx/configs/plugins.ini
  7. Пропишите access_manager.amxx в файле /amxmodx/configs/plugins.ini
  8. Смените карту
Настройки
AccessManager.cfg
Код:
// 'Access Manager' config file

// Set to 1 to use 'am_users.ini' for accounts source. Database connection will not be used at all.
am_local_mode "0"

// Can players without access flag (see cmdaccess.ini) reload accounts using 'amx_reloadadmins' command?
am_allow_reload_to_anyone "0"

// Reloading cooldown in seconds for those who don't have access flag
am_reloadadmins_cooldown "30"

// Queries longer than this value (in seconds) will be considered as long
am_long_query_time "10"

// CS-Bans/AMXBANS database credentials
// System will try to use 'Fresh Bans' or 'Lite Bans' connection.
// If it fails, then it will use these cvars to connect to database.
am_host ""
am_user ""
am_password ""
am_database ""
// Don't forget that this cvar must be set like "IP:PORT"
am_server_ip "127.0.0.1:27015"

// For advanced users only!
// Prune expired accounts that were added to `amx_amxadmins` by 'Access Manager' through native AccessManager_AddAccess()
// NOTE: To use this feature you must:
// 1) Add `ingame` field (int type) to `amx_amxadmins` table
// 2) Uncomment ADD_ACCESS_FEATURE define in source file and recompile it
am_prune_expired "0"
am_users.ini
Код:
; 'Access Manager' accounts list file
; You need to set cvar 'am_local_mode' to 1 to use this file!
; Format: "" "name/steamid/ip" "password" "access flags" "auth flags" "name" "expire time"
; Auth flags:
; a - disconnect player on invalid password
; c - this is steamid
; d - this is ip
; e - password is not checked (only name/steamid/ip needed)
; Expire time can be "lifetime" for accounts without limit or contain exact expiration time in format "%d.%m.%Y - %H:%M:%S"
; Example: "" "STEAM_0:0:123456" "qwerty123" "abcde" "c" "Mr. Admin" "03.05.2021 - 00:00:00"
; Example: "" "Lamer" "pwnzgamer" "drt" "a" "Lamer" "lifetime"
API
Код:
#define MAX_FLAGS_STRING_LENGTH 32
#define MAX_AUTH_FLAGS_STRING_LENGTH 12
#define MAX_ACCOUNT_NAME_LENGTH 64
#define MAX_PASSWORD_HASH_LENGTH 34
#define INVALID_CALLER_ID -1 // AccessManager_AccessAdded() won't be called with this

enum _:ACCOUNT_DATA_STRUCT {
    ACCOUNT_DATA__ROWID, // not used in local mode
    ACCOUNT_DATA__AUTHID[MAX_NAME_LENGTH],
    ACCOUNT_DATA__PASSWORD[MAX_PASSWORD_HASH_LENGTH],
    ACCOUNT_DATA__NAME[MAX_ACCOUNT_NAME_LENGTH],
    ACCOUNT_DATA__ACCESS_FLAGS,
    ACCOUNT_DATA__AUTH_FLAGS,
    ACCOUNT_DATA__EXPIRE,
    ACCOUNT_DATA__CREATED // not used in local mode
}

forward AccessManager_AccessAdded(iUserID, iCallerID);
forward client_admin(pPlayer, bitAccessFlags);
forward amxx_admin_access(pPlayer, bitAccessFlags, iExpireTimeStamp);

native admin_expired(pPlayer);
native amxbans_get_expired(pPlayer);
native adminload_get_expired(pPlayer);

native AccessManager_ReAuthPlayer(pPlayer);

// To use this native, first see 'ADD_ACCESS_FEATURE' define in AccessManager.sma
// pPlayer - player index (pass 0 if player is not connected)
// szAuthID - player authid
// szFlags - flags to give
// iMinutes - minutes to add
// iCaller - caller indentifier that will be passed to AccessManager_AccessAdded()
//    when all is done (pass INVALID_CALLER_ID if you don't need callback)
native AccessManager_AddAccess(pPlayer, const szAuthID[], const szFlags[], iDays, iCaller = INVALID_CALLER_ID);
Сверху Снизу