Prodvigat server
csb-admin-logger / README.md
1 lines 1.7 KiB Markdown Source Rendered Raw Permalink History
<p><strong>CSB Admin Logger</strong> keeps an audit trail of what admins do. It watches the common commands &mdash; <code>amx_kick</code>, <code>amx_ban</code>, <code>amx_banip</code>, <code>amx_gag</code>, <code>amx_slay</code>, <code>amx_slap</code>, <code>amx_map</code> &mdash; and records the admin's name and SteamID, the target/args, the current map and a timestamp into a MySQL table using <strong>threaded SQLx</strong>, so the game thread never blocks on the database. If the DB is unreachable it falls back to a flat log file, and it exposes a <code>csb_log_action()</code> native other CSB admin plugins can call to record their own actions.</p><h2>Features</h2><ul><li>Watches the standard admin commands without swallowing them (they still run normally).</li><li>Threaded inserts through <code>SQL_ThreadQuery</code> &mdash; no lag spike on a slow database.</li><li>Automatic flat-file fallback (<code>addons/amxmodx/logs/csb_admin_actions.log</code>) when SQL fails.</li><li><code>native csb_log_action(const admin_auth[], const admin_name[], const target[], const action[])</code> for other plugins.</li><li>All string fields are sanitised before they reach the query.</li></ul><h2>Installation</h2><ol><li>Enable the <code>sqlx</code> module in <code>addons/amxmodx/configs/modules.ini</code>.</li><li>Set <code>csb_log_sql_host/user/pass/db</code> (in <code>amxx.cfg</code> or a server cfg). Leave them empty to use file logging only.</li><li>Compile <code>csb_admin_logger.sma</code>, copy it to <code>addons/amxmodx/plugins/</code>, add it to <code>plugins.ini</code> and change the map.</li></ol><p>The <code>csb_admin_log</code> table is created automatically on first load if it does not exist.</p>