View Single Post
D4rkSiD3Rs
Senior Member
Join Date: Jan 2018
Location: Morocco
Old 10-12-2018 , 13:34   Re: Plugin Request [Admin Command Logs]
Reply With Quote #10

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

__________________


D4rkSiD3Rs is offline