New CVar: mp_hostages_rescued_ratio (#786)

* Add mp_hostages_rescued_ratio cvar

* Add restriction of the CVar value

Co-authored-by: Sergey Shorokhov <sergeyshorokhov@csgo.com>
This commit is contained in:
fl0werD 2022-11-24 21:16:37 +04:00 committed by GitHub
parent 946b5a9db0
commit 84f1f5e4c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 0 deletions

View File

@ -105,6 +105,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| sv_enablebunnyhopping | 0 | 0 | 1 | Allow player speed to exceed maximum running speed.<br/>`0` disabled <br/>`1` enabled |
| mp_plant_c4_anywhere | 0 | 0 | 1 | When set, players can plant anywhere, not only in bombsites.<br/>`0` disabled <br/>`1` enabled |
| mp_give_c4_frags | 3 | - | - | How many bonuses (frags) will get the player who defused or exploded the bomb. |
| mp_hostages_rescued_ratio | 1.0 | 0.0 | 1.0 | Ratio of hostages rescued to win the round. |
</details>
## How to install zBot for CS 1.6?

5
dist/game.cfg vendored
View File

@ -489,3 +489,8 @@ mp_plant_c4_anywhere "0"
//
// Default value: "3"
mp_give_c4_frags "3"
// Ratio of hostages rescued to win the round.
//
// Default value: "1.0"
mp_hostages_rescued_ratio "1.0"

View File

@ -164,6 +164,8 @@ cvar_t sv_enablebunnyhopping = { "sv_enablebunnyhopping", "0", 0, 0.
cvar_t plant_c4_anywhere = { "mp_plant_c4_anywhere", "0", 0, 0.0f, nullptr };
cvar_t give_c4_frags = { "mp_give_c4_frags", "3", 0, 3.0f, nullptr };
cvar_t hostages_rescued_ratio = { "mp_hostages_rescued_ratio", "1.0", 0, 1.0f, nullptr };
void GameDLL_Version_f()
{
if (Q_stricmp(CMD_ARGV(1), "version") != 0)
@ -406,6 +408,8 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&plant_c4_anywhere);
CVAR_REGISTER(&give_c4_frags);
CVAR_REGISTER(&hostages_rescued_ratio);
// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");

View File

@ -189,6 +189,7 @@ extern cvar_t sv_autobunnyhopping;
extern cvar_t sv_enablebunnyhopping;
extern cvar_t plant_c4_anywhere;
extern cvar_t give_c4_frags;
extern cvar_t hostages_rescued_ratio;
#endif

View File

@ -1486,6 +1486,12 @@ bool CHalfLifeMultiplay::HostageRescueRoundEndCheck()
}
}
#ifdef REGAMEDLL_ADD
if (hostagesCount > 0 && m_iHostagesRescued >= (hostagesCount * Q_min(hostages_rescued_ratio.value, 1.0f)))
{
return OnRoundEnd_Intercept(WINSTATUS_CTS, ROUND_ALL_HOSTAGES_RESCUED, GetRoundRestartDelay());
}
#else
// There are no hostages alive.. check to see if the CTs have rescued atleast 50% of them.
if (!bHostageAlive && hostagesCount > 0)
{
@ -1494,6 +1500,7 @@ bool CHalfLifeMultiplay::HostageRescueRoundEndCheck()
return OnRoundEnd_Intercept(WINSTATUS_CTS, ROUND_ALL_HOSTAGES_RESCUED, GetRoundRestartDelay());
}
}
#endif
return false;
}