2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-07-04 08:19:30 +03:00

Add natives about pause

This commit is contained in:
h0mev 2024-07-14 21:35:33 +08:00
parent 472d279c5a
commit 89f575c896
3 changed files with 50 additions and 0 deletions

View File

@ -279,6 +279,22 @@ native rh_get_net_from(output[], len);
*/ */
native rh_get_client_connect_time(const index); 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. * Checks if a specific entity is fully packed in a given frame for a host client.
* *

View File

@ -129,4 +129,7 @@ public:
virtual void SetName(const char* name) = 0; virtual void SetName(const char* name) = 0;
virtual class ISteamGameServer *GetSteamGameServer() = 0; virtual class ISteamGameServer *GetSteamGameServer() = 0;
virtual struct netadr_s *GetNetFrom() = 0; virtual struct netadr_s *GetNetFrom() = 0;
virtual bool IsPaused() = 0;
virtual void SetPaused(bool state) = 0;
}; };

View File

@ -3722,6 +3722,35 @@ cell AMX_NATIVE_CALL rh_is_entity_fullpacked(AMX *amx, cell *params)
return FALSE; 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[] = AMX_NATIVE_INFO Misc_Natives_RH[] =
{ {
{ "rh_set_mapname", rh_set_mapname }, { "rh_set_mapname", rh_set_mapname },
@ -3734,6 +3763,8 @@ AMX_NATIVE_INFO Misc_Natives_RH[] =
{ "rh_get_realtime", rh_get_realtime }, { "rh_get_realtime", rh_get_realtime },
{ "rh_is_entity_fullpacked", rh_is_entity_fullpacked }, { "rh_is_entity_fullpacked", rh_is_entity_fullpacked },
{ "rh_get_client_connect_time", rh_get_client_connect_time }, { "rh_get_client_connect_time", rh_get_client_connect_time },
{ "rh_is_paused", rh_is_paused },
{ "rh_set_paused", rh_set_paused },
{ nullptr, nullptr } { nullptr, nullptr }
}; };