diff --git a/dist/game.cfg b/dist/game.cfg index be842906..f9e97102 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -193,3 +193,11 @@ mp_legacy_bombtarget_touch "1" // // Default value: "0" mp_respawn_immunitytime "0" + +// Kill the player in filled spawn before spawning some one else (Prevents players stucking in each other). +// Only disable this if you have semiclip or other plugins that prevents stucking +// 0 - disabled +// 1 - enabled +// +// Default value: "1" +mp_kill_filled_spawn "1" diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index dc98895c..c9cff0e5 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -117,6 +117,7 @@ cvar_t old_bomb_defused_sound = { "mp_old_bomb_defused_sound", "1", FCVAR_SERVE cvar_t item_staytime = { "mp_item_staytime", "300", FCVAR_SERVER, 300.0f, nullptr }; cvar_t legacy_bombtarget_touch = { "mp_legacy_bombtarget_touch", "1", FCVAR_SERVER, 1.0f, nullptr }; cvar_t respawn_immunitytime = { "mp_respawn_immunitytime", "0", FCVAR_SERVER, 0.0f, nullptr }; +cvar_t kill_filled_spawn = { "mp_kill_filled_spawn", "1", FCVAR_SERVER, 0.0f, nullptr }; void GameDLL_Version_f() { @@ -272,6 +273,7 @@ void EXT_FUNC GameDLLInit() CVAR_REGISTER(&item_staytime); CVAR_REGISTER(&legacy_bombtarget_touch); CVAR_REGISTER(&respawn_immunitytime); + CVAR_REGISTER(&kill_filled_spawn); // print version CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n"); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 1c3fd654..e00ee05b 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -154,6 +154,7 @@ extern cvar_t old_bomb_defused_sound; extern cvar_t item_staytime; extern cvar_t legacy_bombtarget_touch; extern cvar_t respawn_immunitytime; +extern cvar_t kill_filled_spawn; #endif diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index d36f4bc5..33f6c1b4 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -4948,12 +4948,19 @@ bool CBasePlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity *&pSpot // we haven't found a place to spawn yet, so kill any guy at the first spawn point and spawn there if (!FNullEnt(pSpot)) { - CBaseEntity *pEntity = nullptr; - while ((pEntity = UTIL_FindEntityInSphere(pEntity, pSpot->pev->origin, MAX_PLAYER_USE_RADIUS))) +#ifdef REGAMEDLL_ADD + if (kill_filled_spawn.value != 0.0) +#endif { - // if ent is a client, kill em (unless they are ourselves) - if (pEntity->IsPlayer() && pEntity->edict() != pPlayer) - pEntity->TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), 200, DMG_GENERIC); + CBaseEntity *pEntity = nullptr; + while ((pEntity = UTIL_FindEntityInSphere(pEntity, pSpot->pev->origin, MAX_PLAYER_USE_RADIUS))) + { + // if ent is a client, kill em (unless they are ourselves) + if (pEntity->IsPlayer() && pEntity->edict() != pPlayer) + { + pEntity->TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), 200, DMG_GENERIC); + } + } } // if so, go to pSpot