mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-10-29 21:37:18 +01:00 
			
		
		
		
	Implement server network statistics.
Server statistics can be retrieved by passing -1 as the player identifier.
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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_ | ||||
|   | ||||
| @@ -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); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user