From 359146f60bb5b6885b03cc320653ac2ceb5a7cb8 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 26 Oct 2009 23:51:39 -0700 Subject: [PATCH] Don't pass unconnected clients into OnClientCommand (bug 3732, r=fyren). --- core/PlayerManager.cpp | 9 ++++++--- plugins/include/clients.inc | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 2d3f9746..c98da63d 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -741,9 +741,12 @@ void PlayerManager::OnClientCommand(edict_t *pEntity) } cell_t res2 = Pl_Continue; - m_clcommand->PushCell(client); - m_clcommand->PushCell(argcount); - m_clcommand->Execute(&res2, NULL); + if (pPlayer->IsInGame()) + { + m_clcommand->PushCell(client); + m_clcommand->PushCell(argcount); + m_clcommand->Execute(&res2, NULL); + } if (res2 > res) { diff --git a/plugins/include/clients.inc b/plugins/include/clients.inc index 75387f3d..7046951b 100644 --- a/plugins/include/clients.inc +++ b/plugins/include/clients.inc @@ -117,6 +117,9 @@ forward OnClientDisconnect_Post(client); /** * Called when a client is sending a command. * + * As of SourceMod 1.3, the client is guaranteed to be in-game. + * Use command listeners (console.inc) for more advanced hooks. + * * @param client Client index. * @param args Number of arguments. * @noreturn