[SBPP Checker] Callback and initial values - #22
Conversation
…ial values Ports upstream sbpp#894. - Initialize g_iBanCounts/g_iMuteCounts/g_iGagCounts to -1 so the natives report "not yet available" rather than stale values before the async OnConnectBanCheck callback resolves. - Reset those counts to -1 in OnClientDisconnect_Post. - Add global forward SBPP_CheckerClientBanCheckPost(int iClient), created in AskPluginLoad2 and fired from OnConnectBanCheck once counts are populated (before the PrintCheckOnConnect guard so it always runs). - Document the new -1 return contract and the forward in the include. Adapted to fork divergence: fork splits comms into separate mute/gag counts and uses SB_VERSION, so no manual VERSION bump; forward creation lives in the fork's AskPluginLoad2 alongside g_bLate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: DosMike <xanatosefan@gmx.de>
e688939 to
a6d3e3c
Compare
- SBPP_CheckerGetClientsComms returned -2 (the sum of two -1 sentinels) before the check resolved, breaking the "-1 if not yet available" contract the include now documents. Return -1 when either half is unavailable. - OnConnectBanCheck only assigns the mute/gag counters from optional FetchRow() branches. If the result set ever came back short, those stayed at -1 while the ban count was populated, making commcount negative and firing bogus "Comm Warning" prints (the `if (commcount)` truthiness test passes for -1/-2). Clear the sentinel on both counters once the check completes, so post-check values are always >= 0. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: DosMike <xanatosefan@gmx.de>
Review: port of sbpp#894 — approve after fixes (pushed as
|
Ports upstream sbpp#894 (which remains open upstream).
What
As a consumer of the SourceBans checker natives, you currently get stale
g_iBanCounts/g_iCommsCountsvalues between a client disconnect and theasync
OnConnectBanCheckcallback, with no signal that the data is valid yet.This change:
-1so the natives report "not yetavailable" rather than a previous client's numbers.
-1inOnClientDisconnect_Post.SBPP_CheckerClientBanCheckPost(int iClient), firedfrom
OnConnectBanCheckonce the counts are populated (placed before thePrintCheckOnConnectguard so it always runs).-1return contract and declares thenew forward.
Adaptations vs upstream
-1init and thedisconnect reset are applied to
g_iBanCounts,g_iMuteCountsandg_iGagCounts, and the-1doc note is added to all four natives.VERSIONfromSB_VERSION, so the upstream manual1.8.0 -> 1.8.1bump is dropped.AskPluginLoad2(next tog_bLate)rather than upstream's
AskPluginLoad.Testing
Relies on
plugin-buildCI (no local SourcePawn compiler).🤖 Generated with Claude Code