Raised This Month: $32 Target: $400
 8% 

Plugin Request [Admin Command Logs]


Post New Thread Reply   
 
Thread Tools Display Modes
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 10-12-2018 , 16:26   Re: Plugin Request [Admin Command Logs]
Reply With Quote #11

Quote:
Originally Posted by D4rkSiD3Rs View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>

new g_cmdLine1[512], g_cmdLine2[512], g_cmdLine3[512], g_cmdLine4[512]

new const 
g_Commands[][] =  
{
    
"amx_",
    
"amxmodmenu",
    
"rcon"
}

public 
plugin_init()
{
    
register_plugin("Admin Commands Logger""1.0""TheWhitesmith"// Edited by D4rkSiD3Rs
}

public 
client_command(id)
{
    if(!(
get_user_flags(id) & ADMIN_KICK) && !(get_user_flags(id) & ADMIN_BAN))
        return 
PLUGIN_CONTINUE

    
new name[32]
    new 
authid[32]
    new 
logfile[50]
    new 
configsdir[200]

    new 
text[charsmax(name)+(4*charsmax(g_cmdLine1))]
    
get_configsdir(configsdircharsmax(configsdir))
    
formatex(logfilecharsmax(logfile), "%s/admin_commands_log.txt"configsdir)
    
get_user_name(idnamecharsmax(name))
    
get_user_authid(idauthidcharsmax(authid))

    
read_argv(0g_cmdLine1511)
    
read_argv(1g_cmdLine2511)
    
read_argv(2g_cmdLine3511)
    
read_argv(3g_cmdLine4511)

    for (new 
0sizeof(g_Commands); i++)
    {
        if(!(
containi(g_cmdLine1g_Commands[i]) != -1))
        {
            return 
PLUGIN_CONTINUE
        
}
    }
    
    static 
datestr[11]
    
get_time("%Y-%m-%d"datestr10)
    new 
timestr[9]
    
get_time("%H:%M:%S"timestr8)

    
formatex(textcharsmax(text), "L %s - %s: Name: %s | SteamID: %s | Command: %s %s %s %s"datestrtimestrnameauthidg_cmdLine1g_cmdLine2g_cmdLine3g_cmdLine4)
    
write_file(logfiletext)
    
    return 
PLUGIN_CONTINUE

Not working !!!
Commands are not traced !!!

There is no error log, no compilation error.
Alber9091 is offline
D4rkSiD3Rs
Senior Member
Join Date: Jan 2018
Location: Morocco
Old 10-12-2018 , 16:41   Re: Plugin Request [Admin Command Logs]
Reply With Quote #12

PHP Code:
#include <amxmodx>
#include <amxmisc>

new g_cmdLine1[512], g_cmdLine2[512], g_cmdLine3[512], g_cmdLine4[512]

new const 
g_Commands[][] =  
{
    
"amx",
    
"rcon"
}

public 
plugin_init()
{
    
register_plugin("Admin Commands Logger""1.0""TheWhitesmith"// Edited by D4rkSiD3Rs
}

public 
client_command(id)
{
    if(!(
get_user_flags(id) & ADMIN_KICK) && !(get_user_flags(id) & ADMIN_BAN))
        return 
PLUGIN_CONTINUE

    
new name[32]
    new 
authid[32]
    new 
logfile[50]
    new 
configsdir[200]

    new 
text[charsmax(name)+(4*charsmax(g_cmdLine1))]
    
get_configsdir(configsdircharsmax(configsdir))
    
formatex(logfilecharsmax(logfile), "%s/admin_commands_log.txt"configsdir)
    
get_user_name(idnamecharsmax(name))
    
get_user_authid(idauthidcharsmax(authid))

    
read_argv(0g_cmdLine1511)
    
read_argv(1g_cmdLine2511)
    
read_argv(2g_cmdLine3511)
    
read_argv(3g_cmdLine4511)

    for(new 
0sizeof(g_Commands); i++)
    {
        if(
containi(g_cmdLine1g_Commands[i]) != -1)
        {
            static 
datestr[11]
            
get_time("%Y-%m-%d"datestr10)
            new 
timestr[9]
            
get_time("%H:%M:%S"timestr8)

            
formatex(textcharsmax(text), "L %s - %s: Name: %s | SteamID: %s | Command: %s %s %s %s"datestrtimestrnameauthidg_cmdLine1g_cmdLine2g_cmdLine3g_cmdLine4)
            
write_file(logfiletext)
        }
    }
    
    return 
PLUGIN_CONTINUE

__________________


D4rkSiD3Rs is offline
D4rkSiD3Rs
Senior Member
Join Date: Jan 2018
Location: Morocco
Old 10-12-2018 , 16:55   Re: Plugin Request [Admin Command Logs]
Reply With Quote #13

Tested and it works

Code:
L 2018-10-12 - 22:51:31: Name: ~D4rkSiD3Rs~ | SteamID: STEAM_0:0:222286690 | Command: amxs   
L 2018-10-12 - 22:51:33: Name: ~D4rkSiD3Rs~ | SteamID: STEAM_0:0:222286690 | Command: amx   
L 2018-10-12 - 22:51:59: Name: ~D4rkSiD3Rs~ | SteamID: STEAM_0:0:222286690 | Command: amx_ban test
__________________


D4rkSiD3Rs is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 10-12-2018 , 17:36   Re: Plugin Request [Admin Command Logs]
Reply With Quote #14

Quote:
Originally Posted by D4rkSiD3Rs View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>

new g_cmdLine1[512], g_cmdLine2[512], g_cmdLine3[512], g_cmdLine4[512]

new const 
g_Commands[][] =  
{
    
"amx",
    
"rcon"
}

public 
plugin_init()
{
    
register_plugin("Admin Commands Logger""1.0""TheWhitesmith"// Edited by D4rkSiD3Rs
}

public 
client_command(id)
{
    if(!(
get_user_flags(id) & ADMIN_KICK) && !(get_user_flags(id) & ADMIN_BAN))
        return 
PLUGIN_CONTINUE

    
new name[32]
    new 
authid[32]
    new 
logfile[50]
    new 
configsdir[200]

    new 
text[charsmax(name)+(4*charsmax(g_cmdLine1))]
    
get_configsdir(configsdircharsmax(configsdir))
    
formatex(logfilecharsmax(logfile), "%s/admin_commands_log.txt"configsdir)
    
get_user_name(idnamecharsmax(name))
    
get_user_authid(idauthidcharsmax(authid))

    
read_argv(0g_cmdLine1511)
    
read_argv(1g_cmdLine2511)
    
read_argv(2g_cmdLine3511)
    
read_argv(3g_cmdLine4511)

    for(new 
0sizeof(g_Commands); i++)
    {
        if(
containi(g_cmdLine1g_Commands[i]) != -1)
        {
            static 
datestr[11]
            
get_time("%Y-%m-%d"datestr10)
            new 
timestr[9]
            
get_time("%H:%M:%S"timestr8)

            
formatex(textcharsmax(text), "L %s - %s: Name: %s | SteamID: %s | Command: %s %s %s %s"datestrtimestrnameauthidg_cmdLine1g_cmdLine2g_cmdLine3g_cmdLine4)
            
write_file(logfiletext)
        }
    }
    
    return 
PLUGIN_CONTINUE

Works Perfect !!!

In both conditions:

Quote:
{
"amx",
"rcon"
}
Quote:
{
"amx_",
"amxmodmenu",
"rcon"
}
+

Shuffling Also Works !!!

Year- Month- Date To Date- Month- Year.

Quote:
get_time("%Y-%m-%d", datestr, 10)
To
Quote:
get_time("%d-%m-%Y", datestr, 10)
Alber9091 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-13-2018 , 02:26   Re: Plugin Request [Admin Command Logs]
Reply With Quote #15

The plugin is very badly coded if you want to share it atleast Inform him.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
D4rkSiD3Rs
Senior Member
Join Date: Jan 2018
Location: Morocco
Old 10-13-2018 , 06:26   Re: Plugin Request [Admin Command Logs]
Reply With Quote #16

Quote:
Originally Posted by Natsheh View Post
The plugin is very badly coded if you want to share it atleast Inform him.
I'm not the author of that plugin. I just added some stuffs and shared it
__________________


D4rkSiD3Rs is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 10-13-2018 , 11:06   Re: Plugin Request [Admin Command Logs]
Reply With Quote #17

Quote:
Originally Posted by Natsheh View Post
The plugin is very badly coded if you want to share it atleast Inform him.
Brother, if you have time, Can you please help? It woild be appreciated !!!

Thanks in advance !!!
Alber9091 is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 10-13-2018 , 11:15   Re: Plugin Request [Admin Command Logs]
Reply With Quote #18

Quote:
Originally Posted by Alber9091 View Post
Brother, if you have time, Can you please help? It woild be appreciated !!!

Thanks in advance !!!
A Friend Shared This On Other Forums, But Its For amxx 1.8.3, 1.90 and above where as, I use 1.8.2, can you please convert it to 1.8.2?
or Help with Darkside Plugin as to be well coded.

PHP Code:
/**
 *    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>

#pragma semicolon 1

#define PLUGIN_VERSION "31.10.2018"

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

// 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 2

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

#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_commands.log";
#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

#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_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[128];

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

    new 
szLogsDir[64];
    
get_localinfo("amxx_logs"szLogsDircharsmax(szLogsDir));

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

    
formatex(szBigBuffcharsmax(szBigBuff), "%s/%s"szLogsDirg_szLogFileFolder);
    if(!
dir_exists(szBigBuff)) mkdir(szBigBuff);

    
get_time(fmt("%s/%s/%s"szLogsDirg_szLogFileFolderg_szLogFileName), g_szLogFilecharsmax(g_szLogFile));
#else
    
formatex(g_szLogFilecharsmax(g_szLogFile), "%s/%s"szLogsDirg_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(0szCommandcharsmax(szCommand));

#if TYPE_CMDS_LOG == 1
    // If do not start with amx_ or it's not any symbol after amx_
    
if(containi(szCommand"amx_") == -|| !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(szArgscharsmax(szArgs));

    if(
szArgs[0])
        
func_LogToFile(idszCommandszArgs);
    else 
func_LogToFile(idszCommand);

    return 
PLUGIN_CONTINUE;
}

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

    for(new 
isizeof(g_szCmds); i++)
    {
        if(
containi(szCommandg_szCmds[i]) == 0)
        {
            
bFound true;
            break;
        }
    }

    return 
bFound;
}
#endif

func_LogToFile(idszCommand[], szArgs[] = "")
{
    new 
szAuthID[MAX_AUTHID_LENGTH]; get_user_authid(idszAuthIDcharsmax(szAuthID));
    new 
szIP[MAX_IP_LENGTH]; get_user_ip(idszIPcharsmax(szIP), 1);

    if(
szArgs[0])
        
log_to_file(g_szLogFile"%n (<%s> <%s>) ---> %s %s"idszAuthIDszIPszCommandszArgs);
    else 
log_to_file(g_szLogFile"%n (<%s> <%s>) ---> %s"idszAuthIDszIPszCommand);


Last edited by Alber9091; 10-31-2018 at 17:20.
Alber9091 is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 10-27-2018 , 09:12   Re: Plugin Request [Admin Command Logs]
Reply With Quote #19

Up !!! After 2 Weeks !!!
Any Help Please?

Converting it to 1.8.2?

Last edited by Alber9091; 10-27-2018 at 09:12.
Alber9091 is offline
Reply



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 16:20.


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