/*
* CSB Anti Ghosting
* Copyright (C) 2026 counter-strike-boost.com
*
* Closes the common ghosting channels on a live round: dead players' chat is
* routed only to other dead players (never leaked to the living), spectators
* are pinned to a limited camera mode via mp_forcecamera, and sv_alltalk is
* forced off while a round is running. All values are cvar-controlled.
*
* 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
new const PLUGIN[] = "CSB Anti Ghosting"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
new g_pEnabled, g_pDeadChat, g_pForceCamVal, g_pAllTalk
new g_pForceCamera, g_pSvAllTalk
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_gh_enabled", "1")
g_pDeadChat = register_cvar("csb_gh_deadchat", "1")
g_pForceCamVal = register_cvar("csb_gh_forcecamera", "1")
g_pAllTalk = register_cvar("csb_gh_alltalk", "1")
register_clcmd("say", "cmdSay")
register_clcmd("say_team", "cmdSay")
register_logevent("evRoundStart", 2, "1=Round_Start")
g_pForceCamera = get_cvar_pointer("mp_forcecamera")
g_pSvAllTalk = get_cvar_pointer("sv_alltalk")
}
public evRoundStart()
{
if (!get_pcvar_num(g_pEnabled))
return
if (g_pForceCamera)
set_pcvar_num(g_pForceCamera, get_pcvar_num(g_pForceCamVal))
if (get_pcvar_num(g_pAllTalk) && g_pSvAllTalk)
set_pcvar_num(g_pSvAllTalk, 0)
}
public cmdSay(id)
{
if (!get_pcvar_num(g_pEnabled) || !get_pcvar_num(g_pDeadChat))
return PLUGIN_CONTINUE
/* living players use normal chat */
if (is_user_alive(id))
return PLUGIN_CONTINUE
new said[128]
read_args(said, charsmax(said))
remove_quotes(said)
trim(said)
if (!said[0])
return PLUGIN_HANDLED
/* let command-style messages fall through to their own plugins */
if (said[0] == '/' || said[0] == '!')
return PLUGIN_CONTINUE
new name[32]
get_user_name(id, name, charsmax(name))
/* deliver only to other dead / spectating players */
new players[32], num, pid
get_players(players, num)
for (new i = 0; i < num; i++)
{
pid = players[i]
if (!is_user_alive(pid))
client_print(pid, print_chat, "*DEAD* %s : %s", name, said)
}
return PLUGIN_HANDLED
}