Promuj serwer
Black Friday Koniec za 50% taniej: miejsce na Master Serverze i lista Client, z PREMIUM DOZYWOTNIO
03 Dni 11 Godz 00 Min 35 Sek
Zobacz oferty

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit b6225a2e6fb7632f85187b3f019d1d8f7dd6c3ef
4 changed files with 312 additions and 0 deletions
+3 -0 CHANGELOG.md A
@@ -0,0 +1,3 @@
1 +## 1.0.0 (2025-05-20)
2 +
3 +1.0.0 - Initial release.
+1 -0 README.md A
@@ -0,0 +1 @@
1 +<p><strong>CSB Ready System</strong> is the warmup gate every scrim and pug server needs. During warmup each player on a team types <code>/ready</code>; a HUD message shows how many players are ready out of the total, and the instant every connected non-spectator is ready the plugin runs an <strong>LO3</strong> (three <code>sv_restartround</code>/<code>sv_restart</code> cycles) and declares the match live.</p><h2>Features</h2><ul><li><code>/ready</code> and <code>/notready</code> from chat, tracked per player.</li><li>Live HUD every second: <em>WARMUP - type /ready</em> with a <code>Ready: X / Y</code> counter.</li><li>Automatic LO3 and a &quot;MATCH IS LIVE&quot; announcement once everyone is ready.</li><li>A three-second countdown that <strong>aborts</strong> if anyone un-readies before it finishes.</li><li><code>/forceready</code> for admins (flag from <code>csb_ready_adminflag</code>) to skip straight to live.</li><li><code>csb_ready_minplayers</code> stops the match going live with only one player on the server.</li></ul><h2>Installation</h2><ol><li>Compile and copy <code>csb_ready_system.amxx</code> into <code>addons/amxmodx/plugins/</code>.</li><li>Add it to <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Change the map. Type <code>/ready</code> to test.</li></ol><h2>Notes</h2><p>The plugin uses only core natives, so it loads on any AMX Mod X 1.9 install with no extra modules. Spectators and players who have not joined a team are ignored by the counter.</p>
+251 -0 addons/amxmodx/scripting/csb_ready_system.sma A
@@ -0,0 +1,251 @@
1 +/*
2 + * CSB Ready System
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * A pre-match readiness gate: every non-spectator types /ready, a HUD shows how
6 + * many players are ready, and once everyone is ready the plugin runs an LO3
7 + * (three restarts) and goes live. Admins can force the match live and any player
8 + * un-readying during the countdown aborts it.
9 + *
10 + * This program is free software: you can redistribute it and/or modify it under
11 + * the terms of the GNU General Public License as published by the Free Software
12 + * Foundation, either version 3 of the License, or (at your option) any later
13 + * version. It is distributed in the hope that it will be useful, but WITHOUT ANY
14 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 + * A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details.
16 + */
17 +
18 +#include <amxmodx>
19 +#include <amxmisc>
20 +
21 +new const PLUGIN[] = "CSB Ready System"
22 +new const VERSION[] = "1.0.0"
23 +new const AUTHOR[] = "counter-strike-boost.com"
24 +
25 +#define TASK_HUD 4100
26 +#define TASK_LO3 4200
27 +
28 +new bool:g_bReady[33]
29 +new bool:g_bLive
30 +new bool:g_bCounting
31 +new g_iRestartsLeft
32 +
33 +new g_pEnabled, g_pMinPlayers, g_pAdminFlag
34 +
35 +public plugin_init()
36 +{
37 + register_plugin(PLUGIN, VERSION, AUTHOR)
38 +
39 + g_pEnabled = register_cvar("csb_ready_enabled", "1")
40 + g_pMinPlayers = register_cvar("csb_ready_minplayers", "2")
41 + g_pAdminFlag = register_cvar("csb_ready_adminflag", "d")
42 +
43 + register_clcmd("say /ready", "cmdReady")
44 + register_clcmd("say_team /ready", "cmdReady")
45 + register_clcmd("say /notready", "cmdNotReady")
46 + register_clcmd("say_team /notready", "cmdNotReady")
47 + register_clcmd("say /forceready", "cmdForceReady")
48 +
49 + register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
50 +
51 + set_task(1.0, "taskHud", TASK_HUD, _, _, "b")
52 +}
53 +
54 +public client_putinserver(id)
55 +{
56 + g_bReady[id] = false
57 +}
58 +
59 +public client_disconnected(id)
60 +{
61 + g_bReady[id] = false
62 +}
63 +
64 +public eNewRound()
65 +{
66 + /* keep restarting the score to zero during LO3 */
67 +}
68 +
69 +public cmdReady(id)
70 +{
71 + if (!get_pcvar_num(g_pEnabled) || g_bLive)
72 + return PLUGIN_HANDLED
73 +
74 + if (get_user_team(id) == 0)
75 + {
76 + client_print(id, print_chat, "[CSB] Join a team before readying up.")
77 + return PLUGIN_HANDLED
78 + }
79 +
80 + if (g_bReady[id])
81 + {
82 + client_print(id, print_chat, "[CSB] You are already ready.")
83 + return PLUGIN_HANDLED
84 + }
85 +
86 + g_bReady[id] = true
87 +
88 + new name[32]
89 + get_user_name(id, name, charsmax(name))
90 + chatAll("^x04[CSB]^x03 %s^x01 is ready.", name)
91 +
92 + checkAllReady()
93 + return PLUGIN_HANDLED
94 +}
95 +
96 +public cmdNotReady(id)
97 +{
98 + if (!get_pcvar_num(g_pEnabled) || g_bLive)
99 + return PLUGIN_HANDLED
100 +
101 + if (!g_bReady[id])
102 + return PLUGIN_HANDLED
103 +
104 + g_bReady[id] = false
105 +
106 + new name[32]
107 + get_user_name(id, name, charsmax(name))
108 + chatAll("^x04[CSB]^x03 %s^x01 is NOT ready.", name)
109 +
110 + if (g_bCounting)
111 + {
112 + abortCountdown()
113 + chatAll("^x04[CSB]^x01 Countdown aborted - someone un-readied.")
114 + }
115 +
116 + return PLUGIN_HANDLED
117 +}
118 +
119 +public cmdForceReady(id)
120 +{
121 + new flags = read_flags_cvar()
122 +
123 + if (!(get_user_flags(id) & flags))
124 + {
125 + client_print(id, print_chat, "[CSB] You do not have access to force the match live.")
126 + return PLUGIN_HANDLED
127 + }
128 +
129 + if (g_bLive)
130 + return PLUGIN_HANDLED
131 +
132 + new name[32]
133 + get_user_name(id, name, charsmax(name))
134 + chatAll("^x04[CSB]^x03 %s^x01 forced the match to go live.", name)
135 +
136 + startLive()
137 + return PLUGIN_HANDLED
138 +}
139 +
140 +read_flags_cvar()
141 +{
142 + new sflag[8]
143 + get_pcvar_string(g_pAdminFlag, sflag, charsmax(sflag))
144 + return read_flags(sflag)
145 +}
146 +
147 +countPlayers(&ready, &total)
148 +{
149 + new players[32], num, pid
150 + ready = 0
151 + total = 0
152 + get_players(players, num)
153 +
154 + for (new i = 0; i < num; i++)
155 + {
156 + pid = players[i]
157 +
158 + if (get_user_team(pid) == 0 || is_user_bot(pid))
159 + continue
160 +
161 + total++
162 +
163 + if (g_bReady[pid])
164 + ready++
165 + }
166 +}
167 +
168 +checkAllReady()
169 +{
170 + if (g_bLive || g_bCounting)
171 + return
172 +
173 + new ready, total
174 + countPlayers(ready, total)
175 +
176 + if (total < get_pcvar_num(g_pMinPlayers))
177 + return
178 +
179 + if (ready == total && total > 0)
180 + startLive()
181 +}
182 +
183 +startLive()
184 +{
185 + g_bCounting = true
186 + g_iRestartsLeft = 3
187 + chatAll("^x04[CSB]^x01 All players ready - going live! LO3 starting.")
188 + set_task(1.0, "taskLo3", TASK_LO3, _, _, "a", 3)
189 +}
190 +
191 +public taskLo3()
192 +{
193 + g_iRestartsLeft--
194 + server_cmd("sv_restartround 1")
195 + server_cmd("sv_restart 1")
196 +
197 + if (g_iRestartsLeft > 0)
198 + {
199 + chatAll("^x04[CSB]^x01 Restart^x04 %d^x01 of 3...", 3 - g_iRestartsLeft)
200 + }
201 + else
202 + {
203 + g_bCounting = false
204 + g_bLive = true
205 + chatAll("^x04[CSB]^x01 *** MATCH IS LIVE *** GO GO GO!")
206 + client_print(0, print_center, "MATCH IS LIVE")
207 + }
208 +}
209 +
210 +abortCountdown()
211 +{
212 + remove_task(TASK_LO3)
213 + g_bCounting = false
214 + g_iRestartsLeft = 0
215 +}
216 +
217 +public taskHud()
218 +{
219 + if (!get_pcvar_num(g_pEnabled) || g_bLive)
220 + return
221 +
222 + new ready, total
223 + countPlayers(ready, total)
224 +
225 + if (total <= 0)
226 + return
227 +
228 + set_hudmessage(0, 200, 80, -1.0, 0.15, 0, 0.0, 1.1, 0.0, 0.0, -1)
229 +
230 + if (g_bCounting)
231 + show_hudmessage(0, "LIVE ON 3 - GET READY^nReady: %d / %d", ready, total)
232 + else
233 + show_hudmessage(0, "WARMUP - type /ready^nReady: %d / %d", ready, total)
234 +}
235 +
236 +chatAll(const fmt[], any:...)
237 +{
238 + new msg[192]
239 + vformat(msg, charsmax(msg), fmt, 2)
240 +
241 + new players[32], num, msgid = get_user_msgid("SayText")
242 + get_players(players, num, "ch")
243 +
244 + for (new i = 0; i < num; i++)
245 + {
246 + message_begin(MSG_ONE, msgid, _, players[i])
247 + write_byte(players[i])
248 + write_string(msg)
249 + message_end()
250 + }
251 +}
+57 -0 csb.json A
@@ -0,0 +1,57 @@
1 +{
2 + "name": "CSB Ready System",
3 + "category": "match",
4 + "tags": "ready, live, match",
5 + "image": "",
6 + "original_author": "",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Ready System",
10 + "short_desc": "A warmup ready-up gate: /ready and /notready with a live HUD, automatic LO3 when everyone is ready, and /forceready for admins.",
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_ready_system.amxx in addons/amxmodx/plugins/\n2. Add it to plugins.ini\n3. Change map",
21 + "known_conflicts": "Any other ready/LO3 or match-start plugin - run only one.",
22 + "cvars": [
23 + {
24 + "name": "csb_ready_enabled",
25 + "default": "1",
26 + "description": "Enable or disable the ready system."
27 + },
28 + {
29 + "name": "csb_ready_minplayers",
30 + "default": "2",
31 + "description": "Minimum non-spectators required before the match can go live."
32 + },
33 + {
34 + "name": "csb_ready_adminflag",
35 + "default": "d",
36 + "description": "Access flag required for /forceready."
37 + }
38 + ],
39 + "commands": [
40 + {
41 + "name": "say /ready",
42 + "access": "",
43 + "description": "Mark yourself ready."
44 + },
45 + {
46 + "name": "say /notready",
47 + "access": "",
48 + "description": "Mark yourself not ready (aborts the countdown)."
49 + },
50 + {
51 + "name": "say /forceready",
52 + "access": "d (ADMIN_BAN)",
53 + "description": "Force the match live immediately."
54 + }
55 + ],
56 + "main": "addons/amxmodx/scripting/csb_ready_system.sma"
57 +}
0 58