General Player Commands Logs (previously said to be impossible)

Gameplay Addons
Post Reply
User avatar
Posts: 33
Joined: 3 Years Ago
Location: Temara/Rabat
Has thanked: 1 time
Been thanked: 2 times
Age: 20

Player Commands Logs (previously said to be impossible)


Post by TheWhitesmith » 3 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[][] =  
new const g_CheatCommands[][] = {
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)
    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)
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 )
[SYA] CSGO-Mod for CS 1.6 [ Cases/Keys/Rank ]

User avatar
Mod Developer
Mod Developer
Posts: 2158
Joined: 4 Years Ago
Has thanked: 48 times
Been thanked: 144 times
Age: 23


Post by Raheem » 3 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: 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
Posts: 9
Joined: 2 Years Ago
Location: Algeria
Has thanked: 1 time
Been thanked: 0
Age: 19


Post by Ethan » 2 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

Who is online

Users browsing this forum: No registered users and 1 guest