diff --git a/reapi/extra/amxmodx/scripting/include/reapi_engine.inc b/reapi/extra/amxmodx/scripting/include/reapi_engine.inc index be36a7da..e0583e08 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_engine.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_engine.inc @@ -279,6 +279,22 @@ native rh_get_net_from(output[], len); */ native rh_get_client_connect_time(const index); +/* +* Checks if server paused +* +* @return Returns true if paused, otherwise false. +*/ +native bool:rh_is_paused(); + +/* +* Set server pause state +* +* @param st Pause state, true: server will be paused +* +* @noreturn +*/ +native rh_set_paused(const bool:st); + /* * Checks if a specific entity is fully packed in a given frame for a host client. * diff --git a/reapi/include/cssdk/engine/rehlds_interfaces.h b/reapi/include/cssdk/engine/rehlds_interfaces.h index e2b909fa..8431d1ce 100644 --- a/reapi/include/cssdk/engine/rehlds_interfaces.h +++ b/reapi/include/cssdk/engine/rehlds_interfaces.h @@ -129,4 +129,7 @@ class IRehldsServerData { virtual void SetName(const char* name) = 0; virtual class ISteamGameServer *GetSteamGameServer() = 0; virtual struct netadr_s *GetNetFrom() = 0; + + virtual bool IsPaused() = 0; + virtual void SetPaused(bool state) = 0; }; diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index 50300b99..d34876a7 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -3722,6 +3722,35 @@ cell AMX_NATIVE_CALL rh_is_entity_fullpacked(AMX *amx, cell *params) return FALSE; } +/* +* Checks if server paused +* +* @return Returns true if paused, otherwise false. +* +* native bool:rh_is_paused(); +*/ +cell AMX_NATIVE_CALL rh_is_paused(AMX *amx, cell *params) +{ + return g_RehldsData->IsPaused() ? TRUE : FALSE; +} + +/* +* Set server pause state +* +* @param st pause state +* +* @noreturn +* +* native rh_set_paused(const bool:st); +*/ +cell AMX_NATIVE_CALL rh_set_paused(AMX *amx, cell *params) +{ + enum { arg_count, arg_st }; + g_RehldsData->SetPaused(params[arg_st] != 0); + + return TRUE; +} + AMX_NATIVE_INFO Misc_Natives_RH[] = { { "rh_set_mapname", rh_set_mapname }, @@ -3734,6 +3763,8 @@ AMX_NATIVE_INFO Misc_Natives_RH[] = { "rh_get_realtime", rh_get_realtime }, { "rh_is_entity_fullpacked", rh_is_entity_fullpacked }, { "rh_get_client_connect_time", rh_get_client_connect_time }, + { "rh_is_paused", rh_is_paused }, + { "rh_set_paused", rh_set_paused }, { nullptr, nullptr } };