/*
* CSB Random Mode Rounds
* Copyright (C) 2026 counter-strike-boost.com
*
* Each round the plugin randomly picks a mini-mode from an enabled list - knife
* only, deagle only, headshot only, no gravity or one-shot - announces it with a
* HUD banner and a sound, applies the rules for that round, and cleanly reverts
* everything when the round ends.
*
* 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 Random Mode Rounds"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
#define HIT_HEAD 1
enum
{
MODE_KNIFE = 0,
MODE_DEAGLE,
MODE_HSONLY,
MODE_NOGRAV,
MODE_ONESHOT,
MODE_COUNT
}
new const g_szModeName[MODE_COUNT][] =
{
"KNIVES ONLY",
"DEAGLE ONLY",
"HEADSHOT ONLY",
"NO GRAVITY",
"ONE SHOT ONE KILL"
}
new g_pEnabled
new g_iMode
new g_iHudSync
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_modes_enabled", "1")
RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1)
RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage", 0)
RegisterHam(Ham_TraceAttack, "player", "fwTraceAttack", 0)
register_logevent("eventRoundStart", 2, "1=Round_Start")
register_logevent("eventRoundEnd", 2, "1=Round_End")
g_iMode = MODE_KNIFE
g_iHudSync = CreateHudSyncObj()
}
public eventRoundStart()
{
if (!get_pcvar_num(g_pEnabled))
return
g_iMode = random_num(0, MODE_COUNT - 1)
client_print(0, print_chat, "^x04[Mode]^x01 This round: %s!", g_szModeName[g_iMode])
set_hudmessage(255, 160, 0, -1.0, 0.18, 0, 0.0, 5.0, 0.2, 0.5, -1)
ShowSyncHudMsg(0, g_iHudSync, "MODE: %s", g_szModeName[g_iMode])
new players[32], num
get_players(players, num, "a")
for (new i = 0; i < num; i++)
applyMode(players[i])
}
public fwSpawnPost(id)
{
if (get_pcvar_num(g_pEnabled) && is_user_alive(id))
applyMode(id)
}
applyMode(id)
{
if (!is_user_alive(id))
return
switch (g_iMode)
{
case MODE_KNIFE:
{
strip_user_weapons(id)
give_item(id, "weapon_knife")
}
case MODE_DEAGLE:
{
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
}
case MODE_NOGRAV:
set_user_gravity(id, 0.25)
default:
set_user_gravity(id, 1.0)
}
}
public eventRoundEnd()
{
new players[32], num
get_players(players, num, "a")
for (new i = 0; i < num; i++)
set_user_gravity(players[i], 1.0)
}
public fwTakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
{
if (!get_pcvar_num(g_pEnabled) || g_iMode != MODE_ONESHOT)
return HAM_IGNORED
if (attacker < 1 || attacker > 32 || attacker == victim)
return HAM_IGNORED
/* any bullet or knife hit is lethal */
if (damagebits & (DMG_BULLET | DMG_SLASH | DMG_NEVERGIB))
SetHamParamFloat(4, 1000.0)
return HAM_IGNORED
}
public fwTraceAttack(victim, attacker, Float:damage, Float:direction[3], ptr, damagebits)
{
if (!get_pcvar_num(g_pEnabled) || g_iMode != MODE_HSONLY)
return HAM_IGNORED
if (attacker < 1 || attacker > 32 || !is_user_alive(victim))
return HAM_IGNORED
new hitgroup = get_tr2(ptr, TR_iHitgroup)
if (hitgroup == HIT_HEAD)
{
SetHamParamFloat(3, 1000.0)
return HAM_IGNORED
}
SetHamParamFloat(3, 0.0)
return HAM_SUPERCEDE
}