Promover servidor
Black Friday Termina em 50% de desconto num lugar no Master Server e na lista Client, que inclui PREMIUM VITALICIO
01 Dias 12 Hrs 46 Min 15 Seg
Ver as ofertas

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit b48bcd8ba47011c444b879ed90b06b6495268fea
4 changed files with 218 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 Spawn Protection</strong> gives every player a short burst of invulnerability the moment they respawn, so they cannot be instantly gunned down before they even load in. This is essential on DM and CSDM servers where players respawn constantly and spawn-camping otherwise ruins the round.</p><h2>How it works</h2><p>On <code>Ham_Spawn</code> the player gets <code>set_user_godmode</code> plus a <strong>team-coloured glow shell</strong> and a translucent model, so everyone can see at a glance who is still protected and will not waste bullets on them. The protection is removed the instant the player fires (<code>csb_spawnprot_breakfire</code>), optionally when they move (<code>csb_spawnprot_breakmove</code>), or when the timer expires &mdash; whichever comes first.</p><h2>Features</h2><ul><li>Configurable duration via <code>csb_spawnprot_time</code> (fractional seconds allowed).</li><li>Team-coloured glow (red for T, blue for CT) so protection is obvious to other players.</li><li>Breaks on first shot and/or on first movement, both cvar-controlled.</li><li>Rendering and godmode are always cleanly restored, even on disconnect mid-protection.</li></ul><h2>Installation</h2><ol><li>Compile and copy <code>csb_spawn_protection.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.</li></ol>
+163 -0 addons/amxmodx/scripting/csb_spawn_protection.sma A
@@ -0,0 +1,163 @@
1 +/*
2 + * CSB Spawn Protection
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * Gives players a short window of invulnerability when they spawn, with a
6 + * visible glow shell so everyone can see who is still protected. Protection is
7 + * dropped early when the player fires (cvar) or moves (cvar), and always ends
8 + * when the timer runs out. Built for DM / CSDM style servers where players
9 + * respawn constantly and spawn-camping is a real problem.
10 + *
11 + * This is an independent GPL implementation; it is not based on any other
12 + * plugin's source.
13 + *
14 + * This program is free software: you can redistribute it and/or modify it
15 + * under the terms of the GNU General Public License as published by the Free
16 + * Software Foundation, either version 3 of the License, or (at your option)
17 + * any later version. It is distributed in the hope that it will be useful,
18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
20 + * Public License for more details: <https://www.gnu.org/licenses/>.
21 + */
22 +
23 +#include <amxmodx>
24 +#include <fakemeta>
25 +#include <hamsandwich>
26 +#include <fun>
27 +
28 +new const PLUGIN[] = "CSB Spawn Protection"
29 +new const VERSION[] = "1.0.0"
30 +new const AUTHOR[] = "counter-strike-boost.com"
31 +
32 +#define TASK_END 5000
33 +
34 +new g_pEnabled, g_pTime, g_pBreakFire, g_pBreakMove, g_pAlpha
35 +
36 +new bool:g_bProtected[33]
37 +
38 +public plugin_init()
39 +{
40 + register_plugin(PLUGIN, VERSION, AUTHOR)
41 +
42 + g_pEnabled = register_cvar("csb_spawnprot_enabled", "1")
43 + g_pTime = register_cvar("csb_spawnprot_time", "3.0")
44 + g_pBreakFire = register_cvar("csb_spawnprot_breakfire", "1")
45 + g_pBreakMove = register_cvar("csb_spawnprot_breakmove", "0")
46 + g_pAlpha = register_cvar("csb_spawnprot_alpha", "160")
47 +
48 + RegisterHam(Ham_Spawn, "player", "fwdSpawnPost", 1)
49 + register_forward(FM_CmdStart, "fwdCmdStart")
50 + register_event("DeathMsg", "evDeath", "a")
51 +}
52 +
53 +public fwdSpawnPost(id)
54 +{
55 + if (!get_pcvar_num(g_pEnabled))
56 + return
57 +
58 + if (!is_user_alive(id) || !is_user_connected(id))
59 + return
60 +
61 + new Float:seconds = get_pcvar_float(g_pTime)
62 +
63 + if (seconds <= 0.0)
64 + return
65 +
66 + startProtection(id, seconds)
67 +}
68 +
69 +startProtection(id, Float:seconds)
70 +{
71 + g_bProtected[id] = true
72 + set_user_godmode(id, 1)
73 +
74 + new r, g, b
75 + teamColor(id, r, g, b)
76 +
77 + set_user_rendering(id, kRenderFxGlowShell, r, g, b, kRenderNormal, 16)
78 +
79 + /* also make the model itself slightly translucent */
80 + new alpha = clamp(get_pcvar_num(g_pAlpha), 0, 255)
81 + set_pev(id, pev_rendermode, kRenderTransColor)
82 + set_pev(id, pev_renderamt, float(alpha))
83 +
84 + remove_task(id + TASK_END)
85 + set_task(seconds, "taskEnd", id + TASK_END)
86 +
87 + client_print(id, print_center, "* Spawn protection active for %.1f seconds *", seconds)
88 +}
89 +
90 +teamColor(id, &r, &g, &b)
91 +{
92 + /* CS: team 1 = T (red), team 2 = CT (blue) */
93 + switch (pev(id, pev_team))
94 + {
95 + case 1: { r = 255; g = 80; b = 80; }
96 + case 2: { r = 80; g = 120; b = 255; }
97 + default: { r = 200; g = 200; b = 200; }
98 + }
99 +}
100 +
101 +public taskEnd(taskid)
102 +{
103 + new id = taskid - TASK_END
104 + endProtection(id, true)
105 +}
106 +
107 +endProtection(id, bool:notify)
108 +{
109 + if (!g_bProtected[id])
110 + return
111 +
112 + g_bProtected[id] = false
113 + remove_task(id + TASK_END)
114 +
115 + if (is_user_connected(id))
116 + {
117 + set_user_godmode(id, 0)
118 + set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 16)
119 + set_pev(id, pev_rendermode, kRenderNormal)
120 + set_pev(id, pev_renderamt, 0.0)
121 +
122 + if (notify && is_user_alive(id))
123 + client_print(id, print_center, "* Spawn protection ended *")
124 + }
125 +}
126 +
127 +public fwdCmdStart(id, uc_handle, seed)
128 +{
129 + if (!g_bProtected[id] || !is_user_alive(id))
130 + return FMRES_IGNORED
131 +
132 + new buttons = get_uc(uc_handle, UC_Buttons)
133 +
134 + if (get_pcvar_num(g_pBreakFire) && (buttons & IN_ATTACK))
135 + {
136 + endProtection(id, true)
137 + return FMRES_IGNORED
138 + }
139 +
140 + if (get_pcvar_num(g_pBreakMove))
141 + {
142 + new moveMask = IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP | IN_DUCK
143 +
144 + if (buttons & moveMask)
145 + endProtection(id, true)
146 + }
147 +
148 + return FMRES_IGNORED
149 +}
150 +
151 +public evDeath()
152 +{
153 + new victim = read_data(2)
154 +
155 + if (1 <= victim <= 32)
156 + endProtection(victim, false)
157 +}
158 +
159 +public client_disconnected(id)
160 +{
161 + g_bProtected[id] = false
162 + remove_task(id + TASK_END)
163 +}
+51 -0 csb.json A
@@ -0,0 +1,51 @@
1 +{
2 + "name": "CSB Spawn Protection",
3 + "category": "movement",
4 + "tags": "spawn, protection, godmode",
5 + "image": "",
6 + "original_author": "",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Spawn Protection",
10 + "short_desc": "Short invulnerability at spawn with a visible team-coloured glow, dropped when you shoot or move.",
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,fun",
20 + "install_notes": "1. Put csb_spawn_protection.amxx in addons/amxmodx/plugins/\n2. Add it to plugins.ini\n3. Change map",
21 + "known_conflicts": "Other spawn-protection / god-on-spawn plugins - run only one.",
22 + "cvars": [
23 + {
24 + "name": "csb_spawnprot_enabled",
25 + "default": "1",
26 + "description": "Enable or disable spawn protection."
27 + },
28 + {
29 + "name": "csb_spawnprot_time",
30 + "default": "3.0",
31 + "description": "Protection duration in seconds."
32 + },
33 + {
34 + "name": "csb_spawnprot_breakfire",
35 + "default": "1",
36 + "description": "End protection when the player shoots."
37 + },
38 + {
39 + "name": "csb_spawnprot_breakmove",
40 + "default": "0",
41 + "description": "End protection when the player moves."
42 + },
43 + {
44 + "name": "csb_spawnprot_alpha",
45 + "default": "160",
46 + "description": "Model transparency (0-255) while protected."
47 + }
48 + ],
49 + "commands": [],
50 + "main": "addons/amxmodx/scripting/csb_spawn_protection.sma"
51 +}
0 52