No longer require clients to be ingame for INetChannelInfo natives (bug 5775, r=psychonic).
authorSystematicMania <systematicmania@gmail.com>
Thu Mar 27 22:52:16 2014 -0400 (2014-03-27)
changeset 4300cc206102001c
parent 4299 e8c324cbf8e6
child 4301 5a9c242fa868
No longer require clients to be ingame for INetChannelInfo natives (bug 5775, r=psychonic).
core/smn_player.cpp
plugins/include/clients.inc
     1.1 --- a/core/smn_player.cpp	Thu Mar 27 22:23:22 2014 -0400
     1.2 +++ b/core/smn_player.cpp	Thu Mar 27 22:52:16 2014 -0400
     1.3 @@ -788,9 +788,13 @@
     1.4  	if (!pPlayer)
     1.5  	{
     1.6  		return pContext->ThrowNativeError("Client index %d is invalid", client);
     1.7 -	} else if (!pPlayer->IsInGame()) {
     1.8 -		return pContext->ThrowNativeError("Client %d is not in game", client);
     1.9 -	} else if (pPlayer->IsFakeClient()) {
    1.10 +	}
    1.11 +	else if (!pPlayer->IsConnected())
    1.12 +	{
    1.13 +		return pContext->ThrowNativeError("Client %d is not connected", client);
    1.14 +	}
    1.15 +	else if (pPlayer->IsFakeClient())
    1.16 +	{
    1.17  		return pContext->ThrowNativeError("Client %d is a bot", client);
    1.18  	}
    1.19  
    1.20 @@ -811,9 +815,13 @@
    1.21  	if (!pPlayer)
    1.22  	{
    1.23  		return pContext->ThrowNativeError("Client index %d is invalid", client);
    1.24 -	} else if (!pPlayer->IsInGame()) {
    1.25 -		return pContext->ThrowNativeError("Client %d is not in game", client);
    1.26 -	} else if (pPlayer->IsFakeClient()) {
    1.27 +	}
    1.28 +	else if (!pPlayer->IsConnected())
    1.29 +	{
    1.30 +		return pContext->ThrowNativeError("Client %d is not connected", client);
    1.31 +	}
    1.32 +	else if (pPlayer->IsFakeClient())
    1.33 +	{
    1.34  		return pContext->ThrowNativeError("Client %d is a bot", client);
    1.35  	}
    1.36  
    1.37 @@ -834,9 +842,13 @@
    1.38  	if (!pPlayer)
    1.39  	{
    1.40  		return pContext->ThrowNativeError("Client index %d is invalid", client);
    1.41 -	} else if (!pPlayer->IsInGame()) {
    1.42 -		return pContext->ThrowNativeError("Client %d is not in game", client);
    1.43 -	} else if (pPlayer->IsFakeClient()) {
    1.44 +	}
    1.45 +	else if (!pPlayer->IsConnected())
    1.46 +	{
    1.47 +		return pContext->ThrowNativeError("Client %d is not connected", client);
    1.48 +	}
    1.49 +	else if (pPlayer->IsFakeClient())
    1.50 +	{
    1.51  		return pContext->ThrowNativeError("Client %d is a bot", client);
    1.52  	}
    1.53  
    1.54 @@ -859,9 +871,9 @@
    1.55  	{
    1.56  		return pContext->ThrowNativeError("Client index %d is invalid", client);
    1.57  	}
    1.58 -	else if (!pPlayer->IsInGame())
    1.59 +	else if (!pPlayer->IsConnected())
    1.60  	{
    1.61 -		return pContext->ThrowNativeError("Client %d is not in game", client);
    1.62 +		return pContext->ThrowNativeError("Client %d is not connected", client);
    1.63  	}
    1.64  	else if (pPlayer->IsFakeClient())
    1.65  	{
    1.66 @@ -896,9 +908,9 @@
    1.67  	{
    1.68  		return pContext->ThrowNativeError("Client index %d is invalid", client);
    1.69  	}
    1.70 -	else if (!pPlayer->IsInGame())
    1.71 +	else if (!pPlayer->IsConnected())
    1.72  	{
    1.73 -		return pContext->ThrowNativeError("Client %d is not in game", client);
    1.74 +		return pContext->ThrowNativeError("Client %d is not connected", client);
    1.75  	}
    1.76  	else if (pPlayer->IsFakeClient())
    1.77  	{
    1.78 @@ -933,9 +945,9 @@
    1.79  	{
    1.80  		return pContext->ThrowNativeError("Client index %d is invalid", client);
    1.81  	}
    1.82 -	else if (!pPlayer->IsInGame())
    1.83 +	else if (!pPlayer->IsConnected())
    1.84  	{
    1.85 -		return pContext->ThrowNativeError("Client %d is not in game", client);
    1.86 +		return pContext->ThrowNativeError("Client %d is not connected", client);
    1.87  	}
    1.88  	else if (pPlayer->IsFakeClient())
    1.89  	{
    1.90 @@ -970,9 +982,9 @@
    1.91  	{
    1.92  		return pContext->ThrowNativeError("Client index %d is invalid", client);
    1.93  	}
    1.94 -	else if (!pPlayer->IsInGame())
    1.95 +	else if (!pPlayer->IsConnected())
    1.96  	{
    1.97 -		return pContext->ThrowNativeError("Client %d is not in game", client);
    1.98 +		return pContext->ThrowNativeError("Client %d is not connected", client);
    1.99  	}
   1.100  	else if (pPlayer->IsFakeClient())
   1.101  	{
   1.102 @@ -1007,9 +1019,9 @@
   1.103  	{
   1.104  		return pContext->ThrowNativeError("Client index %d is invalid", client);
   1.105  	}
   1.106 -	else if (!pPlayer->IsInGame())
   1.107 +	else if (!pPlayer->IsConnected())
   1.108  	{
   1.109 -		return pContext->ThrowNativeError("Client %d is not in game", client);
   1.110 +		return pContext->ThrowNativeError("Client %d is not connected", client);
   1.111  	}
   1.112  	else if (pPlayer->IsFakeClient())
   1.113  	{
   1.114 @@ -1044,9 +1056,9 @@
   1.115  	{
   1.116  		return pContext->ThrowNativeError("Client index %d is invalid", client);
   1.117  	}
   1.118 -	else if (!pPlayer->IsInGame())
   1.119 +	else if (!pPlayer->IsConnected())
   1.120  	{
   1.121 -		return pContext->ThrowNativeError("Client %d is not in game", client);
   1.122 +		return pContext->ThrowNativeError("Client %d is not connected", client);
   1.123  	}
   1.124  	else if (pPlayer->IsFakeClient())
   1.125  	{
   1.126 @@ -1054,7 +1066,6 @@
   1.127  	}
   1.128  
   1.129  	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
   1.130 -
   1.131  	if (pInfo == NULL)
   1.132  	{
   1.133  		return 0;
     2.1 --- a/plugins/include/clients.inc	Thu Mar 27 22:23:22 2014 -0400
     2.2 +++ b/plugins/include/clients.inc	Thu Mar 27 22:52:16 2014 -0400
     2.3 @@ -620,7 +620,7 @@
     2.4   *
     2.5   * @param client		Player's index.
     2.6   * @return				Data rate.
     2.7 - * @error				Invalid client index, client not in game, or fake client.
     2.8 + * @error				Invalid client index, client not connected, or fake client.
     2.9   */
    2.10  native GetClientDataRate(client);
    2.11  
    2.12 @@ -629,7 +629,7 @@
    2.13   *
    2.14   * @param client		Player's index.
    2.15   * @return				True if client is timing out, false otherwise.
    2.16 - * @error				Invalid client index, client not in game, or fake client.
    2.17 + * @error				Invalid client index, client not connected, or fake client.
    2.18   */
    2.19  native bool:IsClientTimingOut(client);
    2.20  
    2.21 @@ -638,7 +638,7 @@
    2.22   *
    2.23   * @param client		Player's index.
    2.24   * @return				Connection time.
    2.25 - * @error				Invalid client index, client not in game, or fake client.
    2.26 + * @error				Invalid client index, client not connected, or fake client.
    2.27   */
    2.28  native Float:GetClientTime(client);
    2.29  
    2.30 @@ -648,7 +648,7 @@
    2.31   * @param client		Player's index.
    2.32   * @param flow			Traffic flowing direction.
    2.33   * @return				Latency, or -1 if network info is not available.
    2.34 - * @error				Invalid client index, client not in game, or fake client.
    2.35 + * @error				Invalid client index, client not connected, or fake client.
    2.36   */
    2.37  native Float:GetClientLatency(client, NetFlow:flow);
    2.38  
    2.39 @@ -658,7 +658,7 @@
    2.40   * @param client		Player's index.
    2.41   * @param flow			Traffic flowing direction.
    2.42   * @return				Latency, or -1 if network info is not available.
    2.43 - * @error				Invalid client index, client not in game, or fake client.
    2.44 + * @error				Invalid client index, client not connected, or fake client.
    2.45   */
    2.46  native Float:GetClientAvgLatency(client, NetFlow:flow);
    2.47  
    2.48 @@ -668,7 +668,7 @@
    2.49   * @param client		Player's index.
    2.50   * @param flow			Traffic flowing direction.
    2.51   * @return				Average packet loss, or -1 if network info is not available.
    2.52 - * @error				Invalid client index, client not in game, or fake client.
    2.53 + * @error				Invalid client index, client not connected, or fake client.
    2.54   */
    2.55  native Float:GetClientAvgLoss(client, NetFlow:flow);
    2.56  
    2.57 @@ -678,7 +678,7 @@
    2.58   * @param client		Player's index.
    2.59   * @param flow			Traffic flowing direction.
    2.60   * @return				Average packet loss, or -1 if network info is not available.
    2.61 - * @error				Invalid client index, client not in game, or fake client.
    2.62 + * @error				Invalid client index, client not connected, or fake client.
    2.63   */
    2.64  native Float:GetClientAvgChoke(client, NetFlow:flow);
    2.65  
    2.66 @@ -688,7 +688,7 @@
    2.67   * @param client		Player's index.
    2.68   * @param flow			Traffic flowing direction.
    2.69   * @return				Data flow.
    2.70 - * @error				Invalid client index, client not in game, or fake client.
    2.71 + * @error				Invalid client index, client not connected, or fake client.
    2.72   */
    2.73  native Float:GetClientAvgData(client, NetFlow:flow);
    2.74  
    2.75 @@ -698,7 +698,7 @@
    2.76   * @param client		Player's index.
    2.77   * @param flow			Traffic flowing direction.
    2.78   * @return				Packet frequency.
    2.79 - * @error				Invalid client index, client not in game, or fake client.
    2.80 + * @error				Invalid client index, client not connected, or fake client.
    2.81   */
    2.82  native Float:GetClientAvgPackets(client, NetFlow:flow);
    2.83