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

Add new Cvar to control whether scoreboard_bug is enabled #978

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| mp_team_flash | 1 | -1 | 1 | Sets the behaviour for Flashbangs on teammates.<br/>`-1` Don't affect teammates neither flash owner <br/>`0` Don't affect teammates <br/>`1` Affects teammates |
| mp_fadetoblack | 0 | 0 | 2 | Observer's screen will fade to black on kill event or permanent.<br/> `0` No fade.<br/>`1` Fade to black and won't be able to watch anybody.<br/>`2` fade to black only on kill moment. |
| mp_falldamage | 1 | 0 | 1 | Damage from falling.<br/>`0` disabled <br/>`1` enabled |
| sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply<br/>`0` disabled <br/>`1` enabled |
| sv_allchat | 1 | 0 | 1 | Players can receive all other players text chat, team restrictions apply<br/>`0` disabled <br/>`1` enabled <br/> `2` enabled, but only dead player can see spectator's message |
| 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 |
Expand All @@ -120,6 +120,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
| mp_item_respawn_time | 30 | 0.0 | - | The respawn time for items (such as health packs, armor, etc.). |
| mp_weapon_respawn_time | 20 | 0.0 | - | The respawn time for weapons. |
| mp_ammo_respawn_time | 20 | 0.0 | - | The respawn time for ammunition. |
| mp_scoreboard_fix | 0 | 0 | 1 | Enable ReGameDLL scoreboard bug fix(Dead players could see the bomb or defuse kit).<br/> `0` disabled<br/>`1` enabled<br/>`NOTE`: Absolutely cannot fix it in "CNCS😂" |
</details>

## How to install zBot for CS 1.6?
Expand Down
10 changes: 10 additions & 0 deletions dist/game.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ mp_team_flash "1"
// Players can receive all other players text chat, team restrictions apply.
// 0 - disabled (default behaviour)
// 1 - enabled
// 2 - enabled, but only dead player can see spectator'smessage
//
// Default value: "0"
sv_allchat "0"
Expand Down Expand Up @@ -605,3 +606,12 @@ mp_weapon_respawn_time "20"
//
// Default value: "20"
mp_ammo_respawn_time "20"

// Enable ReGameDLL scoreboard bug fix(Dead players could see the bomb or defuse kit)
// 0 - disable
// 1 - enabled
//
// NOTE: Absolutely cannot fix it in "CNCS😂"
//
// Default value "0"
mp_scoreboard_fix "0"
11 changes: 11 additions & 0 deletions regamedll/dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,17 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
continue;
}

// when allchat is 2,only dead player can see spectator's message
if (
#ifdef REGAMEDLL_ADD
allchat.value == 2.0f &&
#endif
(pPlayer->m_iTeam == UNASSIGNED || pPlayer->m_iTeam == SPECTATOR)
) {
if (pReceiver->pev->deadflag == DEAD_NO)
continue;
}

if ((pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_ENEMY && pReceiver->m_iTeam == pPlayer->m_iTeam)
|| pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_NONE)
{
Expand Down
4 changes: 4 additions & 0 deletions regamedll/dlls/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ cvar_t item_respawn_time = { "mp_item_respawn_time", "30", FCVAR_SERVER, 3
cvar_t weapon_respawn_time = { "mp_weapon_respawn_time", "20", FCVAR_SERVER, 20.0f, nullptr };
cvar_t ammo_respawn_time = { "mp_ammo_respawn_time", "20", FCVAR_SERVER, 20.0f, nullptr };

cvar_t scoreboard_fix = { "mp_scoreboard_fix", "0", FCVAR_SERVER, 0.0f, nullptr };

void GameDLL_Version_f()
{
if (Q_stricmp(CMD_ARGV(1), "version") != 0)
Expand Down Expand Up @@ -453,6 +455,8 @@ void EXT_FUNC GameDLLInit()
CVAR_REGISTER(&item_respawn_time);
CVAR_REGISTER(&weapon_respawn_time);
CVAR_REGISTER(&ammo_respawn_time);

CVAR_REGISTER(&scoreboard_fix);

// print version
CONSOLE_ECHO("ReGameDLL version: " APP_VERSION "\n");
Expand Down
2 changes: 2 additions & 0 deletions regamedll/dlls/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ extern cvar_t item_respawn_time;
extern cvar_t weapon_respawn_time;
extern cvar_t ammo_respawn_time;

extern cvar_t scoreboard_fix;

#endif

extern cvar_t scoreboard_showmoney;
Expand Down
18 changes: 14 additions & 4 deletions regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5548,11 +5548,21 @@ void CBasePlayer::SetScoreAttrib(CBasePlayer *dest)
#endif

#ifdef REGAMEDLL_FIXES
// TODO: Remove these fixes when they are implemented on the client side
if (state & (SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT) && GetForceCamera(dest) != CAMERA_MODE_SPEC_ANYONE)

if (
#ifdef REGAMEDLL_ADD
scoreboard_fix.value
#else
false
#endif
)
{
if (CSGameRules()->PlayerRelationship(this, dest) != GR_TEAMMATE)
state &= ~(SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT);
// TODO: Remove these fixes when they are implemented on the client side
if (state & (SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT) && GetForceCamera(dest) != CAMERA_MODE_SPEC_ANYONE)
{
if (CSGameRules()->PlayerRelationship(this, dest) != GR_TEAMMATE)
state &= ~(SCORE_STATUS_BOMB | SCORE_STATUS_DEFKIT);
}
}
#endif

Expand Down