Raised This Month: $51 Target: $400
 12% 

Admin Command Logs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 11-03-2016 , 14:55   Admin Command Logs
Reply With Quote #1

Can anyone make plugin like this?

https://forums.alliedmods.net/showthread.php?t=108878

But Plugin Should be much simple than this, Record Admin Logs (Each amx_ Command Used By Admin) With Their STEAM ID's.
Config/ACL/Admin STEAM ID.txt
Detects amx_ commands of Admins:

ADMIN_KICK flag "c"
ADMIN_BAN flag "d"
ADMIN_SLAY flag "e"
ADMIN_MAP flag "f"
ADMIN_CVAR flag "g"
ADMIN_CHAT flag "i"
ADMIN_VOTE flag "j"
ADMIN_RCON flag "l"
ADMIN_LEVEL_A flag "m"
ADMIN_MENU flag "u" */

Some how like this: http://pastebin.com/Up0UjR0q [It's Script; Read It]

In This Format: [Config/ACL/Admin STEAM ID.txt]
'Date' 'Time' 'Admin Nick' 'Admin Ip' 'Command Executed By Admin'

And Every Week, Log File Should Replace Old Logs From Log File (Admin's STEAM ID.txt)

Like: [It's Example Note Dates][12 To 18][7 Days]
Config/ACL/STEAM_0:1:1234567.txt

'12/6/2016' '02:04' 'aTom' '221.475.76.26' 'amx_who'
'13/6/2016' '13:10' 'aTom' '221.475.76.26' 'amx_map "de_dust2"'
'14/6/2016' '16:59' 'aTom' '221.475.76.26' 'amx_votemap "de_dust2" "de_inferno"'
'15/6/2016' '20:25' 'aTom' '221.475.76.26' 'amx_vote "Do You Like This Map" "Yes" "No"'
'16/6/2016' '067' 'aTom' '221.475.76.26' 'amx_exec "Nick" "rate 25000"'
'17/6/2016' '00:03' 'aTom' '221.475.76.26' 'amx_kick "Nick" "Camping"'
'18/6/2016' '00:00' 'aTom' '221.475.76.26' 'amx_banmenu'

After One Week: [It's Example; Note Down Dates][13 To 19][7 Days][Commands Executed On 12 Deleted From File]
Configs/ACL/STEAM_0:1:1234567.txt

'13/06/2016' '13:10' 'aTom' '221.475.76.26' 'amx_map "de_dust2"'
'14/06/2016' '16:59' 'aTom' '221.475.76.26' 'amx_votemap "de_dust2" "de_inferno"'
'15/06/2016' '20:25' 'aTom' '221.475.76.26' 'amx_vote "Do You Like This Map" "Yes" "No"'
'16/06/2016' '067' 'aTom' '221.475.76.26' 'amx_exec "Nick" "rate 25000"'
'17/06/2016' '00:03' 'aTom' '221.475.76.26' 'amx_kick "Nick" "Camping"'
'18/06/2016' '00:00' 'aTom' '221.475.76.26' 'amx_banmenu'
'19/06/2016' '15:45' 'aTom' '221.475.76.26' 'amx_gag "STEAM_0:1:7654321"'


Note: Or You Can Choose This Option Too Instead Of Week Removal, Cvar Max_Command_Entities "" [Default: 300] After Which, Old Entity [Command Entry In Log File] Will Be Removed, And Replaced By New One ..!!

Last edited by Alber9091; 11-03-2016 at 19:08.
Alber9091 is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 11-03-2016 , 15:29   Re: Admin Command Logs
Reply With Quote #2

Search "Command Logging".
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 11-03-2016 , 15:47   Re: Admin Command Logs
Reply With Quote #3

Quote:
Originally Posted by wickedd View Post
Search "Command Logging".
Searched ..!! But mine idea is bit different ..!!
It creates one log file, It doesn't replaces command logs, after certain period (as said by week) or by (entities) ..!! Neither, It logs different for different admins (I.e: STEAM Id.txt) as mentioned above, can't come up to the requirements in many ways ..!!

Well, here is search result ..!!

PHP Code:
#define PLUGINNAME    "Command logger"
#define VERSION        "0.2"
#define AUTHOR        "JGHG"
/*
    http://www.amxmodx.org/forums/viewtopic.php?p=69822

    Logs client console commands.

    Can log everything, or only those lines containing phrases registered with this server command: commandlogger_register
    Can log to AMXX logs, HL logs or a custom logfile.

    Installation
    ************
    Compile as usual. If you need to register more than 64 phrases for the filter, edit the MAXCMDS define accordingly below.
    When adding this to plugins.ini, add it to the very top! This is *extremely* important.
    Also if you run several metamod plugins aside from AMX Mod X, be sure to put AMX Mod X first in metamod's plugins.ini.


    Usage
    *****
    To set where to log, specify this cvar: commandlogger_logto

    commandlogger_logto 0 (default, logs to AMXx logs)
    commandlogger_logto 1 (logs to HL logs)
    commandlogger_logto 2 (logs to custom file)

    If you specify to log to custom file, you should set the path with this cvar: commandlogger_filepath

    commandlogger_filepath customfilepath.log (default, the file will be always be created in the folder addons/amxmodx/logs/)

    By default, the filter is turned on. You can specify this with this cvar: commandlogger_filter

    commandlogger_filter 0 (don't use filter, log all commands, probably you won't need to use this as it will log a ton of commands)
    commandlogger_filter 1 (default, use filter, this only logs the command lines that contain phrases which you must register first, this is case insensitive)

    To add a phrase for the filter, use this server command: commandlogger_register
    commandlogger_register "entmod_create"
    commandlogger_register "amx_ban"

    You must use quotes around phrases that contain spaces.


    History:
    050601    -    Some problems with logging commands/arguments containingg percent characters. Should be fixed.
    041030    -    First release.
*/
#include <amxmodx>
#include <amxmisc>

#define MAXCMDS                64 // If you need to register more tahn 64 cmds for the filter, increase this number accordingly, then recompile.
#define CMDSIZE             63
#define BUFFERSIZE            511
#define CVAR_CUSTOMLOGFILE    "commandlogger_filepath"
#define CVAR_LOGSETTING        "commandlogger_logto"
#define CVAR_FILTER            "commandlogger_filter"

new g_reggedCmdsNum 0
new g_reggedCmds[MAXCMDS][CMDSIZE 1]
new 
g_cmdLine[BUFFERSIZE 1]

public 
client_command(id) {
    
read_argv(0g_cmdLine511)
    new 
tempargs[512]
    
read_args(tempargs511)
    
format(g_cmdLine511"%s %s"g_cmdLinetempargs)

    if (
get_cvar_num(CVAR_FILTER)) {
        new 
bool:hit false
        
// Match contents against registered cmds
        
for (new 0g_reggedCmdsNumi++) {
            if (
containi(g_cmdLineg_reggedCmds[i]) != -1) {
                
hit true
                
break
            }
        }

        if (!
hit)
            return 
PLUGIN_CONTINUE
    
}

    new 
name[32], steamid[32]
    
get_user_name(idname31)
    
get_user_authid(idsteamid31)

    
format(g_cmdLineBUFFERSIZE"%s/%s command: ^"%s^""namesteamidg_cmdLine)

    new 
formated[BUFFERSIZE 1]
    
format_cmd(formatedBUFFERSIZE 2g_cmdLine)
    
//server_print("log formats %s into %s", g_cmdLine, formated)
    
switch(get_cvar_num(CVAR_LOGSETTING)) {
        case 
1: { // HL logs
            
log_message(formated)
            
//server_print("Logged %s to HL logs", g_cmdLine)
        
}
        case 
2: { // Custom logfile
            
new customfile[128]
            
get_cvar_string(CVAR_CUSTOMLOGFILEcustomfile127)
            
log_to_file(customfileformated)
            
//server_print("Logged %s to custom file %s", g_cmdLine, customfile)
        
}
        default: { 
// AMXX logs
            
log_amx(formated)
            
//server_print("Logged %s to AMXX logs", g_cmdLine)
        
}
    }

    return 
PLUGIN_CONTINUE
}

format_cmd(to[], const TO_LENsource[]) {
    new 
toLen 0
    
new const SOURCELENGTH strlen(source)

    for (new 
0SOURCELENGTHi++) {
        if (
source[i] != '%')
            
toLen += format(to[toLen], TO_LEN toLen"%c"source[i])
        else
            
toLen += format(to[toLen], TO_LEN toLen"%%%%")
    }
    
to[toLen] = 0
}

public 
regfn(idlevelcid) {
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED

    
new arg[CMDSIZE 1]
    
read_argv(1argCMDSIZE)

    if (
g_reggedCmdsNum MAXCMDS) {
        
server_print("[%s] WARNING: Couldn't register ^"%s^" because maximum number of commands to log (%d) has been reached!"PLUGINNAMEargMAXCMDS)
        return 
PLUGIN_HANDLED
    
}

    
g_reggedCmds[g_reggedCmdsNum] = arg
    server_print
("[%s] ^"%s^" added to filter."PLUGINNAMEg_reggedCmds[g_reggedCmdsNum])
    
g_reggedCmdsNum++

    return 
PLUGIN_HANDLED
}

public 
plugin_init() {
    
register_plugin(PLUGINNAMEVERSIONAUTHOR)

    
register_cvar(CVAR_CUSTOMLOGFILE"customfilepath.log")
    
register_cvar(CVAR_LOGSETTING"0")
    
register_cvar(CVAR_FILTER"1")

    
//register_srvcmd("0cl", "client_command") (used to test from server console, you don't need it)

    
register_srvcmd("commandlogger_register""regfn", -1"<cmd> - registers cmd to log use of it by clients")


Last edited by Alber9091; 11-03-2016 at 15:49.
Alber9091 is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 11-09-2016 , 14:39   Re: Admin Command Logs
Reply With Quote #4

Bump ..!!
Alber9091 is offline
Amine Belokda
Senior Member
Join Date: Oct 2015
Location: ML_NOT_FOUND
Old 11-10-2016 , 07:54   Re: Admin Command Logs
Reply With Quote #5

Quote:
Originally Posted by Alber9091 View Post
Searched ..!! But mine idea is bit different ..!!
It creates one log file, It doesn't replaces command logs, after certain period (as said by week) or by (entities) ..!! Neither, It logs different for different admins (I.e: STEAM Id.txt) as mentioned above, can't come up to the requirements in many ways ..!!

Well, here is search result ..!!

PHP Code:
#define PLUGINNAME    "Command logger"
#define VERSION        "0.2"
#define AUTHOR        "JGHG"
/*
    http://www.amxmodx.org/forums/viewtopic.php?p=69822

    Logs client console commands.

    Can log everything, or only those lines containing phrases registered with this server command: commandlogger_register
    Can log to AMXX logs, HL logs or a custom logfile.

    Installation
    ************
    Compile as usual. If you need to register more than 64 phrases for the filter, edit the MAXCMDS define accordingly below.
    When adding this to plugins.ini, add it to the very top! This is *extremely* important.
    Also if you run several metamod plugins aside from AMX Mod X, be sure to put AMX Mod X first in metamod's plugins.ini.


    Usage
    *****
    To set where to log, specify this cvar: commandlogger_logto

    commandlogger_logto 0 (default, logs to AMXx logs)
    commandlogger_logto 1 (logs to HL logs)
    commandlogger_logto 2 (logs to custom file)

    If you specify to log to custom file, you should set the path with this cvar: commandlogger_filepath

    commandlogger_filepath customfilepath.log (default, the file will be always be created in the folder addons/amxmodx/logs/)

    By default, the filter is turned on. You can specify this with this cvar: commandlogger_filter

    commandlogger_filter 0 (don't use filter, log all commands, probably you won't need to use this as it will log a ton of commands)
    commandlogger_filter 1 (default, use filter, this only logs the command lines that contain phrases which you must register first, this is case insensitive)

    To add a phrase for the filter, use this server command: commandlogger_register
    commandlogger_register "entmod_create"
    commandlogger_register "amx_ban"

    You must use quotes around phrases that contain spaces.


    History:
    050601    -    Some problems with logging commands/arguments containingg percent characters. Should be fixed.
    041030    -    First release.
*/
#include <amxmodx>
#include <amxmisc>

#define MAXCMDS                64 // If you need to register more tahn 64 cmds for the filter, increase this number accordingly, then recompile.
#define CMDSIZE             63
#define BUFFERSIZE            511
#define CVAR_CUSTOMLOGFILE    "commandlogger_filepath"
#define CVAR_LOGSETTING        "commandlogger_logto"
#define CVAR_FILTER            "commandlogger_filter"

new g_reggedCmdsNum 0
new g_reggedCmds[MAXCMDS][CMDSIZE 1]
new 
g_cmdLine[BUFFERSIZE 1]

public 
client_command(id) {
    
read_argv(0g_cmdLine511)
    new 
tempargs[512]
    
read_args(tempargs511)
    
format(g_cmdLine511"%s %s"g_cmdLinetempargs)

    if (
get_cvar_num(CVAR_FILTER)) {
        new 
bool:hit false
        
// Match contents against registered cmds
        
for (new 0g_reggedCmdsNumi++) {
            if (
containi(g_cmdLineg_reggedCmds[i]) != -1) {
                
hit true
                
break
            }
        }

        if (!
hit)
            return 
PLUGIN_CONTINUE
    
}

    new 
name[32], steamid[32]
    
get_user_name(idname31)
    
get_user_authid(idsteamid31)

    
format(g_cmdLineBUFFERSIZE"%s/%s command: ^"%s^""namesteamidg_cmdLine)

    new 
formated[BUFFERSIZE 1]
    
format_cmd(formatedBUFFERSIZE 2g_cmdLine)
    
//server_print("log formats %s into %s", g_cmdLine, formated)
    
switch(get_cvar_num(CVAR_LOGSETTING)) {
        case 
1: { // HL logs
            
log_message(formated)
            
//server_print("Logged %s to HL logs", g_cmdLine)
        
}
        case 
2: { // Custom logfile
            
new customfile[128]
            
get_cvar_string(CVAR_CUSTOMLOGFILEcustomfile127)
            
log_to_file(customfileformated)
            
//server_print("Logged %s to custom file %s", g_cmdLine, customfile)
        
}
        default: { 
// AMXX logs
            
log_amx(formated)
            
//server_print("Logged %s to AMXX logs", g_cmdLine)
        
}
    }

    return 
PLUGIN_CONTINUE
}

format_cmd(to[], const TO_LENsource[]) {
    new 
toLen 0
    
new const SOURCELENGTH strlen(source)

    for (new 
0SOURCELENGTHi++) {
        if (
source[i] != '%')
            
toLen += format(to[toLen], TO_LEN toLen"%c"source[i])
        else
            
toLen += format(to[toLen], TO_LEN toLen"%%%%")
    }
    
to[toLen] = 0
}

public 
regfn(idlevelcid) {
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED

    
new arg[CMDSIZE 1]
    
read_argv(1argCMDSIZE)

    if (
g_reggedCmdsNum MAXCMDS) {
        
server_print("[%s] WARNING: Couldn't register ^"%s^" because maximum number of commands to log (%d) has been reached!"PLUGINNAMEargMAXCMDS)
        return 
PLUGIN_HANDLED
    
}

    
g_reggedCmds[g_reggedCmdsNum] = arg
    server_print
("[%s] ^"%s^" added to filter."PLUGINNAMEg_reggedCmds[g_reggedCmdsNum])
    
g_reggedCmdsNum++

    return 
PLUGIN_HANDLED
}

public 
plugin_init() {
    
register_plugin(PLUGINNAMEVERSIONAUTHOR)

    
register_cvar(CVAR_CUSTOMLOGFILE"customfilepath.log")
    
register_cvar(CVAR_LOGSETTING"0")
    
register_cvar(CVAR_FILTER"1")

    
//register_srvcmd("0cl", "client_command") (used to test from server console, you don't need it)

    
register_srvcmd("commandlogger_register""regfn", -1"<cmd> - registers cmd to log use of it by clients")

GOOD Plugin thanks goo go
__________________
Amine Belokda is offline
Send a message via MSN to Amine Belokda
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 18:40.


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