merged in bug fixes from trunk
--HG-- branch : sourcemod-1.0.x extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%402164
This commit is contained in:
parent
68eeff311b
commit
64e0403cd5
@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -181,6 +181,9 @@ int DebugReport::_GetPluginIndex(IPluginContext *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
iter->Release();
|
iter->Release();
|
||||||
return -1;
|
|
||||||
|
/* If we don't know which plugin this is, it's one being loaded. Fake its index for now. */
|
||||||
|
|
||||||
|
return g_PluginSys.GetPluginCount() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -765,115 +765,199 @@ static cell_t IsTimingOut(IPluginContext *pContext, const cell_t *params)
|
|||||||
static cell_t GetLatency(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetLatency(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
|
float value;
|
||||||
|
|
||||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||||
} else if (!pPlayer->IsInGame()) {
|
}
|
||||||
|
else if (!pPlayer->IsInGame())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is not in game", client);
|
return pContext->ThrowNativeError("Client %d is not in game", client);
|
||||||
} else if (pPlayer->IsFakeClient()) {
|
}
|
||||||
|
else if (pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is a bot", client);
|
return pContext->ThrowNativeError("Client %d is a bot", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||||
|
|
||||||
return sp_ftoc(pInfo->GetLatency(params[2]));
|
if (params[2] == MAX_FLOWS)
|
||||||
|
{
|
||||||
|
value = pInfo->GetLatency(FLOW_INCOMING) + pInfo->GetLatency(FLOW_OUTGOING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = pInfo->GetLatency(params[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sp_ftoc(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetAvgLatency(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetAvgLatency(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
|
float value;
|
||||||
|
|
||||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||||
} else if (!pPlayer->IsInGame()) {
|
}
|
||||||
|
else if (!pPlayer->IsInGame())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is not in game", client);
|
return pContext->ThrowNativeError("Client %d is not in game", client);
|
||||||
} else if (pPlayer->IsFakeClient()) {
|
}
|
||||||
|
else if (pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is a bot", client);
|
return pContext->ThrowNativeError("Client %d is a bot", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||||
|
|
||||||
return sp_ftoc(pInfo->GetAvgLatency(params[2]));
|
if (params[2] == MAX_FLOWS)
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgLatency(FLOW_INCOMING) + pInfo->GetAvgLatency(FLOW_OUTGOING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgLatency(params[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sp_ftoc(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetAvgLoss(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetAvgLoss(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
|
float value;
|
||||||
|
|
||||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||||
} else if (!pPlayer->IsInGame()) {
|
}
|
||||||
|
else if (!pPlayer->IsInGame())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is not in game", client);
|
return pContext->ThrowNativeError("Client %d is not in game", client);
|
||||||
} else if (pPlayer->IsFakeClient()) {
|
}
|
||||||
|
else if (pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is a bot", client);
|
return pContext->ThrowNativeError("Client %d is a bot", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||||
|
|
||||||
return sp_ftoc(pInfo->GetAvgLoss(params[2]));
|
if (params[2] == MAX_FLOWS)
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgLoss(FLOW_INCOMING) + pInfo->GetAvgLoss(FLOW_OUTGOING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgLoss(params[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sp_ftoc(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetAvgChoke(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetAvgChoke(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
|
float value;
|
||||||
|
|
||||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||||
} else if (!pPlayer->IsInGame()) {
|
}
|
||||||
|
else if (!pPlayer->IsInGame())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is not in game", client);
|
return pContext->ThrowNativeError("Client %d is not in game", client);
|
||||||
} else if (pPlayer->IsFakeClient()) {
|
}
|
||||||
|
else if (pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is a bot", client);
|
return pContext->ThrowNativeError("Client %d is a bot", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||||
|
|
||||||
return sp_ftoc(pInfo->GetAvgChoke(params[2]));
|
if (params[2] == MAX_FLOWS)
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgChoke(FLOW_INCOMING) + pInfo->GetAvgChoke(FLOW_OUTGOING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgChoke(params[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sp_ftoc(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetAvgData(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetAvgData(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
|
float value;
|
||||||
|
|
||||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||||
} else if (!pPlayer->IsInGame()) {
|
}
|
||||||
|
else if (!pPlayer->IsInGame())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is not in game", client);
|
return pContext->ThrowNativeError("Client %d is not in game", client);
|
||||||
} else if (pPlayer->IsFakeClient()) {
|
}
|
||||||
|
else if (pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is a bot", client);
|
return pContext->ThrowNativeError("Client %d is a bot", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||||
|
|
||||||
return sp_ftoc(pInfo->GetAvgData(params[2]));
|
if (params[2] == MAX_FLOWS)
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgData(FLOW_INCOMING) + pInfo->GetAvgData(FLOW_OUTGOING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgData(params[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sp_ftoc(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
|
float value;
|
||||||
|
|
||||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
if (!pPlayer)
|
if (!pPlayer)
|
||||||
{
|
{
|
||||||
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||||
} else if (!pPlayer->IsInGame()) {
|
}
|
||||||
|
else if (!pPlayer->IsInGame())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is not in game", client);
|
return pContext->ThrowNativeError("Client %d is not in game", client);
|
||||||
} else if (pPlayer->IsFakeClient()) {
|
}
|
||||||
|
else if (pPlayer->IsFakeClient())
|
||||||
|
{
|
||||||
return pContext->ThrowNativeError("Client %d is a bot", client);
|
return pContext->ThrowNativeError("Client %d is a bot", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
|
||||||
|
|
||||||
return sp_ftoc(pInfo->GetAvgPackets(params[2]));
|
if (params[2] == MAX_FLOWS)
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgPackets(FLOW_INCOMING) + pInfo->GetAvgPackets(FLOW_OUTGOING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = pInfo->GetAvgPackets(params[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sp_ftoc(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetClientOfUserId(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetClientOfUserId(IPluginContext *pContext, const cell_t *params)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
|
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This file is part of the SourceMod/SourcePawn SDK.
|
* This file is part of the SourceMod/SourcePawn SDK.
|
||||||
@ -35,11 +35,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#define _clients_included
|
#define _clients_included
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Network flow directions.
|
||||||
|
*/
|
||||||
enum NetFlow
|
enum NetFlow
|
||||||
{
|
{
|
||||||
NetFlow_Outgoing = 0, /**< Outgoing traffic */
|
NetFlow_Outgoing = 0, /**< Outgoing traffic */
|
||||||
NetFlow_Incoming, /**< Incoming traffic */
|
NetFlow_Incoming, /**< Incoming traffic */
|
||||||
NetFlow_Both /**< Incoming and outgoing traffic */
|
NetFlow_Both, /**< Both values added together */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAXPLAYERS 64 /**< Maximum number of players that can be in server */
|
#define MAXPLAYERS 64 /**< Maximum number of players that can be in server */
|
||||||
|
Loading…
Reference in New Issue
Block a user