Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 248 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_mvp_round.sma
+207 -0
A
csb.json
+37 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-05-23) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Round MVP</strong> scores every player's contribution to the round - 100 points per kill, 1 point per damage point, 300 for a bomb plant or defuse - and announces the MVP at round end in chat, HUD and sound. Awards are counted per SteamID in nVault and shown with <code>/mvp</code>.</p><h2>Features</h2><ul><li>Damage tracked via Ham_TakeDamage, objectives via the bomb log events.</li><li>Team damage never scores.</li><li>Persistent MVP counter per player.</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_mvp_round.sma
A
| @@ -0,0 +1,207 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Round MVP | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Scores every player's contribution to the round - 100 points per kill, 1 | |
| 6 | + * per damage point, 300 for a bomb plant, 300 for a defuse - and announces | |
| 7 | + * the round MVP at round end in chat, HUD and sound. MVP awards are counted | |
| 8 | + * per SteamID in nVault and shown with /mvp. | |
| 9 | + * | |
| 10 | + * This program is free software: you can redistribute it and/or modify it under | |
| 11 | + * the terms of the GNU General Public License as published by the Free Software | |
| 12 | + * Foundation, either version 3 of the License, or (at your option) any later | |
| 13 | + * version. It is distributed in the hope that it will be useful, but WITHOUT | |
| 14 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 15 | + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details. | |
| 16 | + */ | |
| 17 | + | |
| 18 | +#include <amxmodx> | |
| 19 | +#include <hamsandwich> | |
| 20 | +#include <nvault> | |
| 21 | + | |
| 22 | +new const PLUGIN[] = "CSB Round MVP" | |
| 23 | +new const VERSION[] = "1.0.0" | |
| 24 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 25 | + | |
| 26 | +new g_iKills[33] | |
| 27 | +new g_iDamage[33] | |
| 28 | +new g_iObjective[33] | |
| 29 | +new g_iMvps[33] | |
| 30 | + | |
| 31 | +new g_iVault | |
| 32 | + | |
| 33 | +public plugin_init() | |
| 34 | +{ | |
| 35 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 36 | + | |
| 37 | + register_cvar("csb_mvp_enabled", "1") | |
| 38 | + | |
| 39 | + register_event("DeathMsg", "onDeath", "a") | |
| 40 | + RegisterHam(Ham_TakeDamage, "player", "OnDamage", 1) | |
| 41 | + register_logevent("onRoundEnd", 2, "1=Round_End") | |
| 42 | + register_logevent("onRoundStart", 2, "1=Round_Start") | |
| 43 | + register_logevent("onPlant", 3, "2=Planted_The_Bomb") | |
| 44 | + register_logevent("onDefuse", 3, "2=Defused_The_Bomb") | |
| 45 | + | |
| 46 | + register_clcmd("say /mvp", "cmdMvp") | |
| 47 | + register_clcmd("say_team /mvp", "cmdMvp") | |
| 48 | + | |
| 49 | + g_iVault = nvault_open("csb_mvp") | |
| 50 | +} | |
| 51 | + | |
| 52 | +public plugin_end() | |
| 53 | +{ | |
| 54 | + if (g_iVault != -1) | |
| 55 | + nvault_close(g_iVault) | |
| 56 | +} | |
| 57 | + | |
| 58 | +public client_putinserver(id) | |
| 59 | +{ | |
| 60 | + g_iKills[id] = 0 | |
| 61 | + g_iDamage[id] = 0 | |
| 62 | + g_iObjective[id] = 0 | |
| 63 | + g_iMvps[id] = 0 | |
| 64 | + | |
| 65 | + loadPlayer(id) | |
| 66 | +} | |
| 67 | + | |
| 68 | +public client_disconnect(id) | |
| 69 | +{ | |
| 70 | + savePlayer(id) | |
| 71 | +} | |
| 72 | + | |
| 73 | +public onRoundStart() | |
| 74 | +{ | |
| 75 | + for (new id = 1; id <= 32; id++) | |
| 76 | + { | |
| 77 | + g_iKills[id] = 0 | |
| 78 | + g_iDamage[id] = 0 | |
| 79 | + g_iObjective[id] = 0 | |
| 80 | + } | |
| 81 | +} | |
| 82 | + | |
| 83 | +public onDeath() | |
| 84 | +{ | |
| 85 | + new killer = read_data(1) | |
| 86 | + new victim = read_data(2) | |
| 87 | + | |
| 88 | + if (killer < 1 || killer > 32 || killer == victim) | |
| 89 | + return | |
| 90 | + | |
| 91 | + if (get_user_team(killer) == get_user_team(victim)) | |
| 92 | + return | |
| 93 | + | |
| 94 | + g_iKills[killer]++ | |
| 95 | +} | |
| 96 | + | |
| 97 | +public OnDamage(victim, inflictor, attacker, Float:damage, damagetype) | |
| 98 | +{ | |
| 99 | + if (attacker < 1 || attacker > 32 || attacker == victim) | |
| 100 | + return HAM_IGNORED | |
| 101 | + | |
| 102 | + if (get_user_team(attacker) == get_user_team(victim)) | |
| 103 | + return HAM_IGNORED | |
| 104 | + | |
| 105 | + g_iDamage[attacker] += floatround(damage) | |
| 106 | + | |
| 107 | + return HAM_IGNORED | |
| 108 | +} | |
| 109 | + | |
| 110 | +public onPlant() | |
| 111 | +{ | |
| 112 | + new id = logUserId() | |
| 113 | + | |
| 114 | + if (id) | |
| 115 | + g_iObjective[id] += 300 | |
| 116 | +} | |
| 117 | + | |
| 118 | +public onDefuse() | |
| 119 | +{ | |
| 120 | + new id = logUserId() | |
| 121 | + | |
| 122 | + if (id) | |
| 123 | + g_iObjective[id] += 300 | |
| 124 | +} | |
| 125 | + | |
| 126 | +public onRoundEnd() | |
| 127 | +{ | |
| 128 | + new best = 0, bestScore = 0, bestKills = 0, bestDmg = 0 | |
| 129 | + | |
| 130 | + for (new id = 1; id <= 32; id++) | |
| 131 | + { | |
| 132 | + if (!is_user_connected(id)) | |
| 133 | + continue | |
| 134 | + | |
| 135 | + new score = g_iKills[id] * 100 + g_iDamage[id] + g_iObjective[id] | |
| 136 | + | |
| 137 | + if (score > bestScore) | |
| 138 | + { | |
| 139 | + bestScore = score | |
| 140 | + best = id | |
| 141 | + bestKills = g_iKills[id] | |
| 142 | + bestDmg = g_iDamage[id] | |
| 143 | + } | |
| 144 | + } | |
| 145 | + | |
| 146 | + if (best < 1 || bestScore < 100) | |
| 147 | + return | |
| 148 | + | |
| 149 | + g_iMvps[best]++ | |
| 150 | + savePlayer(best) | |
| 151 | + | |
| 152 | + new name[32] | |
| 153 | + get_user_name(best, name, charsmax(name)) | |
| 154 | + | |
| 155 | + client_print(0, print_chat, "[CSB] Round MVP: %s (%d kills, %d dmg, %d pts - total MVPs: %d)", | |
| 156 | + name, bestKills, bestDmg, bestScore, g_iMvps[best]) | |
| 157 | + client_cmd(0, "spk buttons/blip1.wav") | |
| 158 | + | |
| 159 | + set_hudmessage(80, 160, 255, -1.0, 0.28, 0, 0.0, 4.0, 0.5, 0.5, 2) | |
| 160 | + show_hudmessage(0, "MVP: %s", name) | |
| 161 | +} | |
| 162 | + | |
| 163 | +public cmdMvp(id) | |
| 164 | +{ | |
| 165 | + client_print(id, print_chat, "[CSB] You have been round MVP %d time(s).", g_iMvps[id]) | |
| 166 | + return PLUGIN_HANDLED | |
| 167 | +} | |
| 168 | + | |
| 169 | +logUserId() | |
| 170 | +{ | |
| 171 | + new text[160], name[32], userid | |
| 172 | + read_logdata(text, charsmax(text)) | |
| 173 | + parse_loguser(text, name, charsmax(name), userid) | |
| 174 | + | |
| 175 | + return find_player("k", userid) | |
| 176 | +} | |
| 177 | + | |
| 178 | +loadPlayer(id) | |
| 179 | +{ | |
| 180 | + if (g_iVault == -1) | |
| 181 | + return | |
| 182 | + | |
| 183 | + new auth[36], key[44] | |
| 184 | + get_user_authid(id, auth, charsmax(auth)) | |
| 185 | + | |
| 186 | + if (auth[0] == 0 || equal(auth, "STEAM_ID_PENDING")) | |
| 187 | + return | |
| 188 | + | |
| 189 | + formatex(key, charsmax(key), "mvp_%s", auth) | |
| 190 | + g_iMvps[id] = nvault_get(g_iVault, key) | |
| 191 | +} | |
| 192 | + | |
| 193 | +savePlayer(id) | |
| 194 | +{ | |
| 195 | + if (g_iVault == -1) | |
| 196 | + return | |
| 197 | + | |
| 198 | + new auth[36], key[44], val[12] | |
| 199 | + get_user_authid(id, auth, charsmax(auth)) | |
| 200 | + | |
| 201 | + if (auth[0] == 0 || equal(auth, "STEAM_ID_PENDING")) | |
| 202 | + return | |
| 203 | + | |
| 204 | + formatex(key, charsmax(key), "mvp_%s", auth) | |
| 205 | + num_to_str(g_iMvps[id], val, charsmax(val)) | |
| 206 | + nvault_set(g_iVault, key, val) | |
| 207 | +} |
csb.json
A
| @@ -0,0 +1,37 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Round MVP", | |
| 3 | + "category": "stats", | |
| 4 | + "tags": "mvp, round, award", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Round MVP", | |
| 10 | + "short_desc": "Scores kills, damage and objective play each round and announces the round MVP; persistent MVP counter.", | |
| 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_mvp_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Reserved enable toggle." | |
| 27 | + } | |
| 28 | + ], | |
| 29 | + "commands": [ | |
| 30 | + { | |
| 31 | + "name": "say /mvp", | |
| 32 | + "access": "", | |
| 33 | + "description": "Show how many times you have been round MVP." | |
| 34 | + } | |
| 35 | + ], | |
| 36 | + "main": "addons/amxmodx/scripting/csb_mvp_round.sma" | |
| 37 | +} | |
| 0 | 38 |









