2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-04-14 05:20:06 +03:00

Add API function SetServerPause (#1086)

This commit is contained in:
Eason 2025-04-08 18:47:13 +08:00 committed by GitHub
parent 5cac7a97ab
commit 97dd83d626
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 3 deletions

View File

@ -38,7 +38,7 @@
#include "pr_dlls.h"
#define REHLDS_API_VERSION_MAJOR 3
#define REHLDS_API_VERSION_MINOR 14
#define REHLDS_API_VERSION_MINOR 15
//Steam_NotifyClientConnect hook
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
@ -434,6 +434,9 @@ struct RehldsFuncs_t {
void(*MSG_BeginReading)();
double(*GetHostFrameTime)();
struct cmd_function_s *(*GetFirstCmdFunctionHandle)();
// Pause
void(*SetServerPause)(bool status);
};
class IRehldsApi {

View File

@ -468,6 +468,26 @@ void EXT_FUNC SV_WriteMovevarsToClient_api(sizebuf_t *message)
SV_WriteMovevarsToClient(message, &sv_movevars);
}
void EXT_FUNC SetServerPause(bool setPause)
{
g_psv.paused = setPause;
#ifdef REHLDS_FIXES
for (int i = 0; i < g_psvs.maxclients; i++)
{
if (g_psvs.clients[i].fakeclient)
continue;
if (!g_psvs.clients[i].connected)
continue;
MSG_WriteByte(&g_psvs.clients[i].netchan.message, svc_setpause);
MSG_WriteByte(&g_psvs.clients[i].netchan.message, g_psv.paused);
}
#else // REHLDS_FIXES
MSG_WriteByte(&g_psv.reliable_datagram, svc_setpause);
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
#endif // REHLDS_FIXES
}
CRehldsServerStatic g_RehldsServerStatic;
CRehldsServerData g_RehldsServerData;
CRehldsHookchains g_RehldsHookchains;
@ -571,7 +591,8 @@ RehldsFuncs_t g_RehldsApiFuncs =
&SZ_Clear_api,
&MSG_BeginReading_api,
&GetHostFrameTime_api,
&GetFirstCmdFunctionHandle_api
&GetFirstCmdFunctionHandle_api,
&SetServerPause,
};
bool EXT_FUNC SV_EmitSound2_internal(edict_t *entity, IGameClient *pReceiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin)

View File

@ -6,5 +6,5 @@
#pragma once
#define VERSION_MAJOR 3
#define VERSION_MINOR 14
#define VERSION_MINOR 15
#define VERSION_MAINTENANCE 0