Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 161 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_random_weapon_round.sma
+126 -0
A
csb.json
+31 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2026-02-08) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Random Weapon Round</strong> levels the field each round. Everyone is stripped and handed the same randomly chosen primary and secondary weapon from a configurable pool, with full reserve ammo and a knife. The picked loadout is announced in chat, and buying is disabled so the round is fought with the weapon fate dealt.</p><h2>Features</h2><ul><li>Same random primary + secondary for the whole server each round.</li><li>Full reserve ammo on spawn.</li><li>Buying disabled.</li><li>Loadout announced by name in chat.</li></ul><h2>Installation</h2><ol><li>Enable the <code>hamsandwich</code>, <code>cstrike</code> and <code>fun</code> modules in <code>modules.ini</code>.</li><li>Compile <code>csb_random_weapon_round.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_random_weapon_round.sma
A
| @@ -0,0 +1,126 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Random Weapon Round | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Every round the whole server is stripped and handed the same randomly chosen | |
| 6 | + * primary and secondary weapon from a configurable pool, with full reserve ammo | |
| 7 | + * and a knife. The picked loadout is announced in chat, and buying is disabled so | |
| 8 | + * everyone fights with the round's weapon. | |
| 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 <cstrike> | |
| 21 | +#include <fun> | |
| 22 | + | |
| 23 | +new const PLUGIN[] = "CSB Random Weapon Round" | |
| 24 | +new const VERSION[] = "1.0.0" | |
| 25 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 26 | + | |
| 27 | +new const g_szPrimary[][] = | |
| 28 | +{ | |
| 29 | + "weapon_ak47", "weapon_m4a1", "weapon_awp", "weapon_mp5navy", | |
| 30 | + "weapon_xm1014", "weapon_p90", "weapon_famas", "weapon_galil" | |
| 31 | +} | |
| 32 | +new const g_iPrimaryCSW[] = | |
| 33 | +{ | |
| 34 | + CSW_AK47, CSW_M4A1, CSW_AWP, CSW_MP5NAVY, | |
| 35 | + CSW_XM1014, CSW_P90, CSW_FAMAS, CSW_GALIL | |
| 36 | +} | |
| 37 | +new const g_iPrimaryAmmo[] = | |
| 38 | +{ | |
| 39 | + 90, 90, 30, 120, | |
| 40 | + 32, 100, 90, 90 | |
| 41 | +} | |
| 42 | + | |
| 43 | +new const g_szSecondary[][] = | |
| 44 | +{ | |
| 45 | + "weapon_deagle", "weapon_usp", "weapon_glock18", "weapon_p228", "weapon_fiveseven" | |
| 46 | +} | |
| 47 | +new const g_iSecondaryCSW[] = | |
| 48 | +{ | |
| 49 | + CSW_DEAGLE, CSW_USP, CSW_GLOCK18, CSW_P228, CSW_FIVESEVEN | |
| 50 | +} | |
| 51 | +new const g_iSecondaryAmmo[] = | |
| 52 | +{ | |
| 53 | + 35, 24, 40, 26, 50 | |
| 54 | +} | |
| 55 | + | |
| 56 | +new g_pEnabled | |
| 57 | +new g_iPrimary, g_iSecondary | |
| 58 | + | |
| 59 | +public plugin_init() | |
| 60 | +{ | |
| 61 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 62 | + | |
| 63 | + g_pEnabled = register_cvar("csb_rwr_enabled", "1") | |
| 64 | + | |
| 65 | + RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1) | |
| 66 | + register_logevent("eventRoundStart", 2, "1=Round_Start") | |
| 67 | + | |
| 68 | + register_clcmd("buy", "blockBuy") | |
| 69 | + register_clcmd("buyammo", "blockBuy") | |
| 70 | +} | |
| 71 | + | |
| 72 | +public eventRoundStart() | |
| 73 | +{ | |
| 74 | + if (!get_pcvar_num(g_pEnabled)) | |
| 75 | + return | |
| 76 | + | |
| 77 | + g_iPrimary = random_num(0, sizeof(g_szPrimary) - 1) | |
| 78 | + g_iSecondary = random_num(0, sizeof(g_szSecondary) - 1) | |
| 79 | + | |
| 80 | + new p[24], s[24] | |
| 81 | + prettyName(g_szPrimary[g_iPrimary], p, charsmax(p)) | |
| 82 | + prettyName(g_szSecondary[g_iSecondary], s, charsmax(s)) | |
| 83 | + | |
| 84 | + client_print(0, print_chat, "^x04[Weapons]^x01 This round: %s + %s!", p, s) | |
| 85 | +} | |
| 86 | + | |
| 87 | +prettyName(const cls[], out[], len) | |
| 88 | +{ | |
| 89 | + /* strip the "weapon_" prefix and upper-case it */ | |
| 90 | + copy(out, len, cls[7]) | |
| 91 | + new n = strlen(out) | |
| 92 | + for (new i = 0; i < n; i++) | |
| 93 | + { | |
| 94 | + if (out[i] >= 'a' && out[i] <= 'z') | |
| 95 | + out[i] -= 32 | |
| 96 | + } | |
| 97 | +} | |
| 98 | + | |
| 99 | +public fwSpawnPost(id) | |
| 100 | +{ | |
| 101 | + if (get_pcvar_num(g_pEnabled) && is_user_alive(id)) | |
| 102 | + set_task(0.2, "taskEquip", id) | |
| 103 | +} | |
| 104 | + | |
| 105 | +public taskEquip(id) | |
| 106 | +{ | |
| 107 | + if (!is_user_alive(id) || !get_pcvar_num(g_pEnabled)) | |
| 108 | + return | |
| 109 | + | |
| 110 | + strip_user_weapons(id) | |
| 111 | + give_item(id, "weapon_knife") | |
| 112 | + | |
| 113 | + give_item(id, g_szPrimary[g_iPrimary]) | |
| 114 | + cs_set_user_bpammo(id, g_iPrimaryCSW[g_iPrimary], g_iPrimaryAmmo[g_iPrimary]) | |
| 115 | + | |
| 116 | + give_item(id, g_szSecondary[g_iSecondary]) | |
| 117 | + cs_set_user_bpammo(id, g_iSecondaryCSW[g_iSecondary], g_iSecondaryAmmo[g_iSecondary]) | |
| 118 | +} | |
| 119 | + | |
| 120 | +public blockBuy(id) | |
| 121 | +{ | |
| 122 | + if (get_pcvar_num(g_pEnabled)) | |
| 123 | + return PLUGIN_HANDLED | |
| 124 | + | |
| 125 | + return PLUGIN_CONTINUE | |
| 126 | +} |
csb.json
A
| @@ -0,0 +1,31 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Random Weapon Round", | |
| 3 | + "category": "gameplay", | |
| 4 | + "tags": "random, weapons, round", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Random Weapon Round", | |
| 10 | + "short_desc": "Every round the whole server is given the same randomly chosen primary and secondary with full ammo; buying is off and the loadout is announced.", | |
| 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,cstrike,fun", | |
| 20 | + "install_notes": "1. Enable the hamsandwich, cstrike and fun modules in addons/amxmodx/configs/modules.ini\n2. Put csb_random_weapon_round.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "Do not run alongside other weapon-giving or buy-restriction plugins.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_rwr_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Enable or disable random weapon rounds." | |
| 27 | + } | |
| 28 | + ], | |
| 29 | + "commands": [], | |
| 30 | + "main": "addons/amxmodx/scripting/csb_random_weapon_round.sma" | |
| 31 | +} | |
| 0 | 32 |









