No longer require clients to be ingame for INetChannelInfo natives (bug 5775, r=psychonic).

This commit is contained in:
SystematicMania 2014-03-27 22:52:16 -04:00
parent 95a56972a1
commit 010220ea25
2 changed files with 42 additions and 31 deletions

View File

@ -788,9 +788,13 @@ static cell_t GetTimeConnected(IPluginContext *pContext, const cell_t *params)
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
} else if (!pPlayer->IsInGame()) {
return pContext->ThrowNativeError("Client %d is not in game", client);
} else if (pPlayer->IsFakeClient()) {
}
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not connected", client);
}
else if (pPlayer->IsFakeClient())
{
return pContext->ThrowNativeError("Client %d is a bot", client);
}
@ -811,9 +815,13 @@ static cell_t GetDataRate(IPluginContext *pContext, const cell_t *params)
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
} else if (!pPlayer->IsInGame()) {
return pContext->ThrowNativeError("Client %d is not in game", client);
} else if (pPlayer->IsFakeClient()) {
}
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not connected", client);
}
else if (pPlayer->IsFakeClient())
{
return pContext->ThrowNativeError("Client %d is a bot", client);
}
@ -834,9 +842,13 @@ static cell_t IsTimingOut(IPluginContext *pContext, const cell_t *params)
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
} else if (!pPlayer->IsInGame()) {
return pContext->ThrowNativeError("Client %d is not in game", client);
} else if (pPlayer->IsFakeClient()) {
}
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not connected", client);
}
else if (pPlayer->IsFakeClient())
{
return pContext->ThrowNativeError("Client %d is a bot", client);
}
@ -859,9 +871,9 @@ static cell_t GetLatency(IPluginContext *pContext, const cell_t *params)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
else if (!pPlayer->IsInGame())
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not in game", client);
return pContext->ThrowNativeError("Client %d is not connected", client);
}
else if (pPlayer->IsFakeClient())
{
@ -896,9 +908,9 @@ static cell_t GetAvgLatency(IPluginContext *pContext, const cell_t *params)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
else if (!pPlayer->IsInGame())
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not in game", client);
return pContext->ThrowNativeError("Client %d is not connected", client);
}
else if (pPlayer->IsFakeClient())
{
@ -933,9 +945,9 @@ static cell_t GetAvgLoss(IPluginContext *pContext, const cell_t *params)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
else if (!pPlayer->IsInGame())
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not in game", client);
return pContext->ThrowNativeError("Client %d is not connected", client);
}
else if (pPlayer->IsFakeClient())
{
@ -970,9 +982,9 @@ static cell_t GetAvgChoke(IPluginContext *pContext, const cell_t *params)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
else if (!pPlayer->IsInGame())
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not in game", client);
return pContext->ThrowNativeError("Client %d is not connected", client);
}
else if (pPlayer->IsFakeClient())
{
@ -1007,9 +1019,9 @@ static cell_t GetAvgData(IPluginContext *pContext, const cell_t *params)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
else if (!pPlayer->IsInGame())
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not in game", client);
return pContext->ThrowNativeError("Client %d is not connected", client);
}
else if (pPlayer->IsFakeClient())
{
@ -1044,9 +1056,9 @@ static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
else if (!pPlayer->IsInGame())
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not in game", client);
return pContext->ThrowNativeError("Client %d is not connected", client);
}
else if (pPlayer->IsFakeClient())
{
@ -1054,7 +1066,6 @@ static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
}
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
if (pInfo == NULL)
{
return 0;

View File

@ -620,7 +620,7 @@ native GetClientFrags(client);
*
* @param client Player's index.
* @return Data rate.
* @error Invalid client index, client not in game, or fake client.
* @error Invalid client index, client not connected, or fake client.
*/
native GetClientDataRate(client);
@ -629,7 +629,7 @@ native GetClientDataRate(client);
*
* @param client Player's index.
* @return True if client is timing out, false otherwise.
* @error Invalid client index, client not in game, or fake client.
* @error Invalid client index, client not connected, or fake client.
*/
native bool:IsClientTimingOut(client);
@ -638,7 +638,7 @@ native bool:IsClientTimingOut(client);
*
* @param client Player's index.
* @return Connection time.
* @error Invalid client index, client not in game, or fake client.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientTime(client);
@ -648,7 +648,7 @@ native Float:GetClientTime(client);
* @param client Player's index.
* @param flow Traffic flowing direction.
* @return Latency, or -1 if network info is not available.
* @error Invalid client index, client not in game, or fake client.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientLatency(client, NetFlow:flow);
@ -658,7 +658,7 @@ native Float:GetClientLatency(client, NetFlow:flow);
* @param client Player's index.
* @param flow Traffic flowing direction.
* @return Latency, or -1 if network info is not available.
* @error Invalid client index, client not in game, or fake client.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgLatency(client, NetFlow:flow);
@ -668,7 +668,7 @@ native Float:GetClientAvgLatency(client, NetFlow:flow);
* @param client Player's index.
* @param flow Traffic flowing direction.
* @return Average packet loss, or -1 if network info is not available.
* @error Invalid client index, client not in game, or fake client.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgLoss(client, NetFlow:flow);
@ -678,7 +678,7 @@ native Float:GetClientAvgLoss(client, NetFlow:flow);
* @param client Player's index.
* @param flow Traffic flowing direction.
* @return Average packet loss, or -1 if network info is not available.
* @error Invalid client index, client not in game, or fake client.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgChoke(client, NetFlow:flow);
@ -688,7 +688,7 @@ native Float:GetClientAvgChoke(client, NetFlow:flow);
* @param client Player's index.
* @param flow Traffic flowing direction.
* @return Data flow.
* @error Invalid client index, client not in game, or fake client.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgData(client, NetFlow:flow);
@ -698,7 +698,7 @@ native Float:GetClientAvgData(client, NetFlow:flow);
* @param client Player's index.
* @param flow Traffic flowing direction.
* @return Packet frequency.
* @error Invalid client index, client not in game, or fake client.
* @error Invalid client index, client not connected, or fake client.
*/
native Float:GetClientAvgPackets(client, NetFlow:flow);