General Player Commands Logs (previously said to be impossible)

Plug-ins compatibility with Zombie Escape 1.x only!


Post Reply
User avatar
TheWhitesmith
Member
Member
Morocco
Posts: 33
Joined: 6 years ago
Location: Temara/Rabat
Contact:

Player Commands Logs (previously said to be impossible)

#1

Post by TheWhitesmith » 6 years ago

Alright dudes, I guess this is the end of AMXX scripting for me as I'm moving to SourceMod. So why not giving you something that was very (very very very) helpful for me.
I created this plugin from 0, apparently you would never find something similar in the net.
This is so useful when there is a config that makes the server crash, this plugin gets everything typed in console by any player (but not client side commands: bind, exec, etc...)
There you go:

Code: Select all

#include <amxmodx>
#include <amxmisc>
 
#define PLUGIN "Command Logger"
#define VERSION "1.0"
#define AUTHOR "TheWhitesmith."
 
new g_cmdLine1[512], g_cmdLine2[512], g_cmdLine3[512], g_cmdLine4[512], g_bSuspected[33]
new const g_UsualCommands[][] =  
{
    "amxmodmenu",
    "menuselect",
    "weapon_",
    "VModEnable",
    "jointeam",
    "joinclass",
    "guns",
    "chooseteam",
    "vban",
    "lastinv",
    "specmode",
    "say",
    "hook",
    "grab",
    "drag",
    "drop",
    "nightvision",
    "paint",
    "radio",
    "VTC_CheckStart",
    "VTC_CheckEnd"
}
 
new const g_CheatCommands[][] = {
    "xScript",
    "xHack_",
    "superstref",
    "jumpbug",
    "xdaa",
    "bog",
    "gstrafe",
    "ground"
}
 
public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
}
 
public plugin_natives() {
    register_native("set_suspected", "_set_suspected")
}
 
public _set_suspected(id) {
    g_bSuspected[id] = true
}
 
public client_disconnected(id) {
    g_bSuspected[id] = false
}
 
public client_command(id)
{
    new name[32]
    new logfile[50];
    new datadir[20];
    new text[charsmax(name)+(4*charsmax(g_cmdLine1))]
    get_datadir(datadir, charsmax(datadir));
    formatex(logfile, charsmax(logfile), "%s/command_logs.txt", datadir);
    get_user_name(id, name, charsmax(name))
    read_argv(0, g_cmdLine1, 511)
    read_argv(1, g_cmdLine2, 511)
    read_argv(2, g_cmdLine3, 511)
    read_argv(3, g_cmdLine4, 511)
    if(!g_bSuspected[id]) {
        for (new i = 0; i < sizeof(g_UsualCommands); i++) {
            if(containi(g_cmdLine1, g_UsualCommands[i]) != -1) {
                return PLUGIN_CONTINUE
            }
        }
    }
   
    for (new i = 0; i < sizeof(g_CheatCommands); i++) {
        if(containi(g_cmdLine1, g_CheatCommands[i]) != -1) {
            log_to_file("Log_Cheaters.log", "Player %s suspected of cheating!, command: %s %s %s %s", name, g_cmdLine1, g_cmdLine2, g_cmdLine3, g_cmdLine4)
            punish_cheater(id)
        }
    }
   
   
    formatex(text, charsmax(text), "%s: %s %s %s %s", name, g_cmdLine1, g_cmdLine2, g_cmdLine3, g_cmdLine4);
    write_file(logfile, text)
    if(g_bSuspected[id]) {
        formatex(logfile, charsmax(logfile), "addons/amxmodx/suspected/%s-Suspected.txt", name);
        write_file(logfile, text)
    }
   
    return PLUGIN_CONTINUE
}
 
public punish_cheater(id) {
    if(is_user_connected(id)) {
        forceCmd(id, "bind mouse3 ^"^"")
        forceCmd(id, "bind alt ^"^"")
        forceCmd(id, "bind tab ^"+showscores^"")
        forceCmd(id, "bind ctrl ^"+duck^"")
        forceCmd(id, "bind x ^"+hook^"")
        forceCmd(id, "bind z ^"+radio1^"")
        forceCmd(id, "bind c ^"+radio3^"")
        forceCmd(id, "bind b ^"buy^"")
    }
}
 
stock forceCmd( id , const szText[] , any:... ) {
   
    #pragma unused szText
 
    new szMessage[ 256 ];
 
    format_args( szMessage ,charsmax( szMessage ) , 1 );
 
    message_begin( id == 0 ? MSG_ALL : MSG_ONE, 51, _, id )
    write_byte( strlen( szMessage ) + 2 )
    write_byte( 10 )
    write_string( szMessage )
    message_end()
}
[SYA] CSGO-Mod for CS 1.6 [ Cases/Keys/Rank ][/size]
IP: 149.202.251.74:27016

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 6 years ago

Hmm, Good one brother. We will miss you in CS 1.6 ☹️.

I posted something similar to that 4 months ago that can block exec command: http://escapers-zone.net/viewtopic.php?p=4199#p4199 Nothing impossible if you think you will do it. Ideas make impossible possible.
He who fails to plan is planning to fail

User avatar
Ethan
Member
Member
Algeria
Posts: 9
Joined: 5 years ago
Location: Algeria
Contact:

#3

Post by Ethan » 5 years ago

Very nice, my friend is a great job but I will miss you brother
Good luck
nice plugin I will keep it and will change its name by your name

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: Bing [Bot] and 0 guests