core/smn_console.cpp
changeset 1337 d3be5af73d2d
parent 1330 ab94316bb52b
child 1338 1ba17552b7b1
     1.1 --- a/core/smn_console.cpp	Wed Aug 15 17:17:52 2007 +0000
     1.2 +++ b/core/smn_console.cpp	Wed Aug 15 17:22:21 2007 +0000
     1.3 @@ -789,7 +789,6 @@
     1.4  	return 1;
     1.5  }
     1.6  
     1.7 -
     1.8  static cell_t FakeClientCommand(IPluginContext *pContext, const cell_t *params)
     1.9  {
    1.10  	CPlayer *pPlayer = g_Players.GetPlayerByIndex(params[1]);
    1.11 @@ -812,9 +811,34 @@
    1.12  		return 0;
    1.13  	}
    1.14  
    1.15 -	unsigned int old = g_ChatTriggers.SetReplyTo(SM_REPLY_CONSOLE);
    1.16  	serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
    1.17 -	g_ChatTriggers.SetReplyTo(old);
    1.18 +
    1.19 +	return 1;
    1.20 +}
    1.21 +
    1.22 +static cell_t FakeClientCommandEx(IPluginContext *pContext, const cell_t *params)
    1.23 +{
    1.24 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(params[1]);
    1.25 +
    1.26 +	if (!pPlayer)
    1.27 +	{
    1.28 +		return pContext->ThrowNativeError("Client index %d is invalid", params[1]);
    1.29 +	}
    1.30 +
    1.31 +	if (!pPlayer->IsConnected())
    1.32 +	{
    1.33 +		return pContext->ThrowNativeError("Client %d is not connected", params[1]);
    1.34 +	}
    1.35 +
    1.36 +	char buffer[256];
    1.37 +	g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
    1.38 +
    1.39 +	if (pContext->GetContext()->n_err != SP_ERROR_NONE)
    1.40 +	{
    1.41 +		return 0;
    1.42 +	}
    1.43 +
    1.44 +	serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
    1.45  
    1.46  	return 1;
    1.47  }