/* * CSB Random Weapon Round * Copyright (C) 2026 counter-strike-boost.com * * Every round the whole server 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 * everyone fights with the round's weapon. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. It is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See for details. */ #include #include #include #include new const PLUGIN[] = "CSB Random Weapon Round" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" new const g_szPrimary[][] = { "weapon_ak47", "weapon_m4a1", "weapon_awp", "weapon_mp5navy", "weapon_xm1014", "weapon_p90", "weapon_famas", "weapon_galil" } new const g_iPrimaryCSW[] = { CSW_AK47, CSW_M4A1, CSW_AWP, CSW_MP5NAVY, CSW_XM1014, CSW_P90, CSW_FAMAS, CSW_GALIL } new const g_iPrimaryAmmo[] = { 90, 90, 30, 120, 32, 100, 90, 90 } new const g_szSecondary[][] = { "weapon_deagle", "weapon_usp", "weapon_glock18", "weapon_p228", "weapon_fiveseven" } new const g_iSecondaryCSW[] = { CSW_DEAGLE, CSW_USP, CSW_GLOCK18, CSW_P228, CSW_FIVESEVEN } new const g_iSecondaryAmmo[] = { 35, 24, 40, 26, 50 } new g_pEnabled new g_iPrimary, g_iSecondary public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_rwr_enabled", "1") RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1) register_logevent("eventRoundStart", 2, "1=Round_Start") register_clcmd("buy", "blockBuy") register_clcmd("buyammo", "blockBuy") } public eventRoundStart() { if (!get_pcvar_num(g_pEnabled)) return g_iPrimary = random_num(0, sizeof(g_szPrimary) - 1) g_iSecondary = random_num(0, sizeof(g_szSecondary) - 1) new p[24], s[24] prettyName(g_szPrimary[g_iPrimary], p, charsmax(p)) prettyName(g_szSecondary[g_iSecondary], s, charsmax(s)) client_print(0, print_chat, "^x04[Weapons]^x01 This round: %s + %s!", p, s) } prettyName(const cls[], out[], len) { /* strip the "weapon_" prefix and upper-case it */ copy(out, len, cls[7]) new n = strlen(out) for (new i = 0; i < n; i++) { if (out[i] >= 'a' && out[i] <= 'z') out[i] -= 32 } } public fwSpawnPost(id) { if (get_pcvar_num(g_pEnabled) && is_user_alive(id)) set_task(0.2, "taskEquip", id) } public taskEquip(id) { if (!is_user_alive(id) || !get_pcvar_num(g_pEnabled)) return strip_user_weapons(id) give_item(id, "weapon_knife") give_item(id, g_szPrimary[g_iPrimary]) cs_set_user_bpammo(id, g_iPrimaryCSW[g_iPrimary], g_iPrimaryAmmo[g_iPrimary]) give_item(id, g_szSecondary[g_iSecondary]) cs_set_user_bpammo(id, g_iSecondaryCSW[g_iSecondary], g_iSecondaryAmmo[g_iSecondary]) } public blockBuy(id) { if (get_pcvar_num(g_pEnabled)) return PLUGIN_HANDLED return PLUGIN_CONTINUE }