Raised This Month: $ Target: $400
 0% 

Solved chat record


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 03:28.


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