Raised This Month: $51 Target: $400
 12% 

Solved chat record


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
phoenix0001
Senior Member
Join Date: Apr 2010
Location: China
Old 01-29-2021 , 13:09   chat record
Reply With Quote #1

Any commands entered by the player [! Admin,/admin] etc..

The server can record and save to a text [like the record in the logo, one text per day, addons\ sourceMods \logs]

Also record the player's Steamid steam_0:0:12 3456789

I want to see what commands the player has typed


Such as:

PHP Code:
01/30/2021-00:37:06: [steam_0:0:123456789command /admin

01
/30/2021-00:38:06: [steam_0:0:123344556command !admin

01
/30/2021-00:39:06: [steam_0:0:0011223command /VIP 


Since some players have been messing up the server recently, I want to find out who is doing it.
__________________
I like this BBS sharing of spirit

I come from China, my English is poor

Last edited by phoenix0001; 01-30-2021 at 12:26.
phoenix0001 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-30-2021 , 11:11   Re: [NMRIH]chat record
Reply With Quote #2

- This log all commands what AddCommandListener can recognize.
- New log file is created every time when plugin loaded.

PHP Code:
char path[PLATFORM_MAX_PATH];

public 
void OnPluginStart()
{
    
// Set plugin in Fail state if this feature is missing.
    
RequireFeature(FeatureType_CapabilityFEATURECAP_COMMANDLISTENER,
                   
"Unfortunately 'AddCommandListener' is not supported in this game or SourceMod version.");
 
    
// Listen all commands
    
AddCommandListener(cmdlistener"");
    
    
FormatTime(pathsizeof(path), "%Y-%m-%d %H%M");
    
BuildPath(Path_SMpathsizeof(path), "logs/CMD_%s.txt"path);
}

public 
Action cmdlistener(int client, const char[] commandint argc)
{
    
char sarg[255];
    
GetCmdArgString(sargsizeof(sarg));

    
char buffer[40];


    
// client indexes
    
if(client && client <= MaxClients && IsClientConnected(client))
    {
        
int userid GetClientUserId(client);
        
GetClientAuthId(clientAuthId_Enginebuffersizeof(buffer));
        
Format(buffersizeof(buffer), "#%-5i %s"useridbuffer);
    }
    

    
LogToFileEx(path"%25s - %s '%s'"buffercommandsarg);
    
    
    return 
Plugin_Continue;

output

Code:
L 01/30/2021 - 18:00:01:                           - exec 'skill1.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'server.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'sourcemod/sourcemod.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'sourcemod\basevotes.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'sourcemod\funcommands.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'sourcemod\funvotes.cfg'
L 01/30/2021 - 18:00:01:                           - sm_internal '1'
L 01/30/2021 - 18:00:25: #4     [U:1:28327177]     - vmodenable '1'
L 01/30/2021 - 18:00:25: #4     [U:1:28327177]     - vban '0 0 0'
L 01/30/2021 - 18:00:26: #4     [U:1:28327177]     - joingame ''
L 01/30/2021 - 18:00:26: #4     [U:1:28327177]     - jointeam '0'
L 01/30/2021 - 18:00:27: #4     [U:1:28327177]     - joinclass '0'
L 01/30/2021 - 18:00:53: #4     [U:1:28327177]     - drop ''
L 01/30/2021 - 18:01:04: #4     [U:1:28327177]     - drop ''
L 01/30/2021 - 18:01:30: #4     [U:1:28327177]     - fallback ''
L 01/30/2021 - 18:01:33: #4     [U:1:28327177]     - roger ''
L 01/30/2021 - 18:01:35: #4     [U:1:28327177]     - coverme ''
L 01/30/2021 - 18:04:05: #7     [U:1:28327177]     - vmodenable '1'
L 01/30/2021 - 18:04:06: #7     [U:1:28327177]     - joingame ''
L 01/30/2021 - 18:04:06: #7     [U:1:28327177]     - jointeam '0'
L 01/30/2021 - 18:04:07: #7     [U:1:28327177]     - joinclass '0'
L 01/30/2021 - 18:04:15: #7     [U:1:28327177]     - say '"/admin"'
L 01/30/2021 - 18:04:15: #7     [U:1:28327177]     - sm_admin ''
L 01/30/2021 - 18:04:19: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:20: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:21: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:22: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:23: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:32: #7     [U:1:28327177]     - say '"!admin"'
L 01/30/2021 - 18:04:32: #7     [U:1:28327177]     - sm_admin ''
L 01/30/2021 - 18:05:18: #7     [U:1:28327177]     - timeleft ''

If you want only chat commands, change code
Code:
this AddCommandListener(cmdlistener, "");
to

AddCommandListener(cmdlistener, "say");
AddCommandListener(cmdlistener, "say_team");
I don't know exactly, what are chat commands in NMRIH
__________________
Do not Private Message @me
Bacardi is offline
phoenix0001
Senior Member
Join Date: Apr 2010
Location: China
Old 01-30-2021 , 12:04   Re: [NMRIH]chat record
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
- This log all commands what AddCommandListener can recognize.
- New log file is created every time when plugin loaded.

PHP Code:
char path[PLATFORM_MAX_PATH];

public 
void OnPluginStart()
{
    
// Set plugin in Fail state if this feature is missing.
    
RequireFeature(FeatureType_CapabilityFEATURECAP_COMMANDLISTENER,
                   
"Unfortunately 'AddCommandListener' is not supported in this game or SourceMod version.");
 
    
// Listen all commands
    
AddCommandListener(cmdlistener"");
    
    
FormatTime(pathsizeof(path), "%Y-%m-%d %H%M");
    
BuildPath(Path_SMpathsizeof(path), "logs/CMD_%s.txt"path);
}

public 
Action cmdlistener(int client, const char[] commandint argc)
{
    
char sarg[255];
    
GetCmdArgString(sargsizeof(sarg));

    
char buffer[40];


    
// client indexes
    
if(client && client <= MaxClients && IsClientConnected(client))
    {
        
int userid GetClientUserId(client);
        
GetClientAuthId(clientAuthId_Enginebuffersizeof(buffer));
        
Format(buffersizeof(buffer), "#%-5i %s"useridbuffer);
    }
    

    
LogToFileEx(path"%25s - %s '%s'"buffercommandsarg);
    
    
    return 
Plugin_Continue;

output

Code:
L 01/30/2021 - 18:00:01:                           - exec 'skill1.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'server.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'sourcemod/sourcemod.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'sourcemod\basevotes.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'sourcemod\funcommands.cfg'
L 01/30/2021 - 18:00:01:                           - exec 'sourcemod\funvotes.cfg'
L 01/30/2021 - 18:00:01:                           - sm_internal '1'
L 01/30/2021 - 18:00:25: #4     [U:1:28327177]     - vmodenable '1'
L 01/30/2021 - 18:00:25: #4     [U:1:28327177]     - vban '0 0 0'
L 01/30/2021 - 18:00:26: #4     [U:1:28327177]     - joingame ''
L 01/30/2021 - 18:00:26: #4     [U:1:28327177]     - jointeam '0'
L 01/30/2021 - 18:00:27: #4     [U:1:28327177]     - joinclass '0'
L 01/30/2021 - 18:00:53: #4     [U:1:28327177]     - drop ''
L 01/30/2021 - 18:01:04: #4     [U:1:28327177]     - drop ''
L 01/30/2021 - 18:01:30: #4     [U:1:28327177]     - fallback ''
L 01/30/2021 - 18:01:33: #4     [U:1:28327177]     - roger ''
L 01/30/2021 - 18:01:35: #4     [U:1:28327177]     - coverme ''
L 01/30/2021 - 18:04:05: #7     [U:1:28327177]     - vmodenable '1'
L 01/30/2021 - 18:04:06: #7     [U:1:28327177]     - joingame ''
L 01/30/2021 - 18:04:06: #7     [U:1:28327177]     - jointeam '0'
L 01/30/2021 - 18:04:07: #7     [U:1:28327177]     - joinclass '0'
L 01/30/2021 - 18:04:15: #7     [U:1:28327177]     - say '"/admin"'
L 01/30/2021 - 18:04:15: #7     [U:1:28327177]     - sm_admin ''
L 01/30/2021 - 18:04:19: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:20: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:21: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:22: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:23: #7     [U:1:28327177]     - menuselect '1'
L 01/30/2021 - 18:04:32: #7     [U:1:28327177]     - say '"!admin"'
L 01/30/2021 - 18:04:32: #7     [U:1:28327177]     - sm_admin ''
L 01/30/2021 - 18:05:18: #7     [U:1:28327177]     - timeleft ''

If you want only chat commands, change code
Code:
this AddCommandListener(cmdlistener, "");
to

AddCommandListener(cmdlistener, "say");
AddCommandListener(cmdlistener, "say_team");
I don't know exactly, what are chat commands in NMRIH
I'm very much obliged to you
This is exactly what i want
__________________
I like this BBS sharing of spirit

I come from China, my English is poor

Last edited by phoenix0001; 01-30-2021 at 12:11.
phoenix0001 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:31.


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