Skip to content

Commit

Permalink
Add mp_hostages_rescued_ratio cvar
Browse files Browse the repository at this point in the history
  • Loading branch information
fl0werD committed Nov 21, 2022
1 parent d8702df commit f1aabcf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
4 changes: 4 additions & 0 deletions regamedll/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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");

Expand Down
1 change: 1 addition & 0 deletions regamedll/dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions regamedll/dlls/multiplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,12 @@ bool CHalfLifeMultiplay::HostageRescueRoundEndCheck()
}
}

#ifdef REGAMEDLL_ADD
if (hostagesCount > 0 && m_iHostagesRescued >= (hostagesCount * hostages_rescued_ratio.value))
{
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)
{
Expand All @@ -1494,6 +1500,7 @@ bool CHalfLifeMultiplay::HostageRescueRoundEndCheck()
return OnRoundEnd_Intercept(WINSTATUS_CTS, ROUND_ALL_HOSTAGES_RESCUED, GetRoundRestartDelay());
}
}
#endif

return false;
}
Expand Down

0 comments on commit f1aabcf

Please sign in to comment.