Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 313 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_spree_records.sma
+272 -0
A
csb.json
+37 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-09-06) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Spree Records</strong> tracks three records per player - best killstreak, longest headshot spree and highest single-round damage - and one server-wide record for each, all stored in nVault. When a server record falls, it is announced live in chat with a sound. <code>/records</code> opens a MOTD table with the holders and your personal bests.</p><h2>Features</h2><ul><li>Personal bests and server records side by side.</li><li>Live record-broken announcements (with a sane minimum so fresh servers are not spammed).</li><li>Survives restarts via nVault.</li></ul><h2>Installation</h2><ol><li>Enable the <code>hamsandwich</code> and <code>nvault</code> modules.</li><li>Compile, install, add to <code>plugins.ini</code>, change map.</li></ol> |
addons/amxmodx/scripting/csb_spree_records.sma
A
| @@ -0,0 +1,272 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Spree Records | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * A persistent hall of fame. The plugin tracks, per player, the best | |
| 6 | + * killstreak, the longest headshot spree and the highest single-round damage, | |
| 7 | + * all stored per SteamID in nVault. Server-wide records (with the holder's | |
| 8 | + * name) are kept in the same vault, announced live whenever they fall, and | |
| 9 | + * listed in a MOTD with /records. | |
| 10 | + * | |
| 11 | + * This program is free software: you can redistribute it and/or modify it under | |
| 12 | + * the terms of the GNU General Public License as published by the Free Software | |
| 13 | + * Foundation, either version 3 of the License, or (at your option) any later | |
| 14 | + * version. It is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details. | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#include <amxmodx> | |
| 20 | +#include <hamsandwich> | |
| 21 | +#include <nvault> | |
| 22 | + | |
| 23 | +new const PLUGIN[] = "CSB Spree Records" | |
| 24 | +new const VERSION[] = "1.0.0" | |
| 25 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 26 | + | |
| 27 | +enum Rec | |
| 28 | +{ | |
| 29 | + RC_STREAK = 0, | |
| 30 | + RC_HSSPREE, | |
| 31 | + RC_ROUNDDMG, | |
| 32 | + RC_MAX | |
| 33 | +} | |
| 34 | + | |
| 35 | +new g_iBest[33][RC_MAX] | |
| 36 | + | |
| 37 | +new g_iStreak[33] | |
| 38 | +new g_iHsSpree[33] | |
| 39 | +new g_iRoundDmg[33] | |
| 40 | + | |
| 41 | +/* server-wide hall of fame */ | |
| 42 | +new g_iHof[RC_MAX] | |
| 43 | +new g_szHofName[RC_MAX][32] | |
| 44 | + | |
| 45 | +new g_iVault | |
| 46 | + | |
| 47 | +public plugin_init() | |
| 48 | +{ | |
| 49 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 50 | + | |
| 51 | + register_cvar("csb_records_enabled", "1") | |
| 52 | + | |
| 53 | + register_event("DeathMsg", "onDeath", "a") | |
| 54 | + RegisterHam(Ham_TakeDamage, "player", "OnDamage", 1) | |
| 55 | + register_logevent("onRoundStart", 2, "1=Round_Start") | |
| 56 | + | |
| 57 | + register_clcmd("say /records", "cmdRecords") | |
| 58 | + register_clcmd("say_team /records", "cmdRecords") | |
| 59 | + | |
| 60 | + g_iVault = nvault_open("csb_records") | |
| 61 | + | |
| 62 | + loadHof() | |
| 63 | +} | |
| 64 | + | |
| 65 | +public plugin_end() | |
| 66 | +{ | |
| 67 | + if (g_iVault != -1) | |
| 68 | + nvault_close(g_iVault) | |
| 69 | +} | |
| 70 | + | |
| 71 | +public client_putinserver(id) | |
| 72 | +{ | |
| 73 | + g_iStreak[id] = 0 | |
| 74 | + g_iHsSpree[id] = 0 | |
| 75 | + g_iRoundDmg[id] = 0 | |
| 76 | + | |
| 77 | + for (new i = 0; i < RC_MAX; i++) | |
| 78 | + g_iBest[id][i] = 0 | |
| 79 | + | |
| 80 | + loadPlayer(id) | |
| 81 | +} | |
| 82 | + | |
| 83 | +public client_disconnect(id) | |
| 84 | +{ | |
| 85 | + savePlayer(id) | |
| 86 | +} | |
| 87 | + | |
| 88 | +public onRoundStart() | |
| 89 | +{ | |
| 90 | + for (new id = 1; id <= 32; id++) | |
| 91 | + g_iRoundDmg[id] = 0 | |
| 92 | +} | |
| 93 | + | |
| 94 | +public onDeath() | |
| 95 | +{ | |
| 96 | + new killer = read_data(1) | |
| 97 | + new victim = read_data(2) | |
| 98 | + new hs = read_data(3) | |
| 99 | + | |
| 100 | + if (victim >= 1 && victim <= 32) | |
| 101 | + { | |
| 102 | + g_iStreak[victim] = 0 | |
| 103 | + g_iHsSpree[victim] = 0 | |
| 104 | + } | |
| 105 | + | |
| 106 | + if (killer < 1 || killer > 32 || killer == victim) | |
| 107 | + return | |
| 108 | + | |
| 109 | + if (get_user_team(killer) == get_user_team(victim)) | |
| 110 | + return | |
| 111 | + | |
| 112 | + g_iStreak[killer]++ | |
| 113 | + | |
| 114 | + if (hs) | |
| 115 | + g_iHsSpree[killer]++ | |
| 116 | + else | |
| 117 | + g_iHsSpree[killer] = 0 | |
| 118 | + | |
| 119 | + new name[32] | |
| 120 | + get_user_name(killer, name, charsmax(name)) | |
| 121 | + | |
| 122 | + checkRecord(killer, RC_STREAK, g_iStreak[killer], name, "killstreak") | |
| 123 | + checkRecord(killer, RC_HSSPREE, g_iHsSpree[killer], name, "headshot spree") | |
| 124 | +} | |
| 125 | + | |
| 126 | +public OnDamage(victim, inflictor, attacker, Float:damage, damagetype) | |
| 127 | +{ | |
| 128 | + if (attacker < 1 || attacker > 32 || attacker == victim) | |
| 129 | + return HAM_IGNORED | |
| 130 | + | |
| 131 | + if (get_user_team(attacker) == get_user_team(victim)) | |
| 132 | + return HAM_IGNORED | |
| 133 | + | |
| 134 | + g_iRoundDmg[attacker] += floatround(damage) | |
| 135 | + | |
| 136 | + new name[32] | |
| 137 | + get_user_name(attacker, name, charsmax(name)) | |
| 138 | + checkRecord(attacker, RC_ROUNDDMG, g_iRoundDmg[attacker], name, "single-round damage") | |
| 139 | + | |
| 140 | + return HAM_IGNORED | |
| 141 | +} | |
| 142 | + | |
| 143 | +checkRecord(id, Rec:rec, value, const name[], const label[]) | |
| 144 | +{ | |
| 145 | + /* personal best */ | |
| 146 | + if (value > g_iBest[id][rec]) | |
| 147 | + { | |
| 148 | + g_iBest[id][rec] = value | |
| 149 | + savePlayer(id) | |
| 150 | + } | |
| 151 | + | |
| 152 | + /* server record: only announce from 3 kills / 300 dmg upwards */ | |
| 153 | + new minAnnounce = (rec == RC_ROUNDDMG) ? 300 : 3 | |
| 154 | + | |
| 155 | + if (value > g_iHof[rec] && value >= minAnnounce) | |
| 156 | + { | |
| 157 | + g_iHof[rec] = value | |
| 158 | + copy(g_szHofName[rec], charsmax(g_szHofName[]), name) | |
| 159 | + saveHof(rec) | |
| 160 | + | |
| 161 | + client_print(0, print_chat, "[CSB] NEW SERVER RECORD: %s sets %s to %d!", | |
| 162 | + name, label, value) | |
| 163 | + client_cmd(0, "spk buttons/bell1.wav") | |
| 164 | + } | |
| 165 | +} | |
| 166 | + | |
| 167 | +public cmdRecords(id) | |
| 168 | +{ | |
| 169 | + new motd[1024], len | |
| 170 | + | |
| 171 | + len = formatex(motd, charsmax(motd), | |
| 172 | + "<html><body bgcolor=#101010 text=#e0e0e0><h2>CSB Server Records</h2><table border=1 cellpadding=6><tr><th>Record</th><th>Holder</th><th>Value</th></tr>") | |
| 173 | + | |
| 174 | + len += formatex(motd[len], charsmax(motd) - len, | |
| 175 | + "<tr><td>Best killstreak</td><td>%s</td><td>%d</td></tr>", | |
| 176 | + g_szHofName[RC_STREAK], g_iHof[RC_STREAK]) | |
| 177 | + | |
| 178 | + len += formatex(motd[len], charsmax(motd) - len, | |
| 179 | + "<tr><td>Longest headshot spree</td><td>%s</td><td>%d</td></tr>", | |
| 180 | + g_szHofName[RC_HSSPREE], g_iHof[RC_HSSPREE]) | |
| 181 | + | |
| 182 | + len += formatex(motd[len], charsmax(motd) - len, | |
| 183 | + "<tr><td>Highest single-round damage</td><td>%s</td><td>%d</td></tr></table>", | |
| 184 | + g_szHofName[RC_ROUNDDMG], g_iHof[RC_ROUNDDMG]) | |
| 185 | + | |
| 186 | + len += formatex(motd[len], charsmax(motd) - len, | |
| 187 | + "<p>Your bests: streak %d, hs spree %d, round dmg %d</p></body></html>", | |
| 188 | + g_iBest[id][RC_STREAK], g_iBest[id][RC_HSSPREE], g_iBest[id][RC_ROUNDDMG]) | |
| 189 | + | |
| 190 | + show_motd(id, motd, "CSB Records") | |
| 191 | + return PLUGIN_HANDLED | |
| 192 | +} | |
| 193 | + | |
| 194 | +/* ---------- persistence ---------- */ | |
| 195 | + | |
| 196 | +loadHof() | |
| 197 | +{ | |
| 198 | + if (g_iVault == -1) | |
| 199 | + return | |
| 200 | + | |
| 201 | + for (new i = 0; i < RC_MAX; i++) | |
| 202 | + { | |
| 203 | + new key[16], data[48] | |
| 204 | + formatex(key, charsmax(key), "hof_%d", i) | |
| 205 | + | |
| 206 | + if (nvault_get(g_iVault, key, data, charsmax(data)) < 1) | |
| 207 | + { | |
| 208 | + copy(g_szHofName[i], charsmax(g_szHofName[]), "nobody") | |
| 209 | + continue | |
| 210 | + } | |
| 211 | + | |
| 212 | + new sval[12], sname[32] | |
| 213 | + parse(data, sval, charsmax(sval), sname, charsmax(sname)) | |
| 214 | + | |
| 215 | + g_iHof[i] = str_to_num(sval) | |
| 216 | + copy(g_szHofName[i], charsmax(g_szHofName[]), sname) | |
| 217 | + } | |
| 218 | +} | |
| 219 | + | |
| 220 | +saveHof(Rec:rec) | |
| 221 | +{ | |
| 222 | + if (g_iVault == -1) | |
| 223 | + return | |
| 224 | + | |
| 225 | + new key[16], data[48] | |
| 226 | + formatex(key, charsmax(key), "hof_%d", _:rec) | |
| 227 | + formatex(data, charsmax(data), "%d %s", g_iHof[rec], g_szHofName[rec]) | |
| 228 | + | |
| 229 | + nvault_set(g_iVault, key, data) | |
| 230 | +} | |
| 231 | + | |
| 232 | +loadPlayer(id) | |
| 233 | +{ | |
| 234 | + if (g_iVault == -1) | |
| 235 | + return | |
| 236 | + | |
| 237 | + new auth[36], key[44], data[48] | |
| 238 | + get_user_authid(id, auth, charsmax(auth)) | |
| 239 | + | |
| 240 | + if (auth[0] == 0 || equal(auth, "STEAM_ID_PENDING")) | |
| 241 | + return | |
| 242 | + | |
| 243 | + formatex(key, charsmax(key), "rec_%s", auth) | |
| 244 | + | |
| 245 | + if (nvault_get(g_iVault, key, data, charsmax(data)) < 1) | |
| 246 | + return | |
| 247 | + | |
| 248 | + new a[12], b[12], c[12] | |
| 249 | + parse(data, a, charsmax(a), b, charsmax(b), c, charsmax(c)) | |
| 250 | + | |
| 251 | + g_iBest[id][RC_STREAK] = str_to_num(a) | |
| 252 | + g_iBest[id][RC_HSSPREE] = str_to_num(b) | |
| 253 | + g_iBest[id][RC_ROUNDDMG] = str_to_num(c) | |
| 254 | +} | |
| 255 | + | |
| 256 | +savePlayer(id) | |
| 257 | +{ | |
| 258 | + if (g_iVault == -1) | |
| 259 | + return | |
| 260 | + | |
| 261 | + new auth[36], key[44], data[48] | |
| 262 | + get_user_authid(id, auth, charsmax(auth)) | |
| 263 | + | |
| 264 | + if (auth[0] == 0 || equal(auth, "STEAM_ID_PENDING")) | |
| 265 | + return | |
| 266 | + | |
| 267 | + formatex(key, charsmax(key), "rec_%s", auth) | |
| 268 | + formatex(data, charsmax(data), "%d %d %d", | |
| 269 | + g_iBest[id][RC_STREAK], g_iBest[id][RC_HSSPREE], g_iBest[id][RC_ROUNDDMG]) | |
| 270 | + | |
| 271 | + nvault_set(g_iVault, key, data) | |
| 272 | +} |
csb.json
A
| @@ -0,0 +1,37 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Spree Records", | |
| 3 | + "category": "stats", | |
| 4 | + "tags": "records, streak, hall of fame", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Spree Records", | |
| 10 | + "short_desc": "Persistent hall of fame for best killstreak, headshot spree and single-round damage, announced live when broken.", | |
| 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": "hamsandwich,nvault", | |
| 20 | + "install_notes": "1. Enable the nvault module in addons/amxmodx/configs/modules.ini\n2. Compile the .sma, put the .amxx in addons/amxmodx/plugins/\n3. Add it to plugins.ini and change map", | |
| 21 | + "known_conflicts": "", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_records_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Reserved enable toggle." | |
| 27 | + } | |
| 28 | + ], | |
| 29 | + "commands": [ | |
| 30 | + { | |
| 31 | + "name": "say /records", | |
| 32 | + "access": "", | |
| 33 | + "description": "Open the records MOTD." | |
| 34 | + } | |
| 35 | + ], | |
| 36 | + "main": "addons/amxmodx/scripting/csb_spree_records.sma" | |
| 37 | +} | |
| 0 | 38 |









