Support for arbitrary max clients

This commit is contained in:
xen 2020-08-28 18:17:24 +02:00
parent 0d548fb60f
commit 0036f44d4f

View File

@ -229,6 +229,8 @@ CDetour *g_pDetour_SwingOrStab = NULL;
int g_SH_SkipTwoEntitiesShouldHitEntity = 0;
int g_SH_SimpleShouldHitEntity = 0;
int g_iMaxPlayers = 0;
uintptr_t g_CTraceFilterNoNPCsOrPlayer = 0;
CTraceFilterSkipTwoEntities *g_CTraceFilterSkipTwoEntities = NULL;
CTraceFilterSimple *g_CTraceFilterSimple = NULL;
@ -384,7 +386,7 @@ bool ShouldHitEntity(IHandleEntity *pHandleEntity, int contentsMask)
int iTeam = 0;
if(index > SM_MAXPLAYERS && g_pPhysboxToClientMap && index < 2048)
if(index > g_iMaxPlayers && g_pPhysboxToClientMap && index < 2048)
{
index = g_pPhysboxToClientMap[index];
}
@ -393,7 +395,7 @@ bool ShouldHitEntity(IHandleEntity *pHandleEntity, int contentsMask)
{
iTeam = -index;
}
else if(index < 1 || index > SM_MAXPLAYERS)
else if(index < 1 || index > g_iMaxPlayers)
{
RETURN_META_VALUE(MRES_IGNORED, true);
}
@ -505,6 +507,8 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
srand((unsigned int)time(NULL));
g_iMaxPlayers = playerhelpers->GetMaxClients();
char conf_error[255] = "";
if(!gameconfs->LoadGameConfigFile("CSSFixes", &g_pGameConf, conf_error, sizeof(conf_error)))
{