Promuj serwer

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit 23f975ce70cf324001a98df514a2094406ce90fc
4 changed files with 174 additions and 0 deletions
+3 -0 CHANGELOG.md A
@@ -0,0 +1,3 @@
1 +## 1.0.0 (2025-05-21)
2 +
3 +1.0.0 - Initial release.
+1 -0 README.md A
@@ -0,0 +1 @@
1 +<p><strong>CSB Overtime Handler</strong> keeps its own copy of the round score by listening to the CT/T win radio events, so it does not depend on any external match system. When the number of rounds played reaches <code>mp_maxrounds</code> and the score is level, it starts an <strong>overtime</strong>: <code>mp_maxrounds</code> is extended by a full OT block (played on both sides), a fresh OT start money is set, and the round is restarted so the money and freeze apply cleanly. Overtimes repeat until one side finishes ahead.</p><h2>Features</h2><ul><li>Self-kept score from the round-win audio &mdash; no reapi or external plugin needed.</li><li>Configurable OT length (MR3 / MR6 &hellip;) via <code>csb_ot_rounds</code>.</li><li>Fresh OT start money via <code>csb_ot_money</code>.</li><li>Live score and current OT number in a HUD sync message.</li></ul><h2>Installation</h2><ol><li>Compile <code>csb_overtime_handler.sma</code> and copy it to <code>addons/amxmodx/plugins/</code>.</li><li>Add it to <code>plugins.ini</code> and change the map.</li></ol>
+129 -0 addons/amxmodx/scripting/csb_overtime_handler.sma A
@@ -0,0 +1,129 @@
1 +/*
2 + * CSB Overtime Handler
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * Keeps its own copy of the round score (from the CT/T win audio events) and,
6 + * when regulation ends on a tie, starts an overtime: it raises mp_maxrounds by
7 + * an OT block, sets a fresh OT start money and restarts the round. Overtimes
8 + * repeat until one side is ahead. The live score and the current OT number are
9 + * shown in a HUD sync message.
10 + *
11 + * This program is free software: you can redistribute it and/or modify it under
12 + * the terms of the GNU General Public License as published by the Free Software
13 + * Foundation, either version 3 of the License, or (at your option) any later
14 + * version. It is distributed in the hope that it will be useful, but WITHOUT
15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details.
17 + */
18 +
19 +#include <amxmodx>
20 +
21 +new const PLUGIN[] = "CSB Overtime Handler"
22 +new const VERSION[] = "1.0.0"
23 +new const AUTHOR[] = "counter-strike-boost.com"
24 +
25 +#define TEAM_T 0
26 +#define TEAM_CT 1
27 +
28 +new g_pEnabled, g_pOtRounds, g_pOtMoney
29 +new g_iScore[2]
30 +new g_iOT
31 +new g_iSync
32 +new bool:g_bOtActive
33 +
34 +public plugin_init()
35 +{
36 + register_plugin(PLUGIN, VERSION, AUTHOR)
37 +
38 + g_pEnabled = register_cvar("csb_ot_enabled", "1")
39 + g_pOtRounds = register_cvar("csb_ot_rounds", "3")
40 + g_pOtMoney = register_cvar("csb_ot_money", "10000")
41 +
42 + /* who won the round, from the radio win audio */
43 + register_event("SendAudio", "eventTerWin", "a", "2=%!MRAD_terwin")
44 + register_event("SendAudio", "eventCtWin", "a", "2=%!MRAD_ctwin")
45 +
46 + register_logevent("eventRestart", 2, "1=World triggered", "2=Restart_Round_(1_second)")
47 +
48 + g_iSync = CreateHudSyncObj()
49 + set_task(1.0, "taskHud", 0, _, _, "b")
50 +}
51 +
52 +public eventTerWin()
53 +{
54 + onWin(TEAM_T)
55 +}
56 +
57 +public eventCtWin()
58 +{
59 + onWin(TEAM_CT)
60 +}
61 +
62 +onWin(team)
63 +{
64 + if (!get_pcvar_num(g_pEnabled))
65 + return
66 +
67 + g_iScore[team]++
68 + checkRegulationEnd()
69 +}
70 +
71 +checkRegulationEnd()
72 +{
73 + new maxr = get_cvar_num("mp_maxrounds")
74 +
75 + if (maxr <= 0)
76 + return
77 +
78 + new played = g_iScore[TEAM_T] + g_iScore[TEAM_CT]
79 +
80 + if (played < maxr)
81 + return
82 +
83 + /* regulation (or a previous OT) is over */
84 + if (g_iScore[TEAM_T] == g_iScore[TEAM_CT])
85 + startOvertime()
86 +}
87 +
88 +startOvertime()
89 +{
90 + g_iOT++
91 + g_bOtActive = true
92 +
93 + new otRounds = get_pcvar_num(g_pOtRounds)
94 +
95 + if (otRounds < 1)
96 + otRounds = 3
97 +
98 + /* an OT block is played on both sides -> two half-blocks */
99 + new newMax = get_cvar_num("mp_maxrounds") + otRounds * 2
100 + set_cvar_num("mp_maxrounds", newMax)
101 +
102 + new money = get_pcvar_num(g_pOtMoney)
103 + set_cvar_num("mp_startmoney", money)
104 +
105 + client_print(0, print_chat, "[CSB] Scores tied %d-%d. Starting OVERTIME #%d (MR%d, $%d start).",
106 + g_iScore[TEAM_T], g_iScore[TEAM_CT], g_iOT, otRounds, money)
107 +
108 + /* restart the round to apply money and freeze */
109 + set_cvar_num("sv_restart", 1)
110 +}
111 +
112 +public eventRestart()
113 +{
114 + /* nothing to reset here; score is kept across restarts on purpose */
115 + return
116 +}
117 +
118 +public taskHud()
119 +{
120 + if (!get_pcvar_num(g_pEnabled))
121 + return
122 +
123 + set_hudmessage(0, 200, 255, 0.02, 0.15, 0, 0.0, 1.2, 0.0, 0.0, -1)
124 +
125 + if (g_bOtActive)
126 + ShowSyncHudMsg(0, g_iSync, "OVERTIME #%d^nT %d - %d CT", g_iOT, g_iScore[TEAM_T], g_iScore[TEAM_CT])
127 + else
128 + ShowSyncHudMsg(0, g_iSync, "T %d - %d CT", g_iScore[TEAM_T], g_iScore[TEAM_CT])
129 +}
+41 -0 csb.json A
@@ -0,0 +1,41 @@
1 +{
2 + "name": "CSB Overtime Handler",
3 + "category": "match",
4 + "tags": "overtime, ot, match",
5 + "image": "",
6 + "original_author": "",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Overtime Handler",
10 + "short_desc": "Detects a tied score at the end of regulation and starts a repeating overtime with fresh start money and a HUD scoreboard.",
11 + "version": "1.0.0",
12 + "amxx_min": "1.9",
13 + "amxx_compile_default": "1.9",
14 + "rehlds_ok": true,
15 + "hlds_ok": true,
16 + "regamedll_required": false,
17 + "metamod_flavor": "any",
18 + "reapi_required": false,
19 + "modules": "",
20 + "install_notes": "1. Put csb_overtime_handler.amxx in addons/amxmodx/plugins/\n2. Add it to addons/amxmodx/configs/plugins.ini\n3. Change map",
21 + "known_conflicts": "Other plugins that also change mp_maxrounds or restart rounds at match end can fight the OT logic; run one match controller.",
22 + "cvars": [
23 + {
24 + "name": "csb_ot_enabled",
25 + "default": "1",
26 + "description": "Enable or disable overtime handling."
27 + },
28 + {
29 + "name": "csb_ot_rounds",
30 + "default": "3",
31 + "description": "Rounds per OT side (3 = MR3, i.e. 6 rounds total per overtime)."
32 + },
33 + {
34 + "name": "csb_ot_money",
35 + "default": "10000",
36 + "description": "Start money for each overtime."
37 + }
38 + ],
39 + "commands": [],
40 + "main": "addons/amxmodx/scripting/csb_overtime_handler.sma"
41 +}
0 42