From c5a201ab8a4501f36f8926f7a0cdcf9375e73ee9 Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 1 Jun 2024 21:35:36 +0200 Subject: [PATCH] outcommented kick and post method. now just logging everything --- read_client_cmds/scripting/cmd_reader.sp | 52 ++++++++++++++---------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/read_client_cmds/scripting/cmd_reader.sp b/read_client_cmds/scripting/cmd_reader.sp index fd865415..645f3833 100644 --- a/read_client_cmds/scripting/cmd_reader.sp +++ b/read_client_cmds/scripting/cmd_reader.sp @@ -41,8 +41,10 @@ public void OnPluginStart() SetFailState("Failed to detour CGameClient::ExecuteStringCommand()"); // And a post hook. + /* if (!DHookEnableDetour(hExecuteStringCommand, true, Detour_OnExecuteStringCommand_Post)) SetFailState("Failed to detour ExecuteStringCommand post."); + */ // Setup quick hack to get the client index of the IClient this pointer in the detour callback. StartPrepSDKCall(SDKCall_Raw); @@ -52,38 +54,46 @@ public void OnPluginStart() delete conf; } - +/* public MRESReturn Detour_OnExecuteStringCommand_Post(Address pThis, Handle hReturn, Handle hParams) { int client = SDKCall(hGetPlayerSlot, pThis) + 1; - char sBuffer[512]; + char sBuffer[2048]; DHookGetParamString(hParams, 1, sBuffer, sizeof(sBuffer)); if((sBuffer[0] == 'r' && sBuffer[1] == 'p' && sBuffer[2] == 't')) + { + if(IsClientInGame(client) && !IsClientSourceTV(client)) { - if(IsClientInGame(client) && !IsClientSourceTV(client)) - { - LogMessage("client: %N wanted command pre: %s", client, sBuffer); - KickClient(client, "DO NOT USE EXPLOITS ON THIS SERVER"); - } + LogMessage("client: %N wanted command pre: %s", client, sBuffer); + KickClient(client, "DO NOT USE EXPLOITS ON THIS SERVER"); } + } } +*/ public MRESReturn ExecuteStringCommand(Address addrThis, Handle hReturn, Handle hParams) { - int client = SDKCall(hGetPlayerSlot, addrThis) + 1; - - char cmd[512]; - DHookGetParamString(hParams, 1, cmd, 512); - // "rpt", "rpt_" - if((cmd[0] == 'r' && cmd[1] == 'p' && cmd[2] == 't')) - { - if(IsClientInGame(client) && !IsClientSourceTV(client)) - { - LogMessage("client: %N wanted command pre: %s", client, cmd); - KickClient(client, "DO NOT USE EXPLOITS ON THIS SERVER"); - } - } - return MRES_Ignored; + int client = SDKCall(hGetPlayerSlot, addrThis) + 1; + + char cmd[512]; + DHookGetParamString(hParams, 1, cmd, 512); + char sSID[64]; + GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID)); + + LogMessage("client: %N. steamid: %s. command: %s", client, sSID, cmd); + /* + // "rpt", "rpt_" + if((cmd[0] == 'r' && cmd[1] == 'p' && cmd[2] == 't')) + { + if(IsClientInGame(client) && !IsClientSourceTV(client)) + { + LogMessage("client: %N wanted command pre: %s", client, cmd); + KickClient(client, "DO NOT USE EXPLOITS ON THIS SERVER"); + } + } + */ + return MRES_Ignored; } +