Skip to content

Fix connect penalty counts always showing 0 (1.9.1) - #296

Merged
Ravid-A merged 1 commit into
mainfrom
fix/connect-penalty-counts
Oct 16, 2026
Merged

Ravid-A merged 1 commit into
mainfrom
fix/connect-penalty-counts

Conversation

@Ravid-A

@Ravid-A Ravid-A commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Problem

A server owner reported that the admin notification on player connect (sa_admin_penalty_info) always shows 0 penalties. Bans, gags, mutes and silences were all always 0.

Causes and fixes

  • Gags/mutes/silences: MuteManager.GetPlayerMutes ran GetRetrieveMutesQuery (the unmute id lookup, which needs @pattern/@muteType) instead of GetMuteStatsQuery. The query threw, the catch returned (0,0,0), and the counts were always 0. It now uses GetMuteStatsQuery.
  • Bans: CacheManager.GetPlayerBansBySteamId read _steamIdIndex, which only holds ACTIVE bans. A player with an active ban is kicked before the message is sent, so the count was always 0. It now counts all of the player's bans in _banCache, expired and unbanned included. The connect message is the only caller; the ban check still uses the active-only index, so kick behavior is unchanged.

Version bumped to 1.9.1 (VERSION, ModuleVersion).

Testing

  • Release build: 0 errors, and no warnings from the changed lines.
  • Not yet tested on a live server.

The admin notification on player connect always reported 0 bans, gags,
mutes and silences.

- MuteManager.GetPlayerMutes ran GetRetrieveMutesQuery (the unmute id
  lookup, which needs @pattern/@muteType) instead of GetMuteStatsQuery.
  The query threw, the catch returned (0,0,0), so mute counts were
  always 0.
- CacheManager.GetPlayerBansBySteamId read _steamIdIndex, which only
  holds ACTIVE bans. Anyone with an active ban is kicked before the
  message is sent, so the count was always 0. It now counts all of the
  player's bans in _banCache (expired/unbanned included). The connect
  message is its only caller; the ban check still uses the active index.
@Ravid-A
Ravid-A merged commit 03a454b into main Oct 16, 2026
2 checks passed
@Ravid-A
Ravid-A deleted the fix/connect-penalty-counts branch October 16, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant