/*
* CSB Nextmap Info
* Copyright (C) 2026 counter-strike-boost.com
*
* Shows the next map in a small HUD line and answers /nextmap in chat, reading
* the value from amx_nextmap. As the map winds down it announces the next map at
* fixed time thresholds so nobody is surprised by the change, and it re-reads
* amx_nextmap live in case a map vote replaced it.
*
* 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 Nextmap Info"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
new g_pEnabled, g_pHud
new g_pNextmap
new g_iSync
/* announce thresholds in seconds of time left */
new const g_iThresholds[] = { 300, 120, 60, 30 }
new bool:g_bAnnounced[sizeof(g_iThresholds)]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_nextmap_enabled", "1")
g_pHud = register_cvar("csb_nextmap_hud", "1")
g_pNextmap = get_cvar_pointer("amx_nextmap")
register_clcmd("say /nextmap", "cmdNextmap")
register_clcmd("say_team /nextmap", "cmdNextmap")
register_clcmd("say nextmap", "cmdNextmap")
g_iSync = CreateHudSyncObj()
set_task(2.0, "taskCheck", 44, _, _, "b")
}
getNextmap(out[], len)
{
if (g_pNextmap != 0)
{
get_pcvar_string(g_pNextmap, out, len)
}
else
{
get_cvar_string("amx_nextmap", out, len)
}
if (!out[0])
copy(out, len, "unknown")
}
public cmdNextmap(id)
{
new nm[40]
getNextmap(nm, charsmax(nm))
new tl = get_timeleft()
if (tl > 0)
client_print(id, print_chat, "[CSB] Next map: %s (%d:%02d left)", nm, tl / 60, tl % 60)
else
client_print(id, print_chat, "[CSB] Next map: %s", nm)
return PLUGIN_HANDLED
}
public taskCheck()
{
if (!get_pcvar_num(g_pEnabled))
return
new tl = get_timeleft()
if (get_pcvar_num(g_pHud) && tl > 0)
{
new nm[40]
getNextmap(nm, charsmax(nm))
set_hudmessage(200, 200, 255, 0.75, 0.92, 0, 0.0, 2.0, 0.0, 0.0, -1)
ShowSyncHudMsg(0, g_iSync, "Next: %s", nm)
}
/* announce at each threshold once */
for (new i = 0; i < sizeof(g_iThresholds); i++)
{
if (!g_bAnnounced[i] && tl > 0 && tl <= g_iThresholds[i])
{
g_bAnnounced[i] = true
new nm[40]
getNextmap(nm, charsmax(nm))
client_print(0, print_chat, "[CSB] %d minute(s) left - next map is %s.",
g_iThresholds[i] / 60 >= 1 ? g_iThresholds[i] / 60 : 1, nm)
}
}
}