Admin Commands Log

Admin Commands Log 1.1

Нет прав для скачивания

w0w

Сообщения
984
Реакции
1.910
w0w добавил(а) новый ресурс:

Admin Commands Log - Позволяет логировать команды всех игроков или игроков с правами

При TYPE_CMDS_LOG 1 записывает в файл все команды начинающиеся с "amx_" а при TYPE_CMDS_LOG 2 записывает в файл все команды что указаны в массиве g_szCmds.

Название файла куда будут сохраняться логи можно изменить в g_szLogFileName, по стандарту это admin_commands.log

Если нужно отслеживать команды не только игроков с правами то нужно закомментировать дефайн LOG_BY_FLAGS, если оставить его по стандарту раскоментированным то тогда будут...
Узнать больше об этом ресурсе...
 
Сообщения
891
Реакции
1.004
asd, kontakt, Обновить АМХ до 1.9.0
 
Сообщения
96
Реакции
37
Hello Wow !!!

You can make it,

PHP:
 #define TYPE_CMDS_LOG
To
1- amx_, 2- g_szCmds, 3- Both
Because there are plugins which don't
use amx_, a simple example is amxmodmenu cm_set_prefix or rcon.

Hence, adding 3- Both will be a Option.

Can it be done anyway possible, it can be traced from the menu too?

Example:
amx_banmenu

Command is traced but Now command is used on which player? With which reason and what is a long ban duration? Such trace may also make plugin good.

+++

You can determine Cvar:

Logmode:
1- Commands to be logged in 1 file.
2- Commands to be logged date wise.

I hope my suggestion will help !!
 

w0w

Сообщения
984
Реакции
1.910
asd, kontakt, I can fix the issue with compilation on AMXX < 1.9.0.5229 but I hope that you upgrade to AMXX 1.9.0 latest version and thus help developers in testing the new version which is even better than the AMXX 1.8.2 or AMXX 1.8.3.

So far, I added to the requirements of the plugin that the version of AMXX should be 1.9.0.5229 or higher.

1- amx_, 2- g_szCmds, 3- Both
Sure, I think it will be added in the next update.

Command is traced but Now command is used on which player? With which reason and what is a long ban duration? Such trace may also make plugin good.
I don't know if it's possible, anyway I don't know how to do it. The arguments of the command are also traced in the current version, but not from menu. For example: amx_vote "test" "1" "2" "3". It will log the command and its arguments.

Logmode:
1- Commands to be logged in 1 file.
2- Commands to be logged date wise.
What is "date wise"?
 
Последнее редактирование:
Сообщения
96
Реакции
37
asd, kontakt, I can fix the issue with compilation on AMXX < 1.9.0.5229 but I hope that you upgrade to AMXX 1.9.0 latest version and thus help developers in testing the new version which is even better than the AMXX 1.8.2 or AMXX 1.8.3.

So far, I added to the requirements of the plugin that the version of AMXX should be 1.9.0.5229 or higher.
I also need it in 1.8.2, if you could help with it? And Pm me !!! Actually due to lack of time, I'm not able to upgrade my server to AMXMODX 1.9.
I Know, I'm not contributing in this behalf, I'm Sorry for it.

Sure, I think it will be added in the next update.
Thanks Brother !!!

I don't know if it's possible, anyway I don't know how to do it. The arguments of the command are also traced in the current version, but not from menu. For example: amx_vote "test" "1" "2" "3". It will log the command and its arguments.
I think its possible,
I believe, I saw it somewhere but plugin was not that much coded + not upto the requirements. May be someone can provide you suggestion here? Else it would be Okay in that case !!!

By that wise I mean:
1- Only One File (Log)
2- Everyday new log

Have a look at these screenshots: [Example]

https://ibb.co/bFn719
https://ibb.co/kpEn19
 

w0w

Сообщения
984
Реакции
1.910
DrStrange, Okay, I'll add this feature in the next update. About logging menus, if someone will help I'll add this feature, at the moment I have no idea how to implement it.
 

w0w

Сообщения
984
Реакции
1.910
Обновлен ресурс Admin Commands Log новой записью:

Обновление 16.10.2018

  • Исправлена ошибка компиляции на AMXX 1.8.3 (я всё же советую перейти на AMXX 1.9.0)
  • Добавлены новые настройки:
    • TYPE_CMDS_LOG 3: будет записывать все команды начинающиеся с "amx_" и те что находятся в массиве g_szCmds (ранее либо первое либо второе).
    • LOG_FORMAT: теперь есть выбор записывать логи в один файл (за всё время), записывать ежедневно т.е. каждый день (LOG_FORMAT 2) будет создаваться новый файл в папке что вы укажите в...
Узнать больше об этом обновлении...
 
Сообщения
96
Реакции
37
It should be:

PHP:
#elseif LOG_FORMAT == 2
    new const g_szLogFileFolder[] = "admin_commands";
    new const g_szLogFileName[] = "admin_commands_%m-%Y.log";
#elseif LOG_FORMAT == 3
    new const g_szLogFileFolder[] = "admin_commands";
    new const g_szLogFileName[] = "admin_commands_%d-%m-%Y.log";
