/* * CSB One In The Chamber * Copyright (C) 2026 counter-strike-boost.com * * The One In The Chamber game mode. Everyone spawns with a knife and a Deagle * loaded with a single bullet and no reserve ammo. A kill with the pistol refunds * one bullet and a knife kill grants one too, so accuracy keeps you armed; miss * and you are down to the knife until you earn another round. Ammo is managed by * setting the Deagle's clip on the weapon entity. * * Inspired by the One In The Chamber game mode. Independent GPL re-implementation. * * 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 #include new const PLUGIN[] = "CSB One In The Chamber" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" new g_pEnabled, g_pStartBullets, g_pKnifeReward public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_oitc_enabled", "1") g_pStartBullets = register_cvar("csb_oitc_startbullets", "1") g_pKnifeReward = register_cvar("csb_oitc_knifereward", "1") RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1) register_event("DeathMsg", "eventDeath", "a", "1>0") register_clcmd("buy", "blockBuy") register_clcmd("buyammo", "blockBuy") } public fwSpawnPost(id) { if (!get_pcvar_num(g_pEnabled) || !is_user_alive(id)) return set_task(0.2, "taskEquip", id) } public taskEquip(id) { if (!is_user_alive(id)) return strip_user_weapons(id) give_item(id, "weapon_knife") give_item(id, "weapon_deagle") cs_set_user_bpammo(id, CSW_DEAGLE, 0) setBullets(id, get_pcvar_num(g_pStartBullets)) } setBullets(id, count) { new ent = findDeagle(id) if (ent > 0) cs_set_weapon_ammo(ent, count) cs_set_user_bpammo(id, CSW_DEAGLE, 0) } addBullet(id) { new ent = findDeagle(id) if (ent <= 0) return new cur = cs_get_weapon_ammo(ent) cs_set_weapon_ammo(ent, cur + 1) cs_set_user_bpammo(id, CSW_DEAGLE, 0) } findDeagle(id) { new ent = 0 while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "weapon_deagle")) > 0) { if (pev(ent, pev_owner) == id) return ent } return 0 } public eventDeath() { if (!get_pcvar_num(g_pEnabled)) return new killer = read_data(1) new victim = read_data(2) new headshot = read_data(3) if (killer < 1 || killer > 32 || killer == victim || !is_user_alive(killer)) return new wpn[32] read_data(4, wpn, charsmax(wpn)) if (containi(wpn, "knife") != -1) { if (get_pcvar_num(g_pKnifeReward)) { addBullet(killer) client_print(killer, print_chat, "[CSB] Knife kill - here is a bullet.") } } else if (containi(wpn, "deagle") != -1) { addBullet(killer) if (headshot) client_print(killer, print_chat, "[CSB] Headshot! Bullet refunded.") else client_print(killer, print_chat, "[CSB] Kill! Bullet refunded.") } } public blockBuy(id) { if (get_pcvar_num(g_pEnabled)) return PLUGIN_HANDLED return PLUGIN_CONTINUE }