Active Ban Search 1.0.0 (olds.ro)
=================================
Admins search the active bans of an AMXBans database by part of a name or
by SteamID, and see when each ban was made, how long is left, the reason and
the admin. The query runs in a thread, so the server never waits for the
database.
Requirements
- AMX Mod X 1.10.0.5490 or newer, with the mysql module (sqlx)
- An AMXBans (6.x) ban table, <prefix>bans, with the columns player_nick,
player_id, ban_created, ban_length (minutes, 0 = permanent), ban_reason,
admin_nick and expired
Install
1. Compile scripting/olds_bansearch.sma and copy olds_bansearch.amxx to
addons/amxmodx/plugins/.
2. Copy data/lang/olds_bansearch.txt to addons/amxmodx/data/lang/.
3. Set the database cvars below (in olds_bansearch.cfg).
Settings (addons/amxmodx/configs/plugins/olds_bansearch.cfg, created on first run)
olds_bsearch_host "127.0.0.1" database host (host:port works too)
olds_bsearch_user "amxbans" user
olds_bsearch_pass "" password
olds_bsearch_db "amxbans" database
olds_bsearch_prefix "amx_" table prefix; letters, digits and _ only
olds_bsearch_max 20 most results per search (1-50)
The connection cvars are protected (not shown to clients).
Admin (ADMIN_BAN)
amx_banfind <text|STEAM_ID> 2 to 32 characters. A SteamID is matched
exactly; other text matches any part of the
name (or an exact SteamID).
Results: one line per ban in the console (name, SteamID, date, time left,
reason, admin) and a MOTD list; "nothing found" in chat and console.
One search at a time per admin, at most one every 2 seconds.
Active bans
expired = 0 AND (ban_length = 0 OR ban_created + ban_length * 60 >
UNIX_TIMESTAMP()), newest first.
Safety
- The text is escaped for LIKE (% and _ are matched literally) and then
for SQL with SQL_QuoteString; the table prefix is checked.
- A database that is down gives a clear "database error" in the console
and chat (and the log), and never stalls the server.
- Every search is written to the AMX log with the admin's name.
No downloads.