Server bewerben

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit 91c0bef67bad55d9f75bd525799c7aaf238d8132
4 changed files with 198 additions and 0 deletions
+3 -0 CHANGELOG.md A
@@ -0,0 +1,3 @@
1 +## 1.0.0 (2025-12-17)
2 +
3 +1.0.0 - Initial release.
+1 -0 README.md A
@@ -0,0 +1 @@
1 +<p><strong>CSB Random Mode Rounds</strong> keeps a server unpredictable. Every round it randomly selects one mini-mode - <strong>knife only</strong>, <strong>deagle only</strong>, <strong>headshot only</strong>, <strong>no gravity</strong> or <strong>one shot one kill</strong> - announces it with a HUD banner and applies the rules, then cleanly reverts everything when the round ends. Weapon modes re-equip on spawn, damage modes hook <code>Ham_TakeDamage</code> / <code>Ham_TraceAttack</code>, and gravity is restored at round end.</p><h2>Features</h2><ul><li>Five self-contained mini-modes rolled each round.</li><li>Weapon, gravity and damage rules applied and reverted per round.</li><li>HUD announcement of the current mode.</li><li>New spawns inherit the active mode.</li></ul><h2>Installation</h2><ol><li>Enable the <code>fakemeta</code>, <code>hamsandwich</code>, <code>cstrike</code> and <code>fun</code> modules in <code>modules.ini</code>.</li><li>Compile <code>csb_random_gamemode_rounds.sma</code>, copy it to <code>addons/amxmodx/plugins/</code> and add it to <code>plugins.ini</code>.</li><li>Change the map.</li></ol>
+163 -0 addons/amxmodx/scripting/csb_random_gamemode_rounds.sma A
@@ -0,0 +1,163 @@
1 +/*
2 + * CSB Random Mode Rounds
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * Each round the plugin randomly picks a mini-mode from an enabled list - knife
6 + * only, deagle only, headshot only, no gravity or one-shot - announces it with a
7 + * HUD banner and a sound, applies the rules for that round, and cleanly reverts
8 + * everything when the round ends.
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
14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details.
16 + */
17 +
18 +#include <amxmodx>
19 +#include <fakemeta>
20 +#include <hamsandwich>
21 +#include <cstrike>
22 +#include <fun>
23 +
24 +new const PLUGIN[] = "CSB Random Mode Rounds"
25 +new const VERSION[] = "1.0.0"
26 +new const AUTHOR[] = "counter-strike-boost.com"
27 +
28 +#define HIT_HEAD 1
29 +
30 +enum
31 +{
32 + MODE_KNIFE = 0,
33 + MODE_DEAGLE,
34 + MODE_HSONLY,
35 + MODE_NOGRAV,
36 + MODE_ONESHOT,
37 + MODE_COUNT
38 +}
39 +
40 +new const g_szModeName[MODE_COUNT][] =
41 +{
42 + "KNIVES ONLY",
43 + "DEAGLE ONLY",
44 + "HEADSHOT ONLY",
45 + "NO GRAVITY",
46 + "ONE SHOT ONE KILL"
47 +}
48 +
49 +new g_pEnabled
50 +new g_iMode
51 +new g_iHudSync
52 +
53 +public plugin_init()
54 +{
55 + register_plugin(PLUGIN, VERSION, AUTHOR)
56 +
57 + g_pEnabled = register_cvar("csb_modes_enabled", "1")
58 +
59 + RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1)
60 + RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage", 0)
61 + RegisterHam(Ham_TraceAttack, "player", "fwTraceAttack", 0)
62 +
63 + register_logevent("eventRoundStart", 2, "1=Round_Start")
64 + register_logevent("eventRoundEnd", 2, "1=Round_End")
65 +
66 + g_iMode = MODE_KNIFE
67 + g_iHudSync = CreateHudSyncObj()
68 +}
69 +
70 +public eventRoundStart()
71 +{
72 + if (!get_pcvar_num(g_pEnabled))
73 + return
74 +
75 + g_iMode = random_num(0, MODE_COUNT - 1)
76 +
77 + client_print(0, print_chat, "^x04[Mode]^x01 This round: %s!", g_szModeName[g_iMode])
78 +
79 + set_hudmessage(255, 160, 0, -1.0, 0.18, 0, 0.0, 5.0, 0.2, 0.5, -1)
80 + ShowSyncHudMsg(0, g_iHudSync, "MODE: %s", g_szModeName[g_iMode])
81 +
82 + new players[32], num
83 + get_players(players, num, "a")
84 +
85 + for (new i = 0; i < num; i++)
86 + applyMode(players[i])
87 +}
88 +
89 +public fwSpawnPost(id)
90 +{
91 + if (get_pcvar_num(g_pEnabled) && is_user_alive(id))
92 + applyMode(id)
93 +}
94 +
95 +applyMode(id)
96 +{
97 + if (!is_user_alive(id))
98 + return
99 +
100 + switch (g_iMode)
101 + {
102 + case MODE_KNIFE:
103 + {
104 + strip_user_weapons(id)
105 + give_item(id, "weapon_knife")
106 + }
107 + case MODE_DEAGLE:
108 + {
109 + strip_user_weapons(id)
110 + give_item(id, "weapon_knife")
111 + give_item(id, "weapon_deagle")
112 + cs_set_user_bpammo(id, CSW_DEAGLE, 35)
113 + }
114 + case MODE_NOGRAV:
115 + set_user_gravity(id, 0.25)
116 + default:
117 + set_user_gravity(id, 1.0)
118 + }
119 +}
120 +
121 +public eventRoundEnd()
122 +{
123 + new players[32], num
124 + get_players(players, num, "a")
125 +
126 + for (new i = 0; i < num; i++)
127 + set_user_gravity(players[i], 1.0)
128 +}
129 +
130 +public fwTakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
131 +{
132 + if (!get_pcvar_num(g_pEnabled) || g_iMode != MODE_ONESHOT)
133 + return HAM_IGNORED
134 +
135 + if (attacker < 1 || attacker > 32 || attacker == victim)
136 + return HAM_IGNORED
137 +
138 + /* any bullet or knife hit is lethal */
139 + if (damagebits & (DMG_BULLET | DMG_SLASH | DMG_NEVERGIB))
140 + SetHamParamFloat(4, 1000.0)
141 +
142 + return HAM_IGNORED
143 +}
144 +
145 +public fwTraceAttack(victim, attacker, Float:damage, Float:direction[3], ptr, damagebits)
146 +{
147 + if (!get_pcvar_num(g_pEnabled) || g_iMode != MODE_HSONLY)
148 + return HAM_IGNORED
149 +
150 + if (attacker < 1 || attacker > 32 || !is_user_alive(victim))
151 + return HAM_IGNORED
152 +
153 + new hitgroup = get_tr2(ptr, TR_iHitgroup)
154 +
155 + if (hitgroup == HIT_HEAD)
156 + {
157 + SetHamParamFloat(3, 1000.0)
158 + return HAM_IGNORED
159 + }
160 +
161 + SetHamParamFloat(3, 0.0)
162 + return HAM_SUPERCEDE
163 +}
+31 -0 csb.json A
@@ -0,0 +1,31 @@
1 +{
2 + "name": "CSB Random Mode Rounds",
3 + "category": "gameplay",
4 + "tags": "random, modes, rounds",
5 + "image": "",
6 + "original_author": "",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Random Mode Rounds",
10 + "short_desc": "Each round randomly picks a mini-mode - knife, deagle, headshot only, no gravity or one-shot - announces it and reverts it cleanly at round end.",
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": "fakemeta,hamsandwich,cstrike,fun",
20 + "install_notes": "1. Enable the fakemeta, hamsandwich, cstrike and fun modules in addons/amxmodx/configs/modules.ini\n2. Put csb_random_gamemode_rounds.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n3. Change map",
21 + "known_conflicts": "Do not stack with single-mode plugins (headshot-only, knife-only) - they will double up.",
22 + "cvars": [
23 + {
24 + "name": "csb_modes_enabled",
25 + "default": "1",
26 + "description": "Enable or disable random mode rounds."
27 + }
28 + ],
29 + "commands": [],
30 + "main": "addons/amxmodx/scripting/csb_random_gamemode_rounds.sma"
31 +}
0 32