From 83151aaf0b476ab7ffb5282c8caeb312fc7e0b97 Mon Sep 17 00:00:00 2001 From: 666JuL <42683036+666JuL@users.noreply.github.com> Date: Sat, 8 Oct 2022 13:32:30 -0400 Subject: [PATCH] New CVar: `mp_give_c4_frags` (#776) Co-authored-by: Sergey Shorokhov --- README.md | 1 + dist/game.cfg | 6 ++++++ regamedll/dlls/game.cpp | 2 ++ regamedll/dlls/game.h | 1 + regamedll/dlls/ggrenade.cpp | 12 ++++++++++-- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 20557455..7e289f8d 100644 --- a/README.md +++ b/README.md @@ -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.
`0` disabled
`1` enabled | | sv_enablebunnyhopping | 0 | 0 | 1 | Allow player speed to exceed maximum running speed.
`0` disabled
`1` enabled | | mp_plant_c4_anywhere | 0 | 0 | 1 | When set, players can plant anywhere, not only in bombsites.
`0` disabled
`1` enabled | +| mp_give_c4_frags | 3 | - | - | How many bonuses (frags) will get the player who defused or exploded the bomb. | ## How to install zBot for CS 1.6? diff --git a/dist/game.cfg b/dist/game.cfg index 09766cd0..eb6f511f 100644 --- a/dist/game.cfg +++ b/dist/game.cfg @@ -483,3 +483,9 @@ sv_enablebunnyhopping 0 // // Default value: "0" mp_plant_c4_anywhere 0 + +// How many bonuses (frags) will get the player who defused or exploded the bomb. +// 3 - (default behaviour) +// +// Default value: "3" +mp_give_c4_frags 3 diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 20d4fdc9..192e254e 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -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, 3.0f, nullptr }; void GameDLL_Version_f() { @@ -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"); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 5c75387b..191211e0 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -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 diff --git a/regamedll/dlls/ggrenade.cpp b/regamedll/dlls/ggrenade.cpp index 7b8e9684..8732b571 100644 --- a/regamedll/dlls/ggrenade.cpp +++ b/regamedll/dlls/ggrenade.cpp @@ -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 += (int)give_c4_frags.value; +#else + // give the defuser credit for defusing the bomb + m_pBombDefuser->pev->frags += 3.0f; +#endif MESSAGE_BEGIN(MSG_ALL, gmsgBombPickup); MESSAGE_END(); @@ -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);