1.1 --- a/core/ConCmdManager.cpp Fri Aug 24 23:56:57 2007 +0000
1.2 +++ b/core/ConCmdManager.cpp Sun Aug 26 17:41:02 2007 +0000
1.3 @@ -203,6 +203,17 @@
1.4
1.5 void ConCmdManager::InternalDispatch()
1.6 {
1.7 + int client = m_CmdClient;
1.8 +
1.9 + if (client)
1.10 + {
1.11 + CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
1.12 + if (!pPlayer || !pPlayer->IsConnected())
1.13 + {
1.14 + return;
1.15 + }
1.16 + }
1.17 +
1.18 /**
1.19 * Note: Console commands will EITHER go through IServerGameDLL::ClientCommand,
1.20 * OR this dispatch. They will NEVER go through both.
1.21 @@ -225,7 +236,7 @@
1.22 CmdHook *pHook;
1.23
1.24 /* Execute server-only commands if viable */
1.25 - if (m_CmdClient == 0 && pInfo->srvhooks.size())
1.26 + if (client == 0 && pInfo->srvhooks.size())
1.27 {
1.28 cell_t tempres = result;
1.29 for (iter=pInfo->srvhooks.begin();
1.30 @@ -275,9 +286,9 @@
1.31 {
1.32 continue;
1.33 }
1.34 - if (m_CmdClient
1.35 + if (client
1.36 && pHook->pAdmin
1.37 - && !CheckAccess(m_CmdClient, cmd, pHook->pAdmin))
1.38 + && !CheckAccess(client, cmd, pHook->pAdmin))
1.39 {
1.40 if (result < Pl_Handled)
1.41 {
1.42 @@ -289,11 +300,11 @@
1.43 /* On a listen server, sometimes the server host's client index can be set as 0.
1.44 * So index 1 is passed to the command callback to correct this potential problem.
1.45 */
1.46 - if (m_CmdClient == 0 && !engine->IsDedicatedServer())
1.47 + if (client == 0 && !engine->IsDedicatedServer())
1.48 {
1.49 pHook->pf->PushCell(1);
1.50 } else {
1.51 - pHook->pf->PushCell(m_CmdClient);
1.52 + pHook->pf->PushCell(client);
1.53 }
1.54
1.55 pHook->pf->PushCell(args);