core/ConCmdManager.cpp
changeset 856 f6d633d0f77f
parent 848 32c29dd9c7ec
child 893 a3bc816549a8
     1.1 --- a/core/ConCmdManager.cpp	Thu May 24 04:37:20 2007 +0000
     1.2 +++ b/core/ConCmdManager.cpp	Mon May 28 07:25:12 2007 +0000
     1.3 @@ -330,7 +330,17 @@
     1.4  				}
     1.5  				continue;
     1.6  			}
     1.7 -			pHook->pf->PushCell(m_CmdClient);
     1.8 +
     1.9 +			/* On a listen server, sometimes the server host's client index can be set as 0.
    1.10 +			 * So index 1 is passed to the command callback to correct this potential problem.
    1.11 +			 */
    1.12 +			if (m_CmdClient == 0 && !engine->IsDedicatedServer())
    1.13 +			{
    1.14 +				pHook->pf->PushCell(1);
    1.15 +			} else {
    1.16 +				pHook->pf->PushCell(m_CmdClient);
    1.17 +			}
    1.18 +
    1.19  			pHook->pf->PushCell(args);
    1.20  			if (pHook->pf->Execute(&tempres) == SP_ERROR_NONE)
    1.21  			{
    1.22 @@ -364,6 +374,12 @@
    1.23  		return true;
    1.24  	}
    1.25  
    1.26 +	/* If running listen server, then client 1 is the server host and should have 'root' access */
    1.27 +	if (client == 1 && !engine->IsDedicatedServer())
    1.28 +	{
    1.29 +		return true;
    1.30 +	}
    1.31 +
    1.32  	CPlayer *player = g_Players.GetPlayerByIndex(client);
    1.33  	if (!player)
    1.34  	{