/* * CSB Holiday Events * Copyright (C) 2026 counter-strike-boost.com * * A seasonal event pack. It reads the server date with get_time and, on the * configured holidays, themes the server: a coloured glow shell on every player * (frosty white for Christmas, pumpkin orange for Halloween, gold for New Year), * a round-start banner, an optional themed sound, and periodic effects - snow * sparkles or New Year fireworks - spawned around the players. A cvar can force * a season for testing or for a custom event day. * * 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 new const PLUGIN[] = "CSB Holiday Events" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" #define SVC_TEMPENTITY 23 #define TE_EXPLOSION 3 #define TE_DLIGHT 27 #define SEASON_NONE 0 #define SEASON_XMAS 1 #define SEASON_HALLOWEEN 2 #define SEASON_NEWYEAR 3 new g_iSeason = SEASON_NONE new g_iExploSpr new g_szSound[64] new g_pEnabled, g_pForce, g_pSound new g_iSyncHud public plugin_precache() { g_iExploSpr = precache_model("sprites/zerogxplode.spr") } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_holiday_enabled", "1") g_pForce = register_cvar("csb_holiday_force", "0") // 0 auto, 1 xmas, 2 halloween, 3 newyear g_pSound = register_cvar("csb_holiday_sound", "") g_iSyncHud = CreateHudSyncObj() register_event("ResetHUD", "eventSpawn", "be") register_logevent("eventRoundStart", 2, "1=Round_Start") detectSeason() set_task(25.0, "taskAmbient", _, _, _, "b") } detectSeason() { new f = get_pcvar_num(g_pForce) if (f >= 1 && f <= 3) { g_iSeason = f return } new sMon[3], sDay[3] get_time("%m", sMon, charsmax(sMon)) get_time("%d", sDay, charsmax(sDay)) new mon = str_to_num(sMon) new day = str_to_num(sDay) g_iSeason = SEASON_NONE if (mon == 12 && day >= 20) g_iSeason = SEASON_XMAS else if (mon == 1 && day <= 2) g_iSeason = SEASON_NEWYEAR else if (mon == 10 && day >= 25) g_iSeason = SEASON_HALLOWEEN } seasonColor(&r, &g, &b) { switch (g_iSeason) { case SEASON_XMAS: { r = 200; g = 225; b = 255; } case SEASON_HALLOWEEN: { r = 255; g = 110; b = 0; } case SEASON_NEWYEAR: { r = 255; g = 215; b = 0; } default: { r = 255; g = 255; b = 255; } } } public eventSpawn(id) { if (!get_pcvar_num(g_pEnabled) || g_iSeason == SEASON_NONE) return if (!is_user_alive(id)) return new r, g, b seasonColor(r, g, b) set_user_rendering(id, kRenderFxGlowShell, r, g, b, kRenderNormal, 6) } public eventRoundStart() { if (!get_pcvar_num(g_pEnabled) || g_iSeason == SEASON_NONE) return new banner[48] switch (g_iSeason) { case SEASON_XMAS: copy(banner, charsmax(banner), "Merry Christmas from CSB!") case SEASON_HALLOWEEN: copy(banner, charsmax(banner), "Happy Halloween... beware.") case SEASON_NEWYEAR: copy(banner, charsmax(banner), "Happy New Year!") default: copy(banner, charsmax(banner), "Happy Holidays!") } new r, g, b seasonColor(r, g, b) set_hudmessage(r, g, b, -1.0, 0.18, 0, 0.0, 4.0, 0.3, 0.3, -1) ShowSyncHudMsg(0, g_iSyncHud, "%s", banner) } public taskAmbient() { if (!get_pcvar_num(g_pEnabled) || g_iSeason == SEASON_NONE) return /* optional themed sound */ get_pcvar_string(g_pSound, g_szSound, charsmax(g_szSound)) new players[32], num, pid, origin[3] get_players(players, num, "a") for (new i = 0; i < num; i++) { pid = players[i] get_user_origin(pid, origin) if (g_szSound[0]) emit_sound(pid, CHAN_STATIC, g_szSound, 0.5, ATTN_NORM, 0, PITCH_NORM) switch (g_iSeason) { case SEASON_XMAS, SEASON_HALLOWEEN: { /* soft coloured light overhead - snow shimmer / spooky glow */ new r, g, b seasonColor(r, g, b) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_DLIGHT) write_coord(origin[0]) write_coord(origin[1]) write_coord(origin[2] + 64) write_byte(12) write_byte(r) write_byte(g) write_byte(b) write_byte(20) write_byte(15) message_end() } case SEASON_NEWYEAR: { /* a firework overhead */ message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_EXPLOSION) write_coord(origin[0] + random_num(-120, 120)) write_coord(origin[1] + random_num(-120, 120)) write_coord(origin[2] + random_num(180, 320)) write_short(g_iExploSpr) write_byte(random_num(15, 25)) write_byte(20) write_byte(2) message_end() } } } }