Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New CVar: mp_give_c4_frags #776

Merged
merged 18 commits into from
Oct 8, 2022
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| sv_autobunnyhopping | 0 | 0 | 1 | Players automatically re-jump while holding jump button.<br/>`0` disabled <br/>`1` enabled |
| 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 | - | - | When set, players can receive credits for defusing or exploding the bomb. |
wopox1337 marked this conversation as resolved.
Show resolved Hide resolved
</details>

## How to install zBot for CS 1.6?
Expand Down
6 changes: 6 additions & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -483,3 +483,9 @@ sv_enablebunnyhopping 0
//
// Default value: "0"
mp_plant_c4_anywhere 0

// When set, players can receive credits for defusing or exploding the bomb.
wopox1337 marked this conversation as resolved.
Show resolved Hide resolved
// 3 - (default behaviour)
//
// Default value: "3"
mp_give_c4_frags 3
2 changes: 2 additions & 0 deletions regamedll/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ cvar_t allchat = { "sv_allchat", "0", 0, 0.0f, nullptr
cvar_t sv_autobunnyhopping = { "sv_autobunnyhopping", "0", 0, 0.0f, nullptr };
cvar_t sv_enablebunnyhopping = { "sv_enablebunnyhopping", "0", 0, 0.0f, nullptr };
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, 0.0f, nullptr };
wopox1337 marked this conversation as resolved.
Show resolved Hide resolved

void GameDLL_Version_f()
{
Expand Down Expand Up @@ -403,6 +404,7 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&sv_autobunnyhopping);
CVAR_REGISTER(&sv_enablebunnyhopping);
CVAR_REGISTER(&plant_c4_anywhere);
CVAR_REGISTER(&give_c4_frags);

// 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 @@ -188,6 +188,7 @@ extern cvar_t allchat;
extern cvar_t sv_autobunnyhopping;
extern cvar_t sv_enablebunnyhopping;
extern cvar_t plant_c4_anywhere;
extern cvar_t give_c4_frags;

#endif

Expand Down
12 changes: 10 additions & 2 deletions regamedll/dlls/ggrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,12 @@ void CGrenade::__API_HOOK(DefuseBombEnd)(CBasePlayer *pPlayer, bool bDefused)
CSGameRules()->m_bBombDefused = true;
CSGameRules()->CheckWinConditions();

// give the defuser credit for defusing the bomb
m_pBombDefuser->pev->frags += 3.0f;
#ifdef REGAMEDLL_ADD
m_pBombDefuser->pev->frags += give_c4_frags.value;
wopox1337 marked this conversation as resolved.
Show resolved Hide resolved
#else
// give the defuser credit for defusing the bomb
m_pBombDefuser->pev->frags += 3.0f;
#endif

MESSAGE_BEGIN(MSG_ALL, gmsgBombPickup);
MESSAGE_END();
Expand Down Expand Up @@ -1435,7 +1439,11 @@ void CGrenade::C4Think()
CBasePlayer *pBombOwner = CBasePlayer::Instance(pev->owner);
if (pBombOwner)
{
#ifdef REGAMEDLL_ADD
pBombOwner->pev->frags += give_c4_frags.value;
#else
pBombOwner->pev->frags += 3.0f;
#endif
}

MESSAGE_BEGIN(MSG_ALL, gmsgBombPickup);
Expand Down