You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit eda2a45
Browse filesBrowse the repository at this point in the historyBrowse files
feat: add SBPP_BanPlayerBySteamId native for offline player bans (#1511)
* feat: add SBPP_BanPlayerBySteamId native for offline player bans
SBPP_BanPlayer requires an in-game client index, making it impossible
to ban players who disconnect before an automated ban fires. The new
native accepts a SteamID string and player name directly, allowing
plugins to record a ban in the SBPP database for players who are no
longer connected.
Implementation:
- Checks for an existing active ban first (duplicate-prevention SELECT)
- Inserts into sb_bans with length in seconds (iTime * 60) and the
IFNULL admin-lookup subquery, matching the pattern used by CommandAddBan
- Uses a server-lookup subquery when serverID == -1 (unregistered), or
the cached serverID directly
- Fires SBPP_OnBanPlayer with iTarget = -1 to signal an offline ban
sourcebanspp.inc:
- Declares the new native with full doc comment
- Adds MarkNativeAsOptional in __pl_sourcebanspp_SetNTVOptional
* fix: validate SteamID2 format before inserting ban
SBPP enforces bans on connect using AuthId_Steam2. If a caller passed
a SteamID64 or SteamID3 the ban would be stored but never fire.
Now throws a native error immediately if the steamId argument does not
start with 'STEAM_'.
Addresses review comment from rumblefrog on PR #1511.
* fix: only fire SBPP_OnBanPlayer after the ban INSERT succeeds
Addresses review nit on PR #1511 (rumblefrog): the forward was fired
synchronously right after issuing the async duplicate-check SELECT,
before the ban row was ever written. It now fires from
DB_OnBanBySteamIdInsert only when the INSERT query succeeds.
* fix: harden offline SteamID ban native
---------
Co-authored-by: rumblefrog <contact@zhenyangli.me>
FormatEx(query, sizeof(query), "SELECT bid FROM %s_bans WHERE type = 0 AND (authid = '%s' OR authid REGEXP '^STEAM_[0-9]:%s$') AND (length = 0 OR ends > UNIX_TIMESTAMP()) AND RemoveType IS NULL",
0 commit comments