core/smn_player.cpp
changeset 448 25984ddd0ce0
parent 435 3097c4ab9f8f
child 449 e24772d5d9eb
     1.1 --- a/core/smn_player.cpp	Wed Feb 07 08:42:48 2007 +0000
     1.2 +++ b/core/smn_player.cpp	Wed Feb 07 08:44:48 2007 +0000
     1.3 @@ -18,37 +18,37 @@
     1.4  {
     1.5  	if (params[1])
     1.6  	{
     1.7 -		return g_PlayerManager.NumPlayers();
     1.8 +		return g_Players.NumPlayers();
     1.9  	}
    1.10  
    1.11 -	int maxplayers = g_PlayerManager.MaxClients();
    1.12 +	int maxplayers = g_Players.MaxClients();
    1.13  	int count = 0;
    1.14  	for (int i=1; i<=maxplayers; ++i)
    1.15  	{
    1.16 -		CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(i);
    1.17 +		CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
    1.18  		if ((pPlayer->IsConnected()) && !(pPlayer->IsInGame()))
    1.19  		{
    1.20  			count++;
    1.21  		}
    1.22  	}
    1.23  
    1.24 -	return (g_PlayerManager.NumPlayers() + count);
    1.25 +	return (g_Players.NumPlayers() + count);
    1.26  }
    1.27  
    1.28  static cell_t sm_GetMaxClients(IPluginContext *pCtx, const cell_t *params)
    1.29  {
    1.30 -	return g_PlayerManager.MaxClients();
    1.31 +	return g_Players.MaxClients();
    1.32  }
    1.33  
    1.34  static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
    1.35  {
    1.36  	int index = params[1];
    1.37 -	if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
    1.38 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
    1.39  	{
    1.40  		return pCtx->ThrowNativeError("Invalid client index %d.", index);
    1.41  	}
    1.42  
    1.43 -	CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
    1.44 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
    1.45  	if (!pPlayer->IsConnected())
    1.46  	{
    1.47  		return pCtx->ThrowNativeError("Client %d is not connected.", index);
    1.48 @@ -61,12 +61,12 @@
    1.49  static cell_t sm_GetClientIP(IPluginContext *pCtx, const cell_t *params)
    1.50  {
    1.51  	int index = params[1];
    1.52 -	if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
    1.53 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
    1.54  	{
    1.55  		return pCtx->ThrowNativeError("Invalid client index %d.", index);
    1.56  	}
    1.57  
    1.58 -	CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
    1.59 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
    1.60  	if (!pPlayer->IsConnected())
    1.61  	{
    1.62  		return pCtx->ThrowNativeError("Client %d is not connected.", index);
    1.63 @@ -87,12 +87,12 @@
    1.64  static cell_t sm_GetClientAuthStr(IPluginContext *pCtx, const cell_t *params)
    1.65  {
    1.66  	int index = params[1];
    1.67 -	if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
    1.68 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
    1.69  	{
    1.70  		return pCtx->ThrowNativeError("Invalid client index %d.", index);
    1.71  	}
    1.72  
    1.73 -	CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
    1.74 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
    1.75  	if (!pPlayer->IsConnected())
    1.76  	{
    1.77  		return pCtx->ThrowNativeError("Client %d is not connected.", index);
    1.78 @@ -105,45 +105,45 @@
    1.79  static cell_t sm_IsPlayerConnected(IPluginContext *pCtx, const cell_t *params)
    1.80  {
    1.81  	int index = params[1];
    1.82 -	if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
    1.83 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
    1.84  	{
    1.85  		return pCtx->ThrowNativeError("Invalid client index %d.", index);
    1.86  	}
    1.87  
    1.88 -	return (g_PlayerManager.GetPlayerByIndex(index)->IsConnected()) ? 1 : 0;
    1.89 +	return (g_Players.GetPlayerByIndex(index)->IsConnected()) ? 1 : 0;
    1.90  }
    1.91  
    1.92  static cell_t sm_IsPlayerIngame(IPluginContext *pCtx, const cell_t *params)
    1.93  {
    1.94  	int index = params[1];
    1.95 -	if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
    1.96 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
    1.97  	{
    1.98  		return pCtx->ThrowNativeError("Invalid client index %d.", index);
    1.99  	}
   1.100  
   1.101 -	return (g_PlayerManager.GetPlayerByIndex(index)->IsInGame()) ? 1 : 0;
   1.102 +	return (g_Players.GetPlayerByIndex(index)->IsInGame()) ? 1 : 0;
   1.103  }
   1.104  
   1.105  static cell_t sm_IsPlayerAuthorized(IPluginContext *pCtx, const cell_t *params)
   1.106  {
   1.107  	int index = params[1];
   1.108 -	if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
   1.109 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
   1.110  	{
   1.111  		return pCtx->ThrowNativeError("Invalid client index %d.", index);
   1.112  	}
   1.113  
   1.114 -	return (g_PlayerManager.GetPlayerByIndex(index)->IsAuthorized()) ? 1 : 0;
   1.115 +	return (g_Players.GetPlayerByIndex(index)->IsAuthorized()) ? 1 : 0;
   1.116  }
   1.117  
   1.118  static cell_t sm_IsPlayerFakeClient(IPluginContext *pCtx, const cell_t *params)
   1.119  {
   1.120  	int index = params[1];
   1.121 -	if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
   1.122 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
   1.123  	{
   1.124  		return pCtx->ThrowNativeError("Invalid client index %d.", index);
   1.125  	}
   1.126  
   1.127 -	CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
   1.128 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
   1.129  	if (!pPlayer->IsConnected())
   1.130  	{
   1.131  		return pCtx->ThrowNativeError("Client %d is not connected.", index);
   1.132 @@ -172,12 +172,12 @@
   1.133  static cell_t sm_PrintToConsole(IPluginContext *pCtx, const cell_t *params)
   1.134  {
   1.135  	int index = params[1];
   1.136 -	if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
   1.137 +	if ((index < 1) || (index > g_Players.GetMaxClients()))
   1.138  	{
   1.139  		return pCtx->ThrowNativeError("Invalid client index %d.", index);
   1.140  	}
   1.141  
   1.142 -	CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
   1.143 +	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
   1.144  	if (!pPlayer->IsInGame())
   1.145  	{
   1.146  		return pCtx->ThrowNativeError("Client %d is not in game.", index);