Skip to content

Commit 7f55e59

Browse files
committed
gameserver: add a convar
1 parent e94b9d7 commit 7f55e59

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3438,6 +3438,12 @@ Called when a client disconnects.
34383438
> [!NOTE]
34393439
> This **requires** the `sourcetv` module to be enabled, or else it **won't** be called.
34403440
3441+
### ConVars
3442+
3443+
#### holylib_gameserver_disablespawnsafety (default `0`)
3444+
If enabled, players can spawn on slots above 128 but this WILL cause stability and many other issues!
3445+
Added to satisfy curiosity & test around with slots above 128.
3446+
34413447
### Singleplayer
34423448
This module allows you to have a 1 slot / a singleplayer server.
34433449
Why? I don't know, but you can.

source/modules/gameserver.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class CGameServerModule : public IModule
2222
virtual int Compatibility() { return LINUX32; };
2323
};
2424

25+
static ConVar gameserver_disablespawnsafety("holylib_gameserver_disablespawnsafety", "0", 0, "If enabled, players can spawn on slots above 128 but this WILL cause stability and many other issues!");
26+
2527
CGameServerModule g_pGameServerModule;
2628
IModule* pGameServerModule = &g_pGameServerModule;
2729

@@ -1609,7 +1611,7 @@ static int FindFreeClientSlot()
16091611
static Detouring::Hook detour_CGameClient_SpawnPlayer;
16101612
void hook_CGameClient_SpawnPlayer(CGameClient* client)
16111613
{
1612-
if (client->m_nClientSlot < MAX_PLAYERS)
1614+
if (client->m_nClientSlot < MAX_PLAYERS && !gameserver_disablespawnsafety.GetBool())
16131615
{
16141616
detour_CGameClient_SpawnPlayer.GetTrampoline<Symbols::CGameClient_SpawnPlayer>()(client);
16151617
return;

0 commit comments

Comments
 (0)