fix: admins with no matching admin group vanish from !admins list - #35
Open
Rushaway wants to merge 1 commit into
Open
fix: admins with no matching admin group vanish from !admins list#35Rushaway wants to merge 1 commit into
Rushaway wants to merge 1 commit into
Conversation
getAdminsAndGroups() skipped any admin whose Admin_Generic/Root/RCON flag wasn't explicitly added by one of their admin groups (e.g. flags assigned directly to the admin, or an admin only in non-admin groups like VIP), even though GetAdminFlag(aid, Admin_Generic) already confirmed they're a real admin. This is exactly the case reported in #29, where some admins never show up in !admins, especially when they are the only admin online. Also fixes two related bugs in the same "no matching group" fallback path: a second such admin overwrote the first one at names[y][0] instead of being appended, and the code stored the raw client index cast as AdminId instead of the real AdminId, which broke GetUsername()/GetClientNameOfAdminId() lookups for that admin. Fixes #29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #29 — admins were sometimes missing from the
!adminslist, especially when they were the only admin online.Root cause
In
getAdminsAndGroups(), every online admin was checked withGetAdminFlag(aid, Admin_Generic)to confirm they're an admin, then the code tried to find which of their admin groups explicitly addsAdmin_Generic/Admin_Root/Admin_RCON(used purely for display grouping/coloring). If no group did — e.g. the admin has flags assigned directly with no group at all, or is only in a non-admin group like VIP — the code hit:and silently dropped the admin from the list entirely, even though they had already been confirmed as a real admin. This matches the reported symptom exactly (single admin online, no group assigned → shows as offline).
I confirmed adding the SourceBans++
SBPP_OnClientPostAdminCheckforward (as discussed in the issue) does not fix this — the bug is in the group-resolution logic itself, unrelated to cache-rebuild timing.Fix
gid = INVALID_GROUP_ID) instead of dropping them.names[y][0]instead of being appended at the next free slot.AdminIdinstead of the realAdminId, which brokeGetUsername()/GetClientNameOfAdminId()lookups for those admins;resolveAdminsAndGroups()updated accordingly (now usesGetClientOfAdminId()for the disconnected-check instead of casting the stored value back to an int).How Has This Been Tested?
Compiled cleanly against SourceMod 1.12 includes with no warnings/errors.
Types of changes