Promocionar servidor

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit cf9b5aafcab06797c105565c6c472985617d363f
4 changed files with 267 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 Chat</strong> gives admins three chat channels, chosen by how many <code>@</code> characters they type:</p><ul><li><code>@message</code> &mdash; private channel; only players holding the admin flag see it.</li><li><code>@@message</code> &mdash; a coloured announcement to every player.</li><li><code>@@@message</code> &mdash; a centred HUD message (also mirrored in chat, because a HUD message is easy to miss).</li></ul><p>Everything is re-emitted with <code>message_begin(MSG_ONE, SayText)</code> and the sender's entity index, so the standard colour codes (<code>^x01</code> normal, <code>^x03</code> team colour, <code>^x04</code> green) render correctly and the <code>(DEAD)</code> marker stays accurate in the admin channel.</p><p>Inspired by <em>Admin Chat Colored</em> by AlexALX. Independent GPL re-implementation.</p><h2>Features</h2><ul><li>Access flag is a cvar (<code>csb_achat_flag</code>, default <code>d</code> = ADMIN_BAN), parsed with <code>read_flags()</code>.</li><li>Configurable prefix (default <code>ADMIN</code>) &mdash; set it to <code>OWNER</code>, your clan tag, whatever.</li><li>HUD colour and hold time are cvars.</li><li>Every message is written to the AMXX log with the admin's name, SteamID and channel &mdash; useful when someone claims an admin was abusive.</li><li>Non-admins typing <code>@</code> are simply passed through to normal chat; nothing is swallowed.</li></ul><h2>Installation</h2><ol><li>Compile and copy <code>csb_admin_chat.amxx</code> into <code>addons/amxmodx/plugins/</code>.</li><li>Add it to <code>addons/amxmodx/configs/plugins.ini</code>.</li><li>Optionally set <code>csb_achat_flag</code> and <code>csb_achat_prefix</code> in <code>amxx.cfg</code>.</li><li>Change the map.</li></ol><h2>Notes</h2><p>No modules are required &mdash; the plugin only uses core natives, so it loads on any AMX Mod X 1.9 install with no extra modules enabled.</p>
+186 -0 addons/amxmodx/scripting/csb_admin_chat.sma A
@@ -0,0 +1,186 @@
1 +/*
2 + * CSB Admin Chat
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * Prefixed admin chat channels:
6 + * @text -> private channel, only admins see it
7 + * @@text -> coloured server announcement to everyone
8 + * @@@text -> centred HUD message to everyone
9 + *
10 + * Inspired by "Admin Chat Colored" by AlexALX. This is an independent GPL
11 + * re-implementation written from scratch.
12 + *
13 + * This program is free software: you can redistribute it and/or modify it under
14 + * the terms of the GNU General Public License as published by the Free Software
15 + * Foundation, either version 3 of the License, or (at your option) any later
16 + * version. It is distributed in the hope that it will be useful, but WITHOUT ANY
17 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 + * A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details.
19 + */
20 +
21 +#include <amxmodx>
22 +#include <amxmisc>
23 +
24 +new const PLUGIN[] = "CSB Admin Chat"
25 +new const VERSION[] = "1.0.0"
26 +new const AUTHOR[] = "counter-strike-boost.com"
27 +
28 +new g_pEnabled, g_pFlag, g_pPrefix, g_pHudRed, g_pHudGreen, g_pHudBlue, g_pHudHold
29 +new g_msgSayText
30 +
31 +public plugin_init()
32 +{
33 + register_plugin(PLUGIN, VERSION, AUTHOR)
34 +
35 + g_pEnabled = register_cvar("csb_achat_enabled", "1")
36 + g_pFlag = register_cvar("csb_achat_flag", "d") /* ADMIN_BAN by default */
37 + g_pPrefix = register_cvar("csb_achat_prefix", "ADMIN")
38 + g_pHudRed = register_cvar("csb_achat_hud_r", "255")
39 + g_pHudGreen = register_cvar("csb_achat_hud_g", "160")
40 + g_pHudBlue = register_cvar("csb_achat_hud_b", "0")
41 + g_pHudHold = register_cvar("csb_achat_hud_hold", "6.0")
42 +
43 + register_clcmd("say", "cmdSay")
44 + register_clcmd("say_team", "cmdSay")
45 +
46 + g_msgSayText = get_user_msgid("SayText")
47 +}
48 +
49 +public cmdSay(id)
50 +{
51 + if (!get_pcvar_num(g_pEnabled))
52 + return PLUGIN_CONTINUE
53 +
54 + new said[192]
55 + read_args(said, charsmax(said))
56 + remove_quotes(said)
57 + trim(said)
58 +
59 + if (said[0] != '@')
60 + return PLUGIN_CONTINUE
61 +
62 + new flagStr[8]
63 + get_pcvar_string(g_pFlag, flagStr, charsmax(flagStr))
64 +
65 + if (!(get_user_flags(id) & read_flags(flagStr)))
66 + return PLUGIN_CONTINUE
67 +
68 + new level = 0
69 +
70 + while (level < 3 && said[level] == '@')
71 + level++
72 +
73 + new text[192]
74 + copy(text, charsmax(text), said[level])
75 + trim(text)
76 +
77 + if (!text[0])
78 + {
79 + client_print(id, print_chat, "[CSB] Usage: @message (admins) / @@message (all) / @@@message (HUD)")
80 + return PLUGIN_HANDLED
81 + }
82 +
83 + new name[32], prefix[24]
84 + get_user_name(id, name, charsmax(name))
85 + get_pcvar_string(g_pPrefix, prefix, charsmax(prefix))
86 +
87 + switch (level)
88 + {
89 + case 1: sendAdminChat(id, name, prefix, text)
90 + case 2: sendPublicChat(id, name, prefix, text)
91 + case 3: sendHudMessage(id, name, prefix, text)
92 + }
93 +
94 + logIt(id, level, text)
95 + return PLUGIN_HANDLED
96 +}
97 +
98 +sendAdminChat(id, const name[], const prefix[], const text[])
99 +{
100 + new buf[192], flagStr[8]
101 + get_pcvar_string(g_pFlag, flagStr, charsmax(flagStr))
102 +
103 + new flags = read_flags(flagStr)
104 + new alive = is_user_alive(id) ? 0 : 1
105 +
106 + formatex(buf, charsmax(buf), "^x04(%s)%s^x03 %s^x01 : %s", prefix, alive ? "(DEAD)" : "", name, text)
107 +
108 + new players[32], num, pid
109 + get_players(players, num, "ch")
110 +
111 + for (new i = 0; i < num; i++)
112 + {
113 + pid = players[i]
114 +
115 + if (!(get_user_flags(pid) & flags))
116 + continue
117 +
118 + message_begin(MSG_ONE, g_msgSayText, _, pid)
119 + write_byte(id)
120 + write_string(buf)
121 + message_end()
122 + }
123 +}
124 +
125 +sendPublicChat(id, const name[], const prefix[], const text[])
126 +{
127 + new buf[192]
128 + formatex(buf, charsmax(buf), "^x04[%s]^x03 %s^x01 : ^x04%s", prefix, name, text)
129 +
130 + new players[32], num
131 + get_players(players, num, "ch")
132 +
133 + for (new i = 0; i < num; i++)
134 + {
135 + message_begin(MSG_ONE, g_msgSayText, _, players[i])
136 + write_byte(id)
137 + write_string(buf)
138 + message_end()
139 + }
140 +}
141 +
142 +sendHudMessage(id, const name[], const prefix[], const text[])
143 +{
144 + new Float:hold = get_pcvar_float(g_pHudHold)
145 +
146 + if (hold < 1.0)
147 + hold = 1.0
148 +
149 + set_hudmessage(get_pcvar_num(g_pHudRed), get_pcvar_num(g_pHudGreen), get_pcvar_num(g_pHudBlue),
150 + -1.0, 0.25, 0, 0.5, hold, 0.1, 0.2, 4)
151 +
152 + show_hudmessage(0, "[%s] %s:^n%s", prefix, name, text)
153 +
154 + /* a HUD message is easy to miss, so mirror it in chat as well */
155 + new buf[192]
156 + formatex(buf, charsmax(buf), "^x04[%s]^x03 %s^x01 : ^x04%s", prefix, name, text)
157 +
158 + new players[32], num
159 + get_players(players, num, "ch")
160 +
161 + for (new i = 0; i < num; i++)
162 + {
163 + message_begin(MSG_ONE, g_msgSayText, _, players[i])
164 + write_byte(id)
165 + write_string(buf)
166 + message_end()
167 + }
168 +}
169 +
170 +logIt(id, level, const text[])
171 +{
172 + new name[32], authid[35]
173 + get_user_name(id, name, charsmax(name))
174 + get_user_authid(id, authid, charsmax(authid))
175 +
176 + new channel[16]
177 +
178 + switch (level)
179 + {
180 + case 1: copy(channel, charsmax(channel), "admins")
181 + case 2: copy(channel, charsmax(channel), "all")
182 + case 3: copy(channel, charsmax(channel), "hud")
183 + }
184 +
185 + log_amx("[CSB Admin Chat] %s <%s> (%s): %s", name, authid, channel, text)
186 +}
+77 -0 csb.json A
@@ -0,0 +1,77 @@
1 +{
2 + "name": "CSB Admin Chat",
3 + "category": "admin",
4 + "tags": "admin chat, say, colorchat",
5 + "image": "",
6 + "original_author": "AlexALX (Admin Chat Colored)",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Admin Chat",
10 + "short_desc": "@ for the admin-only channel, @@ for a coloured server announcement, @@@ for a HUD message.",
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_admin_chat.amxx in addons/amxmodx/plugins/\n2. Add it to plugins.ini\n3. Change map\nNo extra modules needed.",
21 + "known_conflicts": "Other plugins that hook say and return PLUGIN_HANDLED on messages starting with @.",
22 + "cvars": [
23 + {
24 + "name": "csb_achat_enabled",
25 + "default": "1",
26 + "description": "Enable or disable the admin chat channels."
27 + },
28 + {
29 + "name": "csb_achat_flag",
30 + "default": "d",
31 + "description": "Access flag required to use the channels."
32 + },
33 + {
34 + "name": "csb_achat_prefix",
35 + "default": "ADMIN",
36 + "description": "Prefix shown in front of the message."
37 + },
38 + {
39 + "name": "csb_achat_hud_r",
40 + "default": "255",
41 + "description": "HUD message red component."
42 + },
43 + {
44 + "name": "csb_achat_hud_g",
45 + "default": "160",
46 + "description": "HUD message green component."
47 + },
48 + {
49 + "name": "csb_achat_hud_b",
50 + "default": "0",
51 + "description": "HUD message blue component."
52 + },
53 + {
54 + "name": "csb_achat_hud_hold",
55 + "default": "6.0",
56 + "description": "Seconds the HUD message stays on screen."
57 + }
58 + ],
59 + "commands": [
60 + {
61 + "name": "say @message",
62 + "access": "d",
63 + "description": "Admin-only chat channel."
64 + },
65 + {
66 + "name": "say @@message",
67 + "access": "d",
68 + "description": "Coloured announcement to everyone."
69 + },
70 + {
71 + "name": "say @@@message",
72 + "access": "d",
73 + "description": "Centred HUD message to everyone."
74 + }
75 + ],
76 + "main": "addons/amxmodx/scripting/csb_admin_chat.sma"
77 +}
0 78