Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 205 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_steamid_validator.sma
+155 -0
A
csb.json
+46 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2026-05-24) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB SteamID Validator</strong> enforces clean authentication on entry. At <code>client_authorized</code> it inspects the SteamID and rejects the ones that shouldn't be playing: IDs stuck at <code>STEAM_ID_PENDING</code> past a timeout, LAN and no-steam tokens, strings that don't match the <code>STEAM_x:y:z</code> shape, and any SteamID already present on the server (the duplicate-ID trick used by some no-steam clients).</p><h2>Features</h2><ul><li>Pending IDs are re-checked after <code>csb_steamid_pending_timeout</code> seconds instead of being judged instantly.</li><li>Strict <code>STEAM_x:y:z</code> format check - exactly two colons, digits only after the prefix.</li><li>Duplicate-SteamID detection across all connected humans.</li><li><code>csb_steamid_allow_nosteam</code> lets you run a no-steam-friendly server while still blocking duplicates and malformed IDs.</li><li>Every rejection is logged with name, IP and the offending ID.</li></ul><h2>Installation</h2><ol><li>Compile <code>csb_steamid_validator.sma</code> and copy it to <code>addons/amxmodx/plugins/</code>.</li><li>Add it to <code>plugins.ini</code> and change the map.</li></ol><p>On a legitimate no-steam server running Reunion or dproto, set <code>csb_steamid_allow_nosteam 1</code> so real players with non-Steam IDs are not kicked, while duplicates are still blocked.</p> |
addons/amxmodx/scripting/csb_steamid_validator.sma
A
| @@ -0,0 +1,155 @@ | ||
| 1 | +/* | |
| 2 | + * CSB SteamID Validator | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Validates authentication at client_authorized: rejects pending IDs past a | |
| 6 | + * timeout, LAN/no-steam tokens, malformed STEAM_x:y:z strings and duplicate | |
| 7 | + * SteamIDs, with a cvar to allow or kick no-steam clients. | |
| 8 | + * | |
| 9 | + * This program is free software: you can redistribute it and/or modify it under | |
| 10 | + * the terms of the GNU General Public License as published by the Free Software | |
| 11 | + * Foundation, either version 3 of the License, or (at your option) any later | |
| 12 | + * version. It is distributed in the hope that it will be useful, but WITHOUT | |
| 13 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 14 | + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +#include <amxmodx> | |
| 18 | + | |
| 19 | +new const PLUGIN[] = "CSB SteamID Validator" | |
| 20 | +new const VERSION[] = "1.0.0" | |
| 21 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 22 | + | |
| 23 | +#define TASK_BASE 10000 | |
| 24 | + | |
| 25 | +new g_pEnabled, g_pAllowNoSteam, g_pPendingTimeout, g_pBlockDup | |
| 26 | + | |
| 27 | +public plugin_init() | |
| 28 | +{ | |
| 29 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 30 | + | |
| 31 | + g_pEnabled = register_cvar("csb_steamid_enabled", "1") | |
| 32 | + g_pAllowNoSteam = register_cvar("csb_steamid_allow_nosteam", "0") | |
| 33 | + g_pPendingTimeout = register_cvar("csb_steamid_pending_timeout", "30") | |
| 34 | + g_pBlockDup = register_cvar("csb_steamid_block_dup", "1") | |
| 35 | +} | |
| 36 | + | |
| 37 | +public client_authorized(id) | |
| 38 | +{ | |
| 39 | + if (!get_pcvar_num(g_pEnabled) || is_user_bot(id) || is_user_hltv(id)) | |
| 40 | + return | |
| 41 | + | |
| 42 | + new authid[40] | |
| 43 | + get_user_authid(id, authid, charsmax(authid)) | |
| 44 | + | |
| 45 | + // still resolving -> re-check after the timeout | |
| 46 | + if (!authid[0] || equal(authid, "STEAM_ID_PENDING")) | |
| 47 | + { | |
| 48 | + set_task(float(get_pcvar_num(g_pPendingTimeout)), "taskPending", TASK_BASE + id) | |
| 49 | + return | |
| 50 | + } | |
| 51 | + | |
| 52 | + validate(id, authid) | |
| 53 | +} | |
| 54 | + | |
| 55 | +public taskPending(taskid) | |
| 56 | +{ | |
| 57 | + new id = taskid - TASK_BASE | |
| 58 | + | |
| 59 | + if (id < 1 || id > 32 || !is_user_connected(id)) | |
| 60 | + return | |
| 61 | + | |
| 62 | + new authid[40] | |
| 63 | + get_user_authid(id, authid, charsmax(authid)) | |
| 64 | + | |
| 65 | + validate(id, authid) | |
| 66 | +} | |
| 67 | + | |
| 68 | +validate(id, const authid[]) | |
| 69 | +{ | |
| 70 | + // still pending or an obvious no-steam / LAN token | |
| 71 | + if (!authid[0] | |
| 72 | + || equal(authid, "STEAM_ID_PENDING") | |
| 73 | + || equal(authid, "VALVE_ID_PENDING") | |
| 74 | + || equal(authid, "STEAM_ID_LAN") | |
| 75 | + || equal(authid, "VALVE_ID_LAN") | |
| 76 | + || equal(authid, "HLTV")) | |
| 77 | + { | |
| 78 | + if (get_pcvar_num(g_pAllowNoSteam)) | |
| 79 | + return | |
| 80 | + | |
| 81 | + drop(id, authid, "no valid Steam ID") | |
| 82 | + return | |
| 83 | + } | |
| 84 | + | |
| 85 | + if (!isSteamFormat(authid)) | |
| 86 | + { | |
| 87 | + if (get_pcvar_num(g_pAllowNoSteam)) | |
| 88 | + return | |
| 89 | + | |
| 90 | + drop(id, authid, "malformed Steam ID") | |
| 91 | + return | |
| 92 | + } | |
| 93 | + | |
| 94 | + if (get_pcvar_num(g_pBlockDup) && isDuplicate(id, authid)) | |
| 95 | + { | |
| 96 | + drop(id, authid, "duplicate Steam ID") | |
| 97 | + return | |
| 98 | + } | |
| 99 | +} | |
| 100 | + | |
| 101 | +bool:isSteamFormat(const s[]) | |
| 102 | +{ | |
| 103 | + // expect STEAM_x:y:z | |
| 104 | + if (strlen(s) < 11) | |
| 105 | + return false | |
| 106 | + | |
| 107 | + if (!equal(s, "STEAM_", 6)) | |
| 108 | + return false | |
| 109 | + | |
| 110 | + new colons = 0 | |
| 111 | + | |
| 112 | + for (new i = 6; s[i]; i++) | |
| 113 | + { | |
| 114 | + if (s[i] == ':') | |
| 115 | + colons++ | |
| 116 | + else if (s[i] < '0' || s[i] > '9') | |
| 117 | + return false | |
| 118 | + } | |
| 119 | + | |
| 120 | + return colons == 2 | |
| 121 | +} | |
| 122 | + | |
| 123 | +bool:isDuplicate(id, const authid[]) | |
| 124 | +{ | |
| 125 | + new players[32], num | |
| 126 | + get_players(players, num) | |
| 127 | + | |
| 128 | + for (new i = 0; i < num; i++) | |
| 129 | + { | |
| 130 | + new pid = players[i] | |
| 131 | + | |
| 132 | + if (pid == id || is_user_bot(pid) || is_user_hltv(pid)) | |
| 133 | + continue | |
| 134 | + | |
| 135 | + new other[40] | |
| 136 | + get_user_authid(pid, other, charsmax(other)) | |
| 137 | + | |
| 138 | + if (equal(other, authid)) | |
| 139 | + return true | |
| 140 | + } | |
| 141 | + | |
| 142 | + return false | |
| 143 | +} | |
| 144 | + | |
| 145 | +drop(id, const authid[], const reason[]) | |
| 146 | +{ | |
| 147 | + new name[32], ip[24] | |
| 148 | + get_user_name(id, name, charsmax(name)) | |
| 149 | + get_user_ip(id, ip, charsmax(ip), 1) | |
| 150 | + | |
| 151 | + log_amx("[CSB SteamID] rejecting %s (%s) <%s>: %s", name, ip, authid, reason) | |
| 152 | + | |
| 153 | + server_cmd("kick #%d ^"CSB: %s^"", get_user_userid(id), reason) | |
| 154 | + server_exec() | |
| 155 | +} |
csb.json
A
| @@ -0,0 +1,46 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB SteamID Validator", | |
| 3 | + "category": "anticheat", | |
| 4 | + "tags": "steamid, validation, nosteam", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB SteamID Validator", | |
| 10 | + "short_desc": "Rejects pending, LAN, malformed and duplicate SteamIDs at authorization, with a no-steam allow switch.", | |
| 11 | + "version": "1.0.0", | |
| 12 | + "amxx_min": "1.9", | |
| 13 | + "amxx_compile_default": "1.9", | |
| 14 | + "rehlds_ok": true, | |
| 15 | + "hlds_ok": true, | |
| 16 | + "regamedll_required": false, | |
| 17 | + "metamod_flavor": "any", | |
| 18 | + "reapi_required": false, | |
| 19 | + "modules": "", | |
| 20 | + "install_notes": "1. Put csb_steamid_validator.amxx in addons/amxmodx/plugins/\n2. Add it to addons/amxmodx/configs/plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "On no-steam servers leave csb_steamid_allow_nosteam at 1, otherwise every non-Steam player is kicked.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_steamid_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Enable SteamID validation." | |
| 27 | + }, | |
| 28 | + { | |
| 29 | + "name": "csb_steamid_allow_nosteam", | |
| 30 | + "default": "0", | |
| 31 | + "description": "1 = allow LAN/no-steam IDs (still blocks duplicates)." | |
| 32 | + }, | |
| 33 | + { | |
| 34 | + "name": "csb_steamid_pending_timeout", | |
| 35 | + "default": "30", | |
| 36 | + "description": "Seconds to wait for a pending ID to resolve before judging it." | |
| 37 | + }, | |
| 38 | + { | |
| 39 | + "name": "csb_steamid_block_dup", | |
| 40 | + "default": "1", | |
| 41 | + "description": "Kick a client whose SteamID is already in game." | |
| 42 | + } | |
| 43 | + ], | |
| 44 | + "commands": [], | |
| 45 | + "main": "addons/amxmodx/scripting/csb_steamid_validator.sma" | |
| 46 | +} | |
| 0 | 47 |









