mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 06:55:54 -04:00
Implement GetAvgPing(pid) function
This commit is contained in:
parent
37e9cafbf7
commit
82f202c891
@ -846,3 +846,8 @@ unsigned int Networking::MaxConnections() const
|
|||||||
{
|
{
|
||||||
return peer->GetMaximumIncomingConnections();
|
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 short NumberOfConnections() const;
|
||||||
unsigned int MaxConnections() const;
|
unsigned int MaxConnections() const;
|
||||||
|
int GetAvgPing(RakNet::AddressOrGUID) const;
|
||||||
|
|
||||||
int MainLoop();
|
int MainLoop();
|
||||||
|
|
||||||
|
@ -131,3 +131,10 @@ const char *ScriptFunctions::GetProtocolVersion() noexcept
|
|||||||
static string version = to_string(TES3MP_PROTO_VERSION);
|
static string version = to_string(TES3MP_PROTO_VERSION);
|
||||||
return version.c_str();
|
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 void Kick(unsigned short pid) noexcept;
|
||||||
static const char *GetServerVersion() noexcept;
|
static const char *GetServerVersion() noexcept;
|
||||||
static const char *GetProtocolVersion() noexcept;
|
static const char *GetProtocolVersion() noexcept;
|
||||||
|
static int GetAvgPing(unsigned short pid) noexcept;
|
||||||
|
|
||||||
static constexpr ScriptFunctionData functions[]{
|
static constexpr ScriptFunctionData functions[]{
|
||||||
{"CreateTimer", ScriptFunctions::CreateTimer},
|
{"CreateTimer", ScriptFunctions::CreateTimer},
|
||||||
@ -81,6 +82,7 @@ public:
|
|||||||
{"Kick", ScriptFunctions::Kick},
|
{"Kick", ScriptFunctions::Kick},
|
||||||
{"GetServerVersion", ScriptFunctions::GetServerVersion},
|
{"GetServerVersion", ScriptFunctions::GetServerVersion},
|
||||||
{"GetProtocolVersion", ScriptFunctions::GetProtocolVersion},
|
{"GetProtocolVersion", ScriptFunctions::GetProtocolVersion},
|
||||||
|
{"GetAvgPing", ScriptFunctions::GetAvgPing},
|
||||||
|
|
||||||
TRANSLOCATIONFUNCTIONS,
|
TRANSLOCATIONFUNCTIONS,
|
||||||
STATSFUNCTIONS,
|
STATSFUNCTIONS,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user