pull/112/merge
David Cernat 8 years ago
commit 4d053743a0

@ -846,3 +846,8 @@ unsigned int Networking::MaxConnections() const
{
return peer->GetMaximumIncomingConnections();
}
int Networking::GetAvgPing(RakNet::AddressOrGUID addr) const
{
return peer->GetAveragePing(addr);
}

@ -27,6 +27,7 @@ namespace mwmp
unsigned short NumberOfConnections() const;
unsigned int MaxConnections() const;
int GetAvgPing(RakNet::AddressOrGUID) const;
int MainLoop();

@ -131,3 +131,10 @@ const char *ScriptFunctions::GetProtocolVersion() noexcept
static string version = to_string(TES3MP_PROTO_VERSION);
return version.c_str();
}
int ScriptFunctions::GetAvgPing(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player,-1);
return mwmp::Networking::Get().GetAvgPing(player->guid);
}

@ -60,6 +60,7 @@ public:
static void Kick(unsigned short pid) noexcept;
static const char *GetServerVersion() noexcept;
static const char *GetProtocolVersion() noexcept;
static int GetAvgPing(unsigned short pid) noexcept;
static constexpr ScriptFunctionData functions[]{
{"CreateTimer", ScriptFunctions::CreateTimer},
@ -81,6 +82,7 @@ public:
{"Kick", ScriptFunctions::Kick},
{"GetServerVersion", ScriptFunctions::GetServerVersion},
{"GetProtocolVersion", ScriptFunctions::GetProtocolVersion},
{"GetAvgPing", ScriptFunctions::GetAvgPing},
TRANSLOCATIONFUNCTIONS,
STATSFUNCTIONS,

Loading…
Cancel
Save