#endif

To

PHP:
#elseif LOG_FORMAT == 2
    new const g_szLogFileFolder[] = "admin_commands";
    new const g_szLogFileName[] = "admin_commands_%d-%m-%Y.log";
#elseif LOG_FORMAT == 3
    new const g_szLogFileFolder[] = "admin_commands";
    new const g_szLogFileName[] = "admin_commands_%m-%Y.log";
#endif


Because,

Код:
2= 1 file- 1 day (According To Date)
3= 1 file- 1 Month (According To Month)
Well Files are made according to the Date And Month Respectively but When it is made with Date, The date is not mention, i.e: 10-2018.
And when it is made with Month, The date is mentioned, i.e: 31-10-2018.

Hence, Kindly Correct this Typo in the Code.

I have Attached that fix, You can Just Directly Update The File.

P.S: I have made admin_commands to admin_command so file name when with %d-%m-%Y is generated, it misses g of .log and file is created as .lo instead of .log, hence I have removed s from admin_commands and made it admin_command.


PHP:
/**
*    Author: w0w ( https://dev-cs.ru/members/444/ )
*
*    Thanks to:
*    mx?! ( https://dev-cs.ru/members/1111/ )
*    wopox1337 ( https://dev-cs.ru/members/4/ )
*
*    Idea: DrStrange ( https://dev-cs.ru/threads/3792/ )
*/

#include <amxmodx>

/** ------------------------------------------------------------------------------------------------------------------------- */
/** ------------------------------------------------------------------------------------------------------------------------- */
/** ------------------------------------------------------------------------------------------------------------------------- */

// RU: 1 - логируем команды начинающиеся с "amx_"
// EN: 1 - logging all cmds "amx_"
// ES: 1 - registrar todos los comandos que empiezan por "amx_"
// ------------------------------------------------------
// RU: 2 - логируем все команды из g_szCmds
// EN: 2 - logging all cmds from g_szCmds
// ES: 2 - registrar todos los comandos que están en g_szCmds
// ------------------------------------------------------
// RU: 3 - логируем все команды из g_szCmds и те что начинаются с "amx_"
// EN: 3 - logging all cmds from g_szCmds and those which starts with "amx_"
// ES: 3 - registrar todos los comandos que están en g_szCmds o que empiezan por "amx_"
#define TYPE_CMDS_LOG 3

/** ------------------------------------------------------------------------------------------------------------------------- */
/** ------------------------------------------------------------------------------------------------------------------------- */
/** ------------------------------------------------------------------------------------------------------------------------- */

// RU: Если не закомментировано то логирует только если у игрока есть один из флагов
// EN: If it's not commented, it will log only if the player has one of the specified flags
// ES: Si no está comentado, entonces solo se registrarán los comandos de los jugadores que tengan alguno de los siguientes accesos
#define LOG_BY_FLAGS (ADMIN_KICK|ADMIN_BAN|ADMIN_LEVEL_A|ADMIN_RCON|ADMIN_CFG)

/** ------------------------------------------------------------------------------------------------------------------------- */
/** ------------------------------------------------------------------------------------------------------------------------- */
/** ------------------------------------------------------------------------------------------------------------------------- */

// RU: 1 - Логировать все команды в один файл
// EN: 1 - Logging all comands to one file
// ES: 1 - Registrar todos los comandos al mismo documento
// ------------------------------------------------------
// RU: 2 - Логировать все команды в файл, 1 файл - 1 день
// EN: 2 - Logging all comands to a file, 1 file - 1 day
// ES: 2 - Registrar todos los comandos a un documento, un documento - 1 día
// ------------------------------------------------------
// RU: 3 - Логировать все команды в файл, 1 файл - 1 месяц
// EN: 3 - Logging all comands to a file, 1 file - 1 month
// ES: 3 - Registrar todos los comandos a un documento, un documento - 1 mes
#define LOG_FORMAT 1

/** ------------------------------------------------------------------------------------------------------------------------- */
/** ------------------------------------------------------------------------------------------------------------------------- */
/** ------------------------------------------------------------------------------------------------------------------------- */

#if LOG_FORMAT == 1
    // RU: Название файла для логов
    // EN: File name for logs
    // ES: Nombre del archivo donde se guardarán todos los logs
    new const g_szLogFileName[] = "admin_command.log";
#elseif LOG_FORMAT == 2
    new const g_szLogFileFolder[] = "admin_commands";
    new const g_szLogFileName[] = "admin_command_%d-%m-%Y.log";
#elseif LOG_FORMAT == 3
    new const g_szLogFileFolder[] = "admin_commands";
    new const g_szLogFileName[] = "admin_command_%m-%Y.log";
#endif

#if TYPE_CMDS_LOG == 2 || TYPE_CMDS_LOG == 3
    new const g_szCmds[][] =
    {
        "amx_map",
        "amx_vote",
        "amx_votemap",
        "amx_votekick",
        "amx_voteban",
        "amx_cancelvote",
        "amx_cvar",
        "amx_nick",
        "amx_rcon",
        "amx_gag",
        "amx_ungag",
        "amx_addrounds",
        "amx_addgag",
        "amx_exec",
        "amx_teleportmenu",
        "amx_restrict",
        "amx_restmenu",
        "amx_statscfg",
        "amx_statscfgmenu",
        "amx_addadmin",
        "amx_pause",
        "amx_plugincvarmenu",
        "amx_on",
        "amx_off",
        "amx_cvarmenu",
        "amx_pausecfg",
        "amx_pausecfgmenu",
        "amx_cmdmenu",
        "amx_clcmdmenu",
        "amx_cfgmenu",
        "amx_speechmenu",
        "amx_teammenu",
        "amxmodmenu"
    };
#endif

// Compability AMXX 1.8.3
#if !defined MAX_AUTHID_LENGTH
    #define MAX_AUTHID_LENGTH 64
#endif

#if !defined MAX_IP_LENGTH
    #define MAX_IP_LENGTH 16
#endif

new g_szLogFile[64];

public plugin_init()
{
    register_plugin("Admin Commands Log", "16.10.2018", "w0w");

    new szLogsDir[64]
    get_localinfo("amxx_logs", szLogsDir, charsmax(szLogsDir));

#if LOG_FORMAT == 2 || LOG_FORMAT == 3
    new szBigBuff[128];

    formatex(szBigBuff, charsmax(szBigBuff), "%s/%s", szLogsDir, g_szLogFileFolder);
    if(!dir_exists(szBigBuff)) mkdir(szBigBuff);

    get_time(fmt("%s/%s/%s", szLogsDir, g_szLogFileFolder, g_szLogFileName), g_szLogFile, charsmax(g_szLogFile));
#else
    formatex(g_szLogFile, charsmax(g_szLogFile), "%s/%s", szLogsDir, g_szLogFileName);
#endif
}

public client_command(id)
{
#if defined LOG_BY_FLAGS
    // The player doesn't have any flag from LOG_BY_FLAGS
    if(!(get_user_flags(id) & LOG_BY_FLAGS))
        return PLUGIN_CONTINUE;
#endif

    new szCommand[64]; read_argv(0, szCommand, charsmax(szCommand));

#if TYPE_CMDS_LOG == 1
    // If do not start with amx_ or it's not any symbol after amx_
    if(containi(szCommand, "amx_") == -1 || !szCommand[4])
        return PLUGIN_CONTINUE;
#elseif TYPE_CMDS_LOG == 2
    if(!func_CommandExists(szCommand))
        return PLUGIN_CONTINUE;
#elseif TYPE_CMDS_LOG == 3
    if(!func_CommandExists(szCommand) && containi(szCommand, "amx_") == -1)
        return PLUGIN_CONTINUE;
#endif

    new szArgs[64]; read_args(szArgs, charsmax(szArgs));

    if(szArgs[0])
        func_LogToFile(id, szCommand, szArgs);
    else func_LogToFile(id, szCommand);

    return PLUGIN_CONTINUE;
}

#if TYPE_CMDS_LOG == 2 || TYPE_CMDS_LOG == 3
func_CommandExists(szCommand[])
{
    new bool:bFound;

    for(new i; i < sizeof(g_szCmds); i++)
    {
        if(containi(szCommand, g_szCmds) == 0)
        {
            bFound = true;
            break;
        }
    }

    return bFound;
}
#endif

func_LogToFile(id, szCommand[], szArgs[] = "")
{
    new szAuthID[MAX_AUTHID_LENGTH]; get_user_authid(id, szAuthID, charsmax(szAuthID));
    new szIP[MAX_IP_LENGTH]; get_user_ip(id, szIP, charsmax(szIP), 1);

    if(szArgs[0])
        log_to_file(g_szLogFile, "%n (<%s> <%s>) ---> %s %s", id, szAuthID, szIP, szCommand, szArgs);
    else log_to_file(g_szLogFile, "%n (<%s> <%s>) ---> %s", id, szAuthID, szIP, szCommand);
}
 

Вложения

Последнее редактирование:
Сообщения
5
Реакции
8
Неверный раздел форума, вам сюда: https://dev-cs.ru/forums/plugins-errors/post-thread
логов не создавалось. ошибка в debug.
плагин без изменений. где вообще логи должны создаваться?
в plugins.ini плагин в конце
L 01/08/2019 - 23:55:18: [AMXX] Displaying debug trace (plugin "admin_commands_log.amxx", version "1.0")
L 01/08/2019 - 23:55:18: [AMXX] Run time error 25: parameter error
L 01/08/2019 - 23:55:18: [AMXX] [0] admin_commands_log.sma::plugin_init (line 85)
AMX Mod X 1.9.0.5234 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Nov 3 2018 14:55:29
Built from: https://github.com/alliedmodders/amxmodx/commit/9eb1f42
Build ID: 5234:9eb1f42
Core mode: JIT+ASM32
"acl_type" is "0"
"acl_access" is "cdhlm"
"acl_log_type" is "1"
 

w0w

Сообщения
984
Реакции
1.910
bloodknife, это вся ошибка из логов? Значения в конфиге плагина такие же?
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу