Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement