1.1 --- a/core/smn_halflife.cpp Wed Mar 28 23:35:12 2007 +0000
1.2 +++ b/core/smn_halflife.cpp Thu Mar 29 19:48:54 2007 +0000
1.3 @@ -207,6 +207,28 @@
1.4 return enginesound->IsSoundPrecached(sample) ? 1 : 0;
1.5 }
1.6
1.7 +static cell_t FakeClientCommand(IPluginContext *pContext, const cell_t *params)
1.8 +{
1.9 + CPlayer *pPlayer = g_Players.GetPlayerByIndex(params[1]);
1.10 +
1.11 + if (!pPlayer)
1.12 + {
1.13 + return pContext->ThrowNativeError("Player %d is not a valid player", params[1]);
1.14 + }
1.15 +
1.16 + if (!pPlayer->IsConnected())
1.17 + {
1.18 + return pContext->ThrowNativeError("Player %d is not connected", params[1]);
1.19 + }
1.20 +
1.21 + char buffer[256];
1.22 + g_SourceMod.FormatString(buffer, sizeof(buffer)-1, pContext, params, 2);
1.23 +
1.24 + serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), buffer);
1.25 +
1.26 + return 1;
1.27 +}
1.28 +
1.29 REGISTER_NATIVES(halflifeNatives)
1.30 {
1.31 {"CreateFakeClient", CreateFakeClient},
1.32 @@ -229,5 +251,6 @@
1.33 {"IsGenericPrecached", IsGenericPrecached},
1.34 {"PrecacheSound", PrecacheSound},
1.35 {"IsSoundPrecached", IsSoundPrecached},
1.36 + {"FakeClientCommand", FakeClientCommand},
1.37 {NULL, NULL},
1.38 };