1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-19 03:57:14 +01:00

Implement server network statistics.

Server statistics can be retrieved by passing -1 as the player identifier.
This commit is contained in:
Sandu Liviu Catalin 2019-08-15 16:46:11 +03:00
parent 9710645cd5
commit 303acf2837
3 changed files with 33 additions and 1 deletions

View File

@ -851,4 +851,22 @@ void SetFallTimer(Uint16 rate)
_Func->SetFallTimer(rate);
}
// ------------------------------------------------------------------------------------------------
SQFloat GetNetworkStatisticsF(Int32 option_id)
{
// Retrieve the requested information
double value = _Func->GetNetworkStatistics(-1, static_cast< vcmpNetworkStatisticsOption >(option_id));
// Return it in the proper type
return static_cast< SQFloat >(value);
}
// ------------------------------------------------------------------------------------------------
SQInteger GetNetworkStatisticsI(Int32 option_id)
{
// Retrieve the requested information
double value = _Func->GetNetworkStatistics(-1, static_cast< vcmpNetworkStatisticsOption >(option_id));
// Return it in the proper type
return static_cast< SQInteger >(value);
}
} // Namespace:: SqMod

View File

@ -479,6 +479,18 @@ Uint16 GetFallTimer();
*/
void SetFallTimer(Uint16 rate);
/* ------------------------------------------------------------------------------------------------
* Retrieve network statistics related to the server.
*/
SQFloat GetNetworkStatisticsF(Int32 option_id);
/* ------------------------------------------------------------------------------------------------
* Retrieve network statistics related to the server.
*/
SQInteger GetNetworkStatisticsI(Int32 option_id);
} // Namespace:: SqMod
#endif // _MISC_FUNCTIONS_HPP_

View File

@ -121,7 +121,9 @@ void Register_Misc(HSQUIRRELVM vm)
.Func(_SC("GetDistrictName"), &GetDistrictName)
.Func(_SC("GetDistrictNameEx"), &GetDistrictNameEx)
.Func(_SC("GetFallTimer"), &GetFallTimer)
.Func(_SC("SetFallTimer"), &SetFallTimer);
.Func(_SC("SetFallTimer"), &SetFallTimer)
.Func(_SC("GetNetworkStatisticsF"), &GetNetworkStatisticsF)
.Func(_SC("GetNetworkStatisticsI"), &GetNetworkStatisticsI);
RootTable(vm).Bind(_SC("SqServer"), srvns);