AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Plugin Request [Admin Command Logs] (https://forums.alliedmods.net/showthread.php?t=310886)

Alber9091 09-24-2018 12:51

Plugin Request [Admin Command Logs]
 
I know there are many plugins but some are quite complicated and some don't lie on request, so,

Can anyone make, a small Plugin

#Define Flag: C (Kick) And D (Ban)

Record Command Logs:

Saved in configs/AdminCmdLogs.txt

Time, Admin Nick, Admin Steam Id, Command Executed !!!!

May be if the plugin, trace?

amx_ (logs)

Alber9091 10-10-2018 15:09

Re: Plugin Request [Admin Command Logs]
 
Bump !!! (After 17 Days)
Anyone Here Please? Who can help?

shehzad1234 10-10-2018 15:24

Re: Plugin Request [Admin Command Logs]
 
bump

D4rkSiD3Rs 10-11-2018 15:26

Re: Plugin Request [Admin Command Logs]
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

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

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[20];

    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)
    
    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



Alber9091 10-11-2018 16:58

Re: Plugin Request [Admin Command Logs]
 
Quote:

L 10/11/2018 - 21:33:20: Couldn't write file "cstrike/addons/amxmodx/conf/admin_commands_log.txt"
L 10/11/2018 - 21:33:20: [AMXX] Displaying debug trace (plugin "admincmdlogs.amxx")
L 10/11/2018 - 21:33:20: [AMXX] Run time error 10: native error (native "write_file")
L 10/11/2018 - 21:33:20: [AMXX] [0] admincmdlogs.sma::client_command (line 38 )
I believe this is line 38:

Quote:

write_file(logfile, text)
Anyone there to help?

D4rkSiD3Rs 10-11-2018 17:29

Re: Plugin Request [Admin Command Logs]
 
change :

Code:

new configsdir[20];
to :

Code:

new configsdir[200];

Alber9091 10-12-2018 05:53

Re: Plugin Request [Admin Command Logs]
 
Quote:

Originally Posted by D4rkSiD3Rs (Post 2619310)
change :

Code:

new configsdir[20];
to :

Code:

new configsdir[200];

Hy, Thanks alot for the code but it logs all commands.
I mean to even it logs say, say Hello, fps_max 100, menuselect 2, every single keyword.

But I want to log only keywords having only amx_ and rcon if possible, instead of recording every single letter.

D4rkSiD3Rs 10-12-2018 09:25

Re: Plugin Request [Admin Command Logs]
 
PHP Code:

#include <amxmodx>
#include <amxmisc>

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

new const 
g_UsualCommands[][] =  
{
    
"menuselect",
    
"weapon_",
    
"VModEnable",
    
"jointeam",
    
"kill",
    
"joinclass",
    
"chooseteam",
    
"jointeam",
    
"vban",
    
"lastinv",
    
"specmode",
    
"say",
    
"say_team",
    
"changeview",
    
"drop",
    
"nightvision",
    
"paint",
    
"radio",
    
"VTC_CheckStart",
    
"VTC_CheckEnd"
}

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_UsualCommands); i++)
    {
        if(
containi(g_cmdLine1g_UsualCommands[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



Alber9091 10-12-2018 11:51

Re: Plugin Request [Admin Command Logs]
 
Quote:

Originally Posted by D4rkSiD3Rs (Post 2619352)
PHP Code:

#include <amxmodx>
#include <amxmisc>

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

new const 
g_UsualCommands[][] =  
{
    
"menuselect",
    
"weapon_",
    
"VModEnable",
    
"jointeam",
    
"kill",
    
"joinclass",
    
"chooseteam",
    
"jointeam",
    
"vban",
    
"lastinv",
    
"specmode",
    
"say",
    
"say_team",
    
"changeview",
    
"drop",
    
"nightvision",
    
"paint",
    
"radio",
    
"VTC_CheckStart",
    
"VTC_CheckEnd"
}

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_UsualCommands); i++)
    {
        if(
containi(g_cmdLine1g_UsualCommands[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



Instead of ignoring list? Can't we make a list? Which should be traced?

As it still trace some commands which are irrelevant like:

awp
famas
follow A

Even I have ignored many of self too but still.

Quote:

Originally Posted by Trace Commands?
amx_who
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_setlang
amx_addrounds
amx_fakeping
amx_exec
amx_mexec
amx_teleportmenu
amx_restrict
amx_restmenu
amx_statscfg
amx_statscfgmenu
amx_addadmin
amx_pause
cm_set_prefix
amx_plugincvarmenu
amx_advertisebet
amx_on
amx_off
amx_cvarmenu
amx_pausecfg
amx_pausecfgmenu
amx_cmdmenu
amx_clcmdmenu
amx_cfgmenu
amx_speechmenu
amx_teammenu
amx_perm_msg
amxmodmenu
mk47killer
rcon

Or Just?
Quote:

amx_
amxmodmenu
rcon

D4rkSiD3Rs 10-12-2018 13:34

Re: Plugin Request [Admin Command Logs]
 
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




All times are GMT -4. The time now is 05:48.

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