/*
* CSB VIP Menu
* Copyright (C) 2026 counter-strike-boost.com
*
* The /vip menu. A VIP (a player holding the flag in csb_vip_flag) opens it to
* activate perks -- extra HP, armor, grenades, a short cloak, a glow and a
* mid-round respawn -- each usable a limited number of times per round. Players
* who are not VIP still see the perk list and a line telling them how to become
* one.
*
* 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. See for details.
*/
#include
#include
#include
#include
new const PLUGIN[] = "CSB VIP Menu"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
enum _:Perk
{
PERK_HP = 0,
PERK_ARMOR,
PERK_NADES,
PERK_CLOAK,
PERK_GLOW,
PERK_RESPAWN,
PERK_COUNT
}
new const g_szPerkName[PERK_COUNT][] =
{
"Extra Health (+50)",
"Full Armor (100)",
"Grenade Pack (HE + Flash + Smoke)",
"Cloak (8s near-invisible)",
"Team Glow",
"Respawn (once per round)"
}
new g_pFlag, g_pHpBonus, g_pHpCap, g_pLimitPerPerk
new g_iVipFlags
new g_iUsed[33][PERK_COUNT]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pFlag = register_cvar("csb_vip_flag", "t") /* ADMIN_LEVEL_H by default */
g_pHpBonus = register_cvar("csb_vip_hp_bonus", "50")
g_pHpCap = register_cvar("csb_vip_hp_cap", "200")
g_pLimitPerPerk = register_cvar("csb_vip_limit", "1")
register_clcmd("say /vip", "cmdVip")
register_clcmd("say_team /vip", "cmdVip")
register_logevent("evRoundStart", 2, "1=Round_Start")
}
public plugin_cfg()
{
new flagStr[8]
get_pcvar_string(g_pFlag, flagStr, charsmax(flagStr))
g_iVipFlags = read_flags(flagStr)
}
public evRoundStart()
{
for (new id = 1; id <= 32; id++)
for (new p = 0; p < PERK_COUNT; p++)
g_iUsed[id][p] = 0
}
bool:isVip(id)
{
return (get_user_flags(id) & g_iVipFlags) ? true : false
}
public cmdVip(id)
{
if (!isVip(id))
{
client_print_color(id, print_team_default,
"^x04[CSB VIP]^x01 You are not a VIP. VIP grants extra HP, armor, nades, a cloak, a glow and a respawn.")
client_print_color(id, print_team_default,
"^x04[CSB VIP]^x01 Ask an admin how to get VIP on this server.")
return PLUGIN_HANDLED
}
showVipMenu(id)
return PLUGIN_HANDLED
}
showVipMenu(id)
{
new limit = get_pcvar_num(g_pLimitPerPerk)
new title[64]
formatex(title, charsmax(title), "\yCSB VIP Menu^n\wPerks (\r%d\w use(s) each per round)", limit)
new menu = menu_create(title, "handlerVip")
new line[96], info[4]
for (new p = 0; p < PERK_COUNT; p++)
{
new left = limit - g_iUsed[id][p]
formatex(info, charsmax(info), "%d", p)
if (left > 0)
formatex(line, charsmax(line), "%s \r[%d left]", g_szPerkName[p], left)
else
formatex(line, charsmax(line), "\d%s [used up]", g_szPerkName[p])
menu_additem(menu, line, info, 0)
}
menu_setprop(menu, MPROP_EXITNAME, "Close")
menu_display(id, menu, 0)
}
public handlerVip(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new info[4], name[64], access, callback
menu_item_getinfo(menu, item, access, info, charsmax(info), name, charsmax(name), callback)
menu_destroy(menu)
new perk = str_to_num(info)
if (!isVip(id))
{
client_print_color(id, print_team_default, "^x04[CSB VIP]^x01 Only VIPs can use perks.")
return PLUGIN_HANDLED
}
/* every perk except the respawn needs a living player */
if (perk != PERK_RESPAWN && !is_user_alive(id))
{
client_print_color(id, print_team_default, "^x04[CSB VIP]^x01 You must be alive to use that perk.")
showVipMenu(id)
return PLUGIN_HANDLED
}
new limit = get_pcvar_num(g_pLimitPerPerk)
if (limit > 0 && g_iUsed[id][perk] >= limit)
{
client_print_color(id, print_team_default, "^x04[CSB VIP]^x01 You have used that perk the maximum number of times this round.")
showVipMenu(id)
return PLUGIN_HANDLED
}
if (givePerk(id, perk))
g_iUsed[id][perk]++
showVipMenu(id)
return PLUGIN_HANDLED
}
/* returns 1 if the perk was actually consumed, 0 if it was a no-op */
givePerk(id, perk)
{
switch (perk)
{
case PERK_HP:
{
new cap = get_pcvar_num(g_pHpCap)
new hp = get_user_health(id) + get_pcvar_num(g_pHpBonus)
if (hp > cap) hp = cap
set_user_health(id, hp)
perkMsg(id, "extra health")
}
case PERK_ARMOR:
{
set_user_armor(id, 100)
perkMsg(id, "full armor")
}
case PERK_NADES:
{
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
perkMsg(id, "a grenade pack")
}
case PERK_CLOAK:
{
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 25)
set_task(8.0, "taskUncloak", id + 31337)
perkMsg(id, "an 8 second cloak")
}
case PERK_GLOW:
{
new r, g, b
teamColor(id, r, g, b)
set_user_rendering(id, kRenderFxGlowShell, r, g, b, kRenderNormal, 16)
perkMsg(id, "a team glow")
}
case PERK_RESPAWN:
{
/* only consume it if the player is actually dead */
if (is_user_alive(id))
{
client_print_color(id, print_team_default, "^x04[CSB VIP]^x01 You are still alive -- use respawn when you die.")
return 0
}
ExecuteHamB(Ham_CS_RoundRespawn, id)
perkMsg(id, "a respawn")
}
}
return 1
}
public taskUncloak(param)
{
new id = param - 31337
if (is_user_alive(id))
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 16)
}
teamColor(id, &r, &g, &b)
{
if (get_user_team(id) == 1) /* T */
{
r = 255; g = 80; b = 40
}
else /* CT / other */
{
r = 40; g = 120; b = 255
}
}
perkMsg(id, const what[])
{
client_print_color(id, print_team_default, "^x04[CSB VIP]^x01 Activated:^x04 %s^x01.", what)
}