 |
|
Senior Member
Join Date: Apr 2010
Location: China
|

01-30-2021
, 12:04
Re: [NMRIH]chat record
|
#3
|
Quote:
Originally Posted by Bacardi
- 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_Capability, FEATURECAP_COMMANDLISTENER, "Unfortunately 'AddCommandListener' is not supported in this game or SourceMod version."); // Listen all commands AddCommandListener(cmdlistener, ""); FormatTime(path, sizeof(path), "%Y-%m-%d %H%M"); BuildPath(Path_SM, path, sizeof(path), "logs/CMD_%s.txt", path); }
public Action cmdlistener(int client, const char[] command, int argc) { char sarg[255]; GetCmdArgString(sarg, sizeof(sarg));
char buffer[40];
// client indexes if(client > 0 && client <= MaxClients && IsClientConnected(client)) { int userid = GetClientUserId(client); GetClientAuthId(client, AuthId_Engine, buffer, sizeof(buffer)); Format(buffer, sizeof(buffer), "#%-5i %s", userid, buffer); }
LogToFileEx(path, "%25s - %s '%s'", buffer, command, sarg); 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.
|
|
|
|