Romania XPlayZM.CSBlackDevil.COM # Zombie Plague UltimateX [ Respawn + FDL + VIP 22-12PM + POINTS] ® 17/32
Unknown ❤ RESPAWN.ZAFEST.RO | VIP FREE | FREE FOR ALL ❤ 0/32
Germany ELITE.WORLDCS.RO # [SKINS |VIP + REVIVE| RANKS] 22/32
Server bewerben

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit 35f03df4a274f41f1bededbcc311d893273ea5cf
4 changed files with 294 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 Admin HP &amp; Armor</strong> hands out health and armour cleanly. <code>amx_hp &lt;target&gt; &lt;amount&gt;</code> sets the value, and a leading <code>+</code> (<code>amx_hp &lt;target&gt; +50</code>) adds to the current value instead. <code>amx_armor</code> works the same way. Both are clamped by <code>csb_hp_max</code> / <code>csb_armor_max</code> so nobody ends up with a broken health bar.</p><h2>Features</h2><ul><li><code>amx_hp</code> and <code>amx_armor</code> with set-or-add (<code>+</code>) syntax.</li><li><code>amx_hpmenu</code>: pick a player, then a preset amount (25/50/100/150/200/255), with a one-click HP&harr;armour switch.</li><li>Values clamped to the configured maximums via <code>set_user_health</code> / <code>set_user_armor</code>.</li><li>Every change is announced in the admin chat channel and written to the AMXX log.</li></ul><h2>Installation</h2><ol><li>Enable the <code>fun</code> module in <code>addons/amxmodx/configs/modules.ini</code>.</li><li>Compile <code>csb_admin_hp_armor.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><p>All commands need the <code>ADMIN_LEVEL_A</code> flag (<code>b</code>) by default.</p>
+238 -0 addons/amxmodx/scripting/csb_admin_hp_armor.sma A
@@ -0,0 +1,238 @@
1 +/*
2 + * CSB Admin HP & Armor
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * amx_hp and amx_armor set (or add, with a leading +) health/armour on a target,
6 + * clamped by cvars. amx_hpmenu opens a player list and a preset-amount menu. Every
7 + * change is announced to admins and written to the AMXX log.
8 + *
9 + * This program is free software: you can redistribute it and/or modify it under
10 + * the terms of the GNU General Public License as published by the Free Software
11 + * Foundation, either version 3 of the License, or (at your option) any later
12 + * version. It is distributed in the hope that it will be useful, but WITHOUT
13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details.
15 + */
16 +
17 +#include <amxmodx>
18 +#include <amxmisc>
19 +#include <fun>
20 +
21 +new const PLUGIN[] = "CSB Admin HP & Armor"
22 +new const VERSION[] = "1.0.0"
23 +new const AUTHOR[] = "counter-strike-boost.com"
24 +
25 +new const g_iPresets[] = { 25, 50, 100, 150, 200, 255 }
26 +
27 +new g_pMaxHp, g_pMaxArmor
28 +new g_iMenuTarget[33] /* userid stored while the amount menu is open */
29 +new bool:g_bMenuArmor[33] /* false = HP menu, true = armour menu */
30 +
31 +public plugin_init()
32 +{
33 + register_plugin(PLUGIN, VERSION, AUTHOR)
34 +
35 + g_pMaxHp = register_cvar("csb_hp_max", "1000")
36 + g_pMaxArmor = register_cvar("csb_armor_max", "255")
37 +
38 + register_concmd("amx_hp", "cmdHp", ADMIN_LEVEL_A, "<target> <[+]amount> - set or add health")
39 + register_concmd("amx_armor", "cmdArmor", ADMIN_LEVEL_A, "<target> <[+]amount> - set or add armour")
40 + register_concmd("amx_hpmenu", "cmdMenu", ADMIN_LEVEL_A, "- open the HP/armour menu")
41 +}
42 +
43 +applyValue(id, target, bool:armor, const arg[])
44 +{
45 + new bool:add = (arg[0] == '+')
46 + new offset = add ? 1 : 0
47 + new amount = str_to_num(arg[offset])
48 +
49 + new cur = armor ? get_user_armor(target) : get_user_health(target)
50 + new value = add ? cur + amount : amount
51 +
52 + new maxVal = armor ? get_pcvar_num(g_pMaxArmor) : get_pcvar_num(g_pMaxHp)
53 + if (value < 1)
54 + value = 1
55 + if (value > maxVal)
56 + value = maxVal
57 +
58 + if (armor)
59 + set_user_armor(target, value)
60 + else
61 + set_user_health(target, value)
62 +
63 + new aname[32], tname[32]
64 + getName(id, aname, charsmax(aname))
65 + get_user_name(target, tname, charsmax(tname))
66 +
67 + announceAdmins("^x04[CSB]^x03 %s^x01 set^x04 %s^x01 %s to^x03 %d^x01.",
68 + aname, tname, armor ? "armour" : "HP", value)
69 + log_amx("[CSB HP/Armor] %s set %s %s to %d", aname, tname, armor ? "armor" : "hp", value)
70 +}
71 +
72 +public cmdHp(id, level, cid)
73 +{
74 + return genericSetCmd(id, level, cid, false)
75 +}
76 +
77 +public cmdArmor(id, level, cid)
78 +{
79 + return genericSetCmd(id, level, cid, true)
80 +}
81 +
82 +genericSetCmd(id, level, cid, bool:armor)
83 +{
84 + if (!cmd_access(id, level, cid, 3))
85 + return PLUGIN_HANDLED
86 +
87 + new arg[32]
88 + read_argv(1, arg, charsmax(arg))
89 +
90 + new target = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
91 + if (!target)
92 + return PLUGIN_HANDLED
93 +
94 + if (!is_user_alive(target))
95 + {
96 + client_print(id, print_chat, "[CSB] That player is not alive.")
97 + return PLUGIN_HANDLED
98 + }
99 +
100 + new amt[16]
101 + read_argv(2, amt, charsmax(amt))
102 +
103 + applyValue(id, target, armor, amt)
104 + return PLUGIN_HANDLED
105 +}
106 +
107 +public cmdMenu(id, level, cid)
108 +{
109 + if (!cmd_access(id, level, cid, 1))
110 + return PLUGIN_HANDLED
111 +
112 + showPlayerMenu(id)
113 + return PLUGIN_HANDLED
114 +}
115 +
116 +showPlayerMenu(id)
117 +{
118 + new menu = menu_create("\yCSB HP/Armor\w^nPick a player", "menuPlayer")
119 +
120 + new players[32], num, pid, name[32], info[8]
121 + get_players(players, num, "h") /* skip HLTV */
122 +
123 + for (new i = 0; i < num; i++)
124 + {
125 + pid = players[i]
126 + get_user_name(pid, name, charsmax(name))
127 + num_to_str(get_user_userid(pid), info, charsmax(info))
128 + menu_additem(menu, name, info, 0)
129 + }
130 +
131 + menu_display(id, menu, 0)
132 +}
133 +
134 +public menuPlayer(id, menu, item)
135 +{
136 + if (item == MENU_EXIT || item < 0)
137 + {
138 + menu_destroy(menu)
139 + return PLUGIN_HANDLED
140 + }
141 +
142 + new info[8], name[32], access, callback
143 + menu_item_getinfo(menu, item, access, info, charsmax(info), name, charsmax(name), callback)
144 + menu_destroy(menu)
145 +
146 + g_iMenuTarget[id] = str_to_num(info)
147 + showAmountMenu(id)
148 + return PLUGIN_HANDLED
149 +}
150 +
151 +showAmountMenu(id)
152 +{
153 + new target = find_player("k", g_iMenuTarget[id])
154 + if (!target)
155 + {
156 + client_print(id, print_chat, "[CSB] That player has left.")
157 + return
158 + }
159 +
160 + new title[64], tname[32]
161 + get_user_name(target, tname, charsmax(tname))
162 + formatex(title, charsmax(title), "\yTarget: %s^n\wChoose amount", tname)
163 +
164 + new menu = menu_create(title, "menuAmount")
165 +
166 + new line[32], info[8]
167 +
168 + for (new i = 0; i < sizeof(g_iPresets); i++)
169 + {
170 + formatex(line, charsmax(line), "%s: %d", g_bMenuArmor[id] ? "Armour" : "HP", g_iPresets[i])
171 + num_to_str(g_iPresets[i], info, charsmax(info))
172 + menu_additem(menu, line, info, 0)
173 + }
174 +
175 + menu_additem(menu, g_bMenuArmor[id] ? "\ySwitch to HP" : "\ySwitch to Armour", "toggle", 0)
176 +
177 + menu_display(id, menu, 0)
178 +}
179 +
180 +public menuAmount(id, menu, item)
181 +{
182 + if (item == MENU_EXIT || item < 0)
183 + {
184 + menu_destroy(menu)
185 + return PLUGIN_HANDLED
186 + }
187 +
188 + new info[8], name[32], access, callback
189 + menu_item_getinfo(menu, item, access, info, charsmax(info), name, charsmax(name), callback)
190 + menu_destroy(menu)
191 +
192 + if (equal(info, "toggle"))
193 + {
194 + g_bMenuArmor[id] = !g_bMenuArmor[id]
195 + showAmountMenu(id)
196 + return PLUGIN_HANDLED
197 + }
198 +
199 + new target = find_player("k", g_iMenuTarget[id])
200 + if (!target || !is_user_alive(target))
201 + {
202 + client_print(id, print_chat, "[CSB] Target is gone or dead.")
203 + return PLUGIN_HANDLED
204 + }
205 +
206 + applyValue(id, target, g_bMenuArmor[id], info)
207 + showAmountMenu(id)
208 + return PLUGIN_HANDLED
209 +}
210 +
211 +announceAdmins(const fmt[], any:...)
212 +{
213 + new msg[192]
214 + vformat(msg, charsmax(msg), fmt, 2)
215 +
216 + new players[32], num, pid, msgid = get_user_msgid("SayText")
217 + get_players(players, num, "ch")
218 +
219 + for (new i = 0; i < num; i++)
220 + {
221 + pid = players[i]
222 + if (!(get_user_flags(pid) & ADMIN_LEVEL_A))
223 + continue
224 +
225 + message_begin(MSG_ONE, msgid, _, pid)
226 + write_byte(pid)
227 + write_string(msg)
228 + message_end()
229 + }
230 +}
231 +
232 +getName(id, name[], len)
233 +{
234 + if (id)
235 + get_user_name(id, name, len)
236 + else
237 + copy(name, len, "CONSOLE")
238 +}
+52 -0 csb.json A
@@ -0,0 +1,52 @@
1 +{
2 + "name": "CSB Admin HP & Armor",
3 + "category": "admin",
4 + "tags": "hp, armor, give",
5 + "image": "",
6 + "original_author": "",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Admin HP & Armor",
10 + "short_desc": "amx_hp / amx_armor set or add (+N) health and armour, clamped by cvars, with a player + preset-amount menu. Every change is announced and logged.",
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": "fun",
20 + "install_notes": "1. Enable the fun module in addons/amxmodx/configs/modules.ini\n2. Put csb_admin_hp_armor.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n3. Change map",
21 + "known_conflicts": "Damage-scaling or god-mode plugins can immediately overwrite the health/armour you set.",
22 + "cvars": [
23 + {
24 + "name": "csb_hp_max",
25 + "default": "1000",
26 + "description": "Maximum health amx_hp will apply."
27 + },
28 + {
29 + "name": "csb_armor_max",
30 + "default": "255",
31 + "description": "Maximum armour amx_armor will apply."
32 + }
33 + ],
34 + "commands": [
35 + {
36 + "name": "amx_hp",
37 + "access": "b (ADMIN_LEVEL_A)",
38 + "description": "amx_hp <target> <[+]amount> - set or add health."
39 + },
40 + {
41 + "name": "amx_armor",
42 + "access": "b (ADMIN_LEVEL_A)",
43 + "description": "amx_armor <target> <[+]amount> - set or add armour."
44 + },
45 + {
46 + "name": "amx_hpmenu",
47 + "access": "b (ADMIN_LEVEL_A)",
48 + "description": "Open the player + preset-amount menu."
49 + }
50 + ],
51 + "main": "addons/amxmodx/scripting/csb_admin_hp_armor.sma"
52 +}
0 53