Популяризирай сървър
Black Friday Свършва след 50% отстъпка за място в Master Server и за списъка Client, който идва с PREMIUM ЗА ЦЯЛ ЖИВОТ
12 Ч 52 Мин 09 Сек
Виж офертите

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit 16ba4a5e98ed7df55bd74ef28ecacd6f3585cb62
4 changed files with 270 additions and 0 deletions
+3 -0 CHANGELOG.md A
@@ -0,0 +1,3 @@
1 +## 1.0.0 (2026-05-24)
2 +
3 +1.0.0 - Initial release.
+1 -0 README.md A
@@ -0,0 +1 @@
1 +<p><strong>CSB Knife Round</strong> is the side-pick step every scrim and match starts with. An admin runs <code>csb_kniferound</code> (or <code>/knife</code>): the round restarts, everyone is stripped to a knife, their money is zeroed and the buy commands are blocked. When a team wins the knife round, that team's captain gets a menu &mdash; <strong>stay</strong> or <strong>swap sides</strong> &mdash; and the choice is applied with <code>cs_set_user_team</code> followed by a short restart so the real match begins on the chosen sides.</p><p>It works standalone for pick-up games, or as the side-pick stage driven by a larger match system.</p><h2>Features</h2><ul><li><code>csb_kniferound</code> / <code>/knife</code> to start (admin only).</li><li>Weapons stripped and re-stripped on spawn; knife handed out via <code>Ham_Spawn</code>.</li><li>Money zeroed and buy commands (<code>buy</code>, <code>buyammo</code>, <code>autobuy</code>, <code>rebuy</code>, etc.) blocked for the duration.</li><li>Winner detected from the round-win radio; that team's captain gets a no-exit stay/swap menu.</li><li>Swap kills and reassigns every connected player with <code>cs_set_user_team</code>, then restarts.</li></ul><h2>Installation</h2><ol><li>Make sure the <code>cstrike</code>, <code>fun</code> and <code>hamsandwich</code> modules are enabled in <code>addons/amxmodx/configs/modules.ini</code>.</li><li>Compile and copy <code>csb_knife_round.amxx</code> into <code>addons/amxmodx/plugins/</code>.</li><li>Add it to <code>plugins.ini</code> and change the map.</li></ol><h2>Notes</h2><p>The captain is simply the first connected player found on the winning team. In a full match setup you would normally drive <code>csb_kniferound</code> from your match plugin and let it decide who the captain is; here it is kept deliberately simple so the plugin is useful on its own.</p>
+230 -0 addons/amxmodx/scripting/csb_knife_round.sma A
@@ -0,0 +1,230 @@
1 +/*
2 + * CSB Knife Round
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * Runs a knife-only round: weapons are stripped on spawn, money is zeroed and
6 + * the buy commands are blocked. When a team wins the knife round, that team's
7 + * captain gets a menu to keep sides or swap, and the choice is applied with
8 + * cs_set_user_team followed by a game restart. Works standalone or as the
9 + * side-pick step of a match system.
10 + *
11 + * Independent GPL implementation written for counter-strike-boost.com.
12 + *
13 + * This program is free software: you can redistribute it and/or modify it
14 + * under the terms of the GNU General Public License as published by the Free
15 + * Software Foundation, either version 3 of the License, or (at your option)
16 + * any later version. It is distributed in the hope that it will be useful,
17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 + * Public License for more details: <https://www.gnu.org/licenses/>.
20 + */
21 +
22 +#include <amxmodx>
23 +#include <amxmisc>
24 +#include <cstrike>
25 +#include <fun>
26 +#include <hamsandwich>
27 +
28 +new const PLUGIN[] = "CSB Knife Round"
29 +new const VERSION[] = "1.0.0"
30 +new const AUTHOR[] = "counter-strike-boost.com"
31 +
32 +new bool:g_bActive = false
33 +new bool:g_bDecided = false
34 +
35 +new const g_szBuyCmds[][] =
36 +{
37 + "buy", "buyammo", "buyequip", "autobuy", "rebuy", "nightvision"
38 +}
39 +
40 +public plugin_init()
41 +{
42 + register_plugin(PLUGIN, VERSION, AUTHOR)
43 +
44 + RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1)
45 +
46 + register_event("HLTV", "eNewRound", "a", "1=0", "2=0")
47 + register_event("SendAudio", "eTerWin", "a", "2&%!MRAD_terwin")
48 + register_event("SendAudio", "eCtWin", "a", "2&%!MRAD_ctwin")
49 +
50 + register_clcmd("csb_kniferound", "cmdStart", ADMIN_LEVEL_A, "- start a knife round with a side-pick at the end")
51 + register_clcmd("say /knife", "cmdStart", ADMIN_LEVEL_A)
52 +
53 + register_clcmd("fullupdate", "blockBuy")
54 +
55 + for (new i = 0; i < sizeof(g_szBuyCmds); i++)
56 + register_clcmd(g_szBuyCmds[i], "blockBuy")
57 +}
58 +
59 +public cmdStart(id, level, cid)
60 +{
61 + if (!cmd_access(id, level, cid, 1))
62 + return PLUGIN_HANDLED
63 +
64 + g_bActive = true
65 + g_bDecided = false
66 +
67 + client_print(0, print_chat, "[CSB] Knife round! Winning team picks the sides.")
68 +
69 + server_cmd("sv_restartround 1")
70 + return PLUGIN_HANDLED
71 +}
72 +
73 +public eNewRound()
74 +{
75 + /* strip everyone again at the start of the knife round proper */
76 + if (!g_bActive)
77 + return
78 +
79 + new players[32], num
80 + get_players(players, num, "a")
81 +
82 + for (new i = 0; i < num; i++)
83 + stripToKnife(players[i])
84 +}
85 +
86 +public fwSpawnPost(id)
87 +{
88 + if (!g_bActive || !is_user_alive(id))
89 + return
90 +
91 + stripToKnife(id)
92 +}
93 +
94 +stripToKnife(id)
95 +{
96 + if (!is_user_alive(id))
97 + return
98 +
99 + strip_user_weapons(id)
100 + give_item(id, "weapon_knife")
101 + cs_set_user_money(id, 0, 1)
102 +}
103 +
104 +public blockBuy(id)
105 +{
106 + if (g_bActive)
107 + {
108 + client_print(id, print_center, "Knife round - buying is disabled")
109 + return PLUGIN_HANDLED
110 + }
111 +
112 + return PLUGIN_CONTINUE
113 +}
114 +
115 +/* ---------- deciding sides ---------- */
116 +
117 +public eTerWin()
118 +{
119 + onTeamWin(CS_TEAM_T)
120 +}
121 +
122 +public eCtWin()
123 +{
124 + onTeamWin(CS_TEAM_CT)
125 +}
126 +
127 +onTeamWin(CsTeams:team)
128 +{
129 + if (!g_bActive || g_bDecided)
130 + return
131 +
132 + g_bDecided = true
133 +
134 + new captain = findCaptain(team)
135 +
136 + if (!captain)
137 + {
138 + /* nobody left on the winning team to decide - just end the knife round */
139 + endKnife()
140 + client_print(0, print_chat, "[CSB] Knife round over - no captain found, sides kept.")
141 + return
142 + }
143 +
144 + new tname[32]
145 + get_user_name(captain, tname, charsmax(tname))
146 +
147 + client_print(0, print_chat, "[CSB] %s (%s) is picking the sides...",
148 + tname, (team == CS_TEAM_T) ? "T" : "CT")
149 +
150 + showPickMenu(captain)
151 +}
152 +
153 +findCaptain(CsTeams:team)
154 +{
155 + new players[32], num
156 + get_players(players, num, "c") // connected, skip HLTV
157 +
158 + for (new i = 0; i < num; i++)
159 + {
160 + if (cs_get_user_team(players[i]) == team)
161 + return players[i]
162 + }
163 +
164 + return 0
165 +}
166 +
167 +showPickMenu(id)
168 +{
169 + new menu = menu_create("\yKnife Round won!^n\wPick the sides", "handlerPick")
170 +
171 + menu_additem(menu, "\wStay on the current sides", "1", 0)
172 + menu_additem(menu, "\rSwap sides", "2", 0)
173 +
174 + menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER)
175 + menu_display(id, menu, 0)
176 +}
177 +
178 +public handlerPick(id, menu, item)
179 +{
180 + if (item == MENU_EXIT)
181 + {
182 + menu_destroy(menu)
183 + return PLUGIN_HANDLED
184 + }
185 +
186 + new info[4], name[32], access, callback
187 + menu_item_getinfo(menu, item, access, info, charsmax(info), name, charsmax(name), callback)
188 + menu_destroy(menu)
189 +
190 + if (str_to_num(info) == 2)
191 + {
192 + swapAllSides()
193 + client_print(0, print_chat, "[CSB] Sides swapped. Get ready!")
194 + }
195 + else
196 + {
197 + client_print(0, print_chat, "[CSB] Sides kept. Get ready!")
198 + }
199 +
200 + endKnife()
201 +
202 + server_cmd("sv_restartround 3")
203 + return PLUGIN_HANDLED
204 +}
205 +
206 +swapAllSides()
207 +{
208 + new players[32], num
209 + get_players(players, num, "c")
210 +
211 + for (new i = 0; i < num; i++)
212 + {
213 + new id = players[i]
214 + new CsTeams:team = cs_get_user_team(id)
215 +
216 + if (is_user_alive(id))
217 + user_kill(id, 1)
218 +
219 + if (team == CS_TEAM_T)
220 + cs_set_user_team(id, CS_TEAM_CT)
221 + else if (team == CS_TEAM_CT)
222 + cs_set_user_team(id, CS_TEAM_T)
223 + }
224 +}
225 +
226 +endKnife()
227 +{
228 + g_bActive = false
229 + g_bDecided = false
230 +}
+36 -0 csb.json A
@@ -0,0 +1,36 @@
1 +{
2 + "name": "CSB Knife Round",
3 + "category": "match",
4 + "tags": "knife round, sides, pick",
5 + "image": "",
6 + "original_author": "",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Knife Round",
10 + "short_desc": "Runs a knife-only round (weapons stripped, buying blocked); the winning team's captain then picks stay or swap sides, applied with cs_set_user_team and a restart.",
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": "cstrike,fun,hamsandwich",
20 + "install_notes": "1. Enable the cstrike, fun and hamsandwich modules in addons/amxmodx/configs/modules.ini\n2. Put csb_knife_round.amxx in addons/amxmodx/plugins/\n3. Add it to plugins.ini\n4. Change map",
21 + "known_conflicts": "Other match/knife-round plugins that also strip weapons or handle the side pick will conflict - run one match controller.",
22 + "cvars": [],
23 + "commands": [
24 + {
25 + "name": "csb_kniferound",
26 + "access": "g (ADMIN_LEVEL_A)",
27 + "description": "Start a knife round with a side-pick at the end."
28 + },
29 + {
30 + "name": "say /knife",
31 + "access": "g (ADMIN_LEVEL_A)",
32 + "description": "Same as csb_kniferound."
33 + }
34 + ],
35 + "main": "addons/amxmodx/scripting/csb_knife_round.sma"
36 +}
0 37