core/smn_player.cpp
changeset 924 330f478a2d1d
parent 923 346e4c60fc32
child 992 77133031b0d2
     1.1 --- a/core/smn_player.cpp	Fri Jun 08 01:58:26 2007 +0000
     1.2 +++ b/core/smn_player.cpp	Fri Jun 08 03:38:57 2007 +0000
     1.3 @@ -18,6 +18,7 @@
     1.4  #include "HalfLife2.h"
     1.5  #include "sourcemod.h"
     1.6  #include <inetchannelinfo.h>
     1.7 +#include "ChatTriggers.h"
     1.8  
     1.9  ConVar sm_show_activity("sm_show_activity", "13", FCVAR_SPONLY|FCVAR_PROTECTED, "Activity display setting (see sourcemod.cfg)");
    1.10  
    1.11 @@ -822,17 +823,15 @@
    1.12  
    1.13  static cell_t ShowActivity(IPluginContext *pContext, const cell_t *params)
    1.14  {
    1.15 +	char message[255];
    1.16 +	char buffer[255];
    1.17  	int value = sm_show_activity.GetInt();
    1.18 -
    1.19 -	if (!value)
    1.20 -	{
    1.21 -		return 0;
    1.22 -	}
    1.23 -
    1.24 +	unsigned int replyto = g_ChatTriggers.GetReplyTo();
    1.25  	int client = params[1];
    1.26  
    1.27  	const char *name = "Console";
    1.28  	const char *sign = "ADMIN";
    1.29 +	bool display_in_chat = false;
    1.30  	if (client != 0)
    1.31  	{
    1.32  		CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
    1.33 @@ -847,15 +846,35 @@
    1.34  		{
    1.35  			sign = "PLAYER";
    1.36  		}
    1.37 +
    1.38 +		/* Display the message to the client? */
    1.39 +		if (replyto == SM_REPLY_CONSOLE)
    1.40 +		{
    1.41 +			g_SourceMod.SetGlobalTarget(client);
    1.42 +			g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
    1.43 +			UTIL_Format(message, sizeof(message), "[SM] %s\n", buffer);
    1.44 +			engine->ClientPrintf(pPlayer->GetEdict(), message);
    1.45 +			display_in_chat = true;
    1.46 +		}
    1.47 +	} else {
    1.48 +		g_SourceMod.SetGlobalTarget(LANG_SERVER);
    1.49 +		g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
    1.50 +		UTIL_Format(message, sizeof(message), "[SM] %s\n", buffer);
    1.51 +		META_CONPRINT(message);
    1.52  	}
    1.53  
    1.54 -	char message[255];
    1.55 -	char buffer[255];
    1.56 +	if (!value)
    1.57 +	{
    1.58 +		return 1;
    1.59 +	}
    1.60 +
    1.61  	int maxClients = g_Players.GetMaxClients();
    1.62  	for (int i=1; i<=maxClients; i++)
    1.63  	{
    1.64  		CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
    1.65 -		if (!pPlayer->IsInGame() || pPlayer->IsFakeClient())
    1.66 +		if (!pPlayer->IsInGame() 
    1.67 +			|| pPlayer->IsFakeClient()
    1.68 +			|| (display_in_chat && i == client))
    1.69  		{
    1.70  			continue;
    1.71  		}