Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 360 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_bounty_system.sma
+304 -0
A
csb.json
+52 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-12-17) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Bounty</strong> turns credits into a hit list. A player types <code>/bounty <name> <amount></code> to spend their own money marking a target; admins can add a server bounty with <code>amx_bounty</code>. Bounties are stored per SteamID in a Trie, the current top bounty is shown in the HUD, and whoever kills the marked player collects the reward as cash. Placement, increases and claims are all announced in chat.</p><p>An <strong>anti-farm cooldown</strong> stops two players from trading a bounty back and forth: if the same killer kills the same victim again within the cooldown, the bounty is voided instead of paid. Bounties reset at the start of every round.</p><h2>Features</h2><ul><li><code>/bounty <name> <amount></code> paid from the placer's own money.</li><li><code>amx_bounty <name> <amount></code> for a free server bounty (admin flag <code>a</code>).</li><li>Per-SteamID storage in a Trie; top bounty shown in the HUD.</li><li>Reward paid via <code>cs_set_user_money</code>, capped at $16000.</li><li>Anti-farm cooldown voids repeat kills; bounties reset each round.</li></ul><h2>Installation</h2><ol><li>Enable the <code>cstrike</code> module in <code>modules.ini</code>.</li><li>Compile <code>csb_bounty_system.sma</code>, copy it to <code>addons/amxmodx/plugins/</code> and add it to <code>plugins.ini</code>.</li><li>Change the map.</li></ol> |
addons/amxmodx/scripting/csb_bounty_system.sma
A
| @@ -0,0 +1,304 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Bounty | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Players (or the server) can place a cash bounty on another player's head. | |
| 6 | + * Bounties are stored per SteamID in a Trie, shown in the HUD, announced on | |
| 7 | + * placement / increase / claim, and paid to whoever kills the target. An | |
| 8 | + * anti-farm cooldown blocks payouts for repeatedly killing the same victim. | |
| 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 <amxmisc> | |
| 20 | +#include <cstrike> | |
| 21 | + | |
| 22 | +new const PLUGIN[] = "CSB Bounty" | |
| 23 | +new const VERSION[] = "1.0.0" | |
| 24 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 25 | + | |
| 26 | +new Trie:g_tBounty | |
| 27 | +new g_pEnabled, g_pMin, g_pCooldown | |
| 28 | + | |
| 29 | +new g_szAuth[33][35] | |
| 30 | +new Float:g_fLastKill[33][33] | |
| 31 | +new g_iSync | |
| 32 | + | |
| 33 | +public plugin_init() | |
| 34 | +{ | |
| 35 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 36 | + | |
| 37 | + g_tBounty = TrieCreate() | |
| 38 | + | |
| 39 | + g_pEnabled = register_cvar("csb_bounty_enabled", "1") | |
| 40 | + g_pMin = register_cvar("csb_bounty_min", "500") | |
| 41 | + g_pCooldown = register_cvar("csb_bounty_cooldown", "45") | |
| 42 | + | |
| 43 | + register_clcmd("say", "cmdSay") | |
| 44 | + register_clcmd("say_team", "cmdSay") | |
| 45 | + | |
| 46 | + register_concmd("amx_bounty", "cmdAdminBounty", ADMIN_LEVEL_A, "<name> <amount> - place a server bounty") | |
| 47 | + | |
| 48 | + register_event("DeathMsg", "eventDeath", "a", "1>0") | |
| 49 | + register_logevent("eventRoundStart", 2, "1=Round_Start") | |
| 50 | + | |
| 51 | + g_iSync = CreateHudSyncObj() | |
| 52 | + set_task(1.0, "taskHud", 0, _, _, "b") | |
| 53 | +} | |
| 54 | + | |
| 55 | +public plugin_end() | |
| 56 | +{ | |
| 57 | + TrieDestroy(g_tBounty) | |
| 58 | +} | |
| 59 | + | |
| 60 | +public client_authorized(id) | |
| 61 | +{ | |
| 62 | + get_user_authid(id, g_szAuth[id], charsmax(g_szAuth[])) | |
| 63 | +} | |
| 64 | + | |
| 65 | +public client_disconnected(id) | |
| 66 | +{ | |
| 67 | + if (g_szAuth[id][0]) | |
| 68 | + TrieDeleteKey(g_tBounty, g_szAuth[id]) | |
| 69 | + | |
| 70 | + g_szAuth[id][0] = 0 | |
| 71 | +} | |
| 72 | + | |
| 73 | +getBounty(id) | |
| 74 | +{ | |
| 75 | + if (!g_szAuth[id][0]) | |
| 76 | + return 0 | |
| 77 | + | |
| 78 | + new amount | |
| 79 | + if (TrieGetCell(g_tBounty, g_szAuth[id], amount)) | |
| 80 | + return amount | |
| 81 | + | |
| 82 | + return 0 | |
| 83 | +} | |
| 84 | + | |
| 85 | +setBounty(id, amount) | |
| 86 | +{ | |
| 87 | + if (!g_szAuth[id][0]) | |
| 88 | + return | |
| 89 | + | |
| 90 | + if (amount <= 0) | |
| 91 | + TrieDeleteKey(g_tBounty, g_szAuth[id]) | |
| 92 | + else | |
| 93 | + TrieSetCell(g_tBounty, g_szAuth[id], amount) | |
| 94 | +} | |
| 95 | + | |
| 96 | +public cmdSay(id) | |
| 97 | +{ | |
| 98 | + new args[128] | |
| 99 | + read_args(args, charsmax(args)) | |
| 100 | + remove_quotes(args) | |
| 101 | + | |
| 102 | + if (containi(args, "/bounty") != 0) | |
| 103 | + return PLUGIN_CONTINUE | |
| 104 | + | |
| 105 | + if (!get_pcvar_num(g_pEnabled)) | |
| 106 | + { | |
| 107 | + client_print(id, print_chat, "[CSB] Bounties are disabled.") | |
| 108 | + return PLUGIN_HANDLED | |
| 109 | + } | |
| 110 | + | |
| 111 | + /* format: /bounty <name> <amount> */ | |
| 112 | + new rest[96] | |
| 113 | + copy(rest, charsmax(rest), args[7]) | |
| 114 | + trim(rest) | |
| 115 | + | |
| 116 | + new targetName[32], amountStr[16] | |
| 117 | + strtok(rest, targetName, charsmax(targetName), amountStr, charsmax(amountStr), ' ') | |
| 118 | + trim(targetName) | |
| 119 | + trim(amountStr) | |
| 120 | + | |
| 121 | + if (!targetName[0] || !amountStr[0]) | |
| 122 | + { | |
| 123 | + client_print(id, print_chat, "[CSB] Usage: /bounty <name> <amount>") | |
| 124 | + return PLUGIN_HANDLED | |
| 125 | + } | |
| 126 | + | |
| 127 | + new target = findByName(targetName) | |
| 128 | + | |
| 129 | + if (!target) | |
| 130 | + { | |
| 131 | + client_print(id, print_chat, "[CSB] No player matching '%s'.", targetName) | |
| 132 | + return PLUGIN_HANDLED | |
| 133 | + } | |
| 134 | + | |
| 135 | + if (target == id) | |
| 136 | + { | |
| 137 | + client_print(id, print_chat, "[CSB] You cannot put a bounty on yourself.") | |
| 138 | + return PLUGIN_HANDLED | |
| 139 | + } | |
| 140 | + | |
| 141 | + new amount = str_to_num(amountStr) | |
| 142 | + new minB = get_pcvar_num(g_pMin) | |
| 143 | + | |
| 144 | + if (amount < minB) | |
| 145 | + { | |
| 146 | + client_print(id, print_chat, "[CSB] Minimum bounty is $%d.", minB) | |
| 147 | + return PLUGIN_HANDLED | |
| 148 | + } | |
| 149 | + | |
| 150 | + new money = cs_get_user_money(id) | |
| 151 | + | |
| 152 | + if (money < amount) | |
| 153 | + { | |
| 154 | + client_print(id, print_chat, "[CSB] You only have $%d.", money) | |
| 155 | + return PLUGIN_HANDLED | |
| 156 | + } | |
| 157 | + | |
| 158 | + cs_set_user_money(id, money - amount) | |
| 159 | + | |
| 160 | + new was = getBounty(target) | |
| 161 | + setBounty(target, was + amount) | |
| 162 | + | |
| 163 | + new placer[32], victim[32] | |
| 164 | + get_user_name(id, placer, charsmax(placer)) | |
| 165 | + get_user_name(target, victim, charsmax(victim)) | |
| 166 | + | |
| 167 | + if (was > 0) | |
| 168 | + client_print(0, print_chat, "[CSB] %s raised the bounty on %s to $%d!", placer, victim, was + amount) | |
| 169 | + else | |
| 170 | + client_print(0, print_chat, "[CSB] %s placed a $%d bounty on %s!", placer, amount, victim) | |
| 171 | + | |
| 172 | + return PLUGIN_HANDLED | |
| 173 | +} | |
| 174 | + | |
| 175 | +public cmdAdminBounty(id, level, cid) | |
| 176 | +{ | |
| 177 | + if (!cmd_access(id, level, cid, 3)) | |
| 178 | + return PLUGIN_HANDLED | |
| 179 | + | |
| 180 | + new arg1[32], arg2[16] | |
| 181 | + read_argv(1, arg1, charsmax(arg1)) | |
| 182 | + read_argv(2, arg2, charsmax(arg2)) | |
| 183 | + | |
| 184 | + new target = findByName(arg1) | |
| 185 | + | |
| 186 | + if (!target) | |
| 187 | + { | |
| 188 | + console_print(id, "[CSB] No player matching '%s'.", arg1) | |
| 189 | + return PLUGIN_HANDLED | |
| 190 | + } | |
| 191 | + | |
| 192 | + new amount = str_to_num(arg2) | |
| 193 | + | |
| 194 | + if (amount <= 0) | |
| 195 | + { | |
| 196 | + console_print(id, "[CSB] Amount must be positive.") | |
| 197 | + return PLUGIN_HANDLED | |
| 198 | + } | |
| 199 | + | |
| 200 | + new was = getBounty(target) | |
| 201 | + setBounty(target, was + amount) | |
| 202 | + | |
| 203 | + new victim[32] | |
| 204 | + get_user_name(target, victim, charsmax(victim)) | |
| 205 | + client_print(0, print_chat, "[CSB] The server placed a $%d bounty on %s!", amount, victim) | |
| 206 | + return PLUGIN_HANDLED | |
| 207 | +} | |
| 208 | + | |
| 209 | +findByName(const name[]) | |
| 210 | +{ | |
| 211 | + new players[32], num | |
| 212 | + get_players(players, num, "ch") | |
| 213 | + | |
| 214 | + for (new i = 0; i < num; i++) | |
| 215 | + { | |
| 216 | + new pn[32] | |
| 217 | + get_user_name(players[i], pn, charsmax(pn)) | |
| 218 | + | |
| 219 | + if (containi(pn, name) != -1) | |
| 220 | + return players[i] | |
| 221 | + } | |
| 222 | + | |
| 223 | + return 0 | |
| 224 | +} | |
| 225 | + | |
| 226 | +public eventDeath() | |
| 227 | +{ | |
| 228 | + new killer = read_data(1) | |
| 229 | + new victim = read_data(2) | |
| 230 | + | |
| 231 | + if (victim < 1 || victim > 32) | |
| 232 | + return | |
| 233 | + | |
| 234 | + new reward = getBounty(victim) | |
| 235 | + | |
| 236 | + if (reward <= 0) | |
| 237 | + return | |
| 238 | + | |
| 239 | + if (killer < 1 || killer > 32 || killer == victim) | |
| 240 | + { | |
| 241 | + /* suicide / world: bounty stays */ | |
| 242 | + return | |
| 243 | + } | |
| 244 | + | |
| 245 | + /* anti-farm: same killer killing same victim too soon pays nothing */ | |
| 246 | + new Float:cd = get_pcvar_float(g_pCooldown) | |
| 247 | + | |
| 248 | + if (get_gametime() - g_fLastKill[killer][victim] < cd) | |
| 249 | + { | |
| 250 | + setBounty(victim, 0) | |
| 251 | + return | |
| 252 | + } | |
| 253 | + | |
| 254 | + g_fLastKill[killer][victim] = get_gametime() | |
| 255 | + | |
| 256 | + new money = cs_get_user_money(killer) | |
| 257 | + new give = money + reward | |
| 258 | + | |
| 259 | + if (give > 16000) | |
| 260 | + give = 16000 | |
| 261 | + | |
| 262 | + cs_set_user_money(killer, give) | |
| 263 | + setBounty(victim, 0) | |
| 264 | + | |
| 265 | + new kn[32], vn[32] | |
| 266 | + get_user_name(killer, kn, charsmax(kn)) | |
| 267 | + get_user_name(victim, vn, charsmax(vn)) | |
| 268 | + | |
| 269 | + client_print(0, print_chat, "[CSB] %s claimed the $%d bounty on %s!", kn, reward, vn) | |
| 270 | +} | |
| 271 | + | |
| 272 | +public eventRoundStart() | |
| 273 | +{ | |
| 274 | + TrieClear(g_tBounty) | |
| 275 | +} | |
| 276 | + | |
| 277 | +public taskHud() | |
| 278 | +{ | |
| 279 | + new best = 0, bestVal = 0 | |
| 280 | + | |
| 281 | + new players[32], num, pid | |
| 282 | + get_players(players, num, "ch") | |
| 283 | + | |
| 284 | + for (new i = 0; i < num; i++) | |
| 285 | + { | |
| 286 | + pid = players[i] | |
| 287 | + new b = getBounty(pid) | |
| 288 | + | |
| 289 | + if (b > bestVal) | |
| 290 | + { | |
| 291 | + bestVal = b | |
| 292 | + best = pid | |
| 293 | + } | |
| 294 | + } | |
| 295 | + | |
| 296 | + if (!best) | |
| 297 | + return | |
| 298 | + | |
| 299 | + new name[32] | |
| 300 | + get_user_name(best, name, charsmax(name)) | |
| 301 | + | |
| 302 | + set_hudmessage(255, 200, 0, 0.02, 0.20, 0, 0.0, 1.1, 0.0, 0.0, -1) | |
| 303 | + ShowSyncHudMsg(0, g_iSync, "TOP BOUNTY: %s - $%d", name, bestVal) | |
| 304 | +} |
csb.json
A
| @@ -0,0 +1,52 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Bounty", | |
| 3 | + "category": "fun", | |
| 4 | + "tags": "bounty, reward, hitman", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Bounty", | |
| 10 | + "short_desc": "Put a cash bounty on a player's head; it shows in the HUD and pays the killer, with an anti-farm cooldown.", | |
| 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": "cstrike", | |
| 20 | + "install_notes": "1. Enable the cstrike module in addons/amxmodx/configs/modules.ini\n2. Put csb_bounty_system.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "Other economy plugins that also set player money can interact oddly with bounty payouts.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_bounty_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Enable or disable player-placed bounties." | |
| 27 | + }, | |
| 28 | + { | |
| 29 | + "name": "csb_bounty_min", | |
| 30 | + "default": "500", | |
| 31 | + "description": "Minimum amount for a player-placed bounty." | |
| 32 | + }, | |
| 33 | + { | |
| 34 | + "name": "csb_bounty_cooldown", | |
| 35 | + "default": "45", | |
| 36 | + "description": "Seconds before the same killer can claim on the same victim again." | |
| 37 | + } | |
| 38 | + ], | |
| 39 | + "commands": [ | |
| 40 | + { | |
| 41 | + "name": "say /bounty <name> <amount>", | |
| 42 | + "access": "", | |
| 43 | + "description": "Spend your money to place a bounty on a player." | |
| 44 | + }, | |
| 45 | + { | |
| 46 | + "name": "amx_bounty", | |
| 47 | + "access": "a (ADMIN_LEVEL_A)", | |
| 48 | + "description": "amx_bounty <name> <amount> - place a free server bounty." | |
| 49 | + } | |
| 50 | + ], | |
| 51 | + "main": "addons/amxmodx/scripting/csb_bounty_system.sma" | |
| 52 | +} | |
| 0 | 53 |









