Promocionar servidor

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit 7a27fe8e6b1e40bc88db36b3c2e74a4fc605cb8a
4 changed files with 214 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 Admin List</strong> answers the question every player eventually asks: <em>is any admin actually here right now?</em> Type <code>/admins</code> and you get a coloured chat list of every connected admin, the flags they hold and whether they are currently active, AFK or dead.</p><p>An admin is anyone holding at least one real flag (<code>a</code>&ndash;<code>t</code>); plain <code>z</code> (ADMIN_USER) does not count. The flag string is rendered with <code>get_flags()</code> so you see readable letters, not a raw bitmask.</p><p>Inspired by the classic <em>Admins List</em> by Alka. Independent GPL re-implementation; no original code is reused.</p><h2>Features</h2><ul><li><code>/admins</code> (and <code>/admin</code>) from say or say_team.</li><li>AFK detection: a one-second task tracks each admin's origin and marks them <strong>AFK</strong> after ~20 seconds without moving.</li><li>Hidden admins: an admin holding the flag in <code>csb_adminlist_hideflag</code> is not shown to regular players unless <code>csb_adminlist_showhidden</code> is <code>1</code>. Other admins always see them.</li><li>No modules required &mdash; loads on any AMX Mod X 1.9 install.</li></ul><h2>Installation</h2><ol><li>Compile and copy <code>csb_admin_list.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>
+158 -0 addons/amxmodx/scripting/csb_admin_list.sma A
@@ -0,0 +1,158 @@
1 +/*
2 + * CSB Admin List
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * Shows every connected admin with their access level and AFK state.
6 + * Inspired by the classic "Admins List" plugin by Alka. This is an
7 + * independent GPL re-implementation; no original code is reused.
8 + *
9 + * This program is free software: you can redistribute it and/or modify it
10 + * under the terms of the GNU General Public License as published by the Free
11 + * Software Foundation, either version 3 of the License, or (at your option)
12 + * any later version. It is distributed in the hope that it will be useful,
13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15 + * Public License for more details: <https://www.gnu.org/licenses/>.
16 + */
17 +
18 +#include <amxmodx>
19 +#include <amxmisc>
20 +
21 +new const PLUGIN[] = "CSB Admin List"
22 +new const VERSION[] = "1.0.0"
23 +new const AUTHOR[] = "counter-strike-boost.com"
24 +
25 +#define AFK_LIMIT 20 /* seconds without moving before we call it AFK */
26 +
27 +new g_pEnabled, g_pHideFlag, g_pShowHidden
28 +
29 +new g_iAdminFlags /* flags that make a player "an admin" */
30 +new g_iAfkSeconds[33]
31 +new Float:g_fLastOrigin[33][3]
32 +
33 +public plugin_init()
34 +{
35 + register_plugin(PLUGIN, VERSION, AUTHOR)
36 +
37 + g_pEnabled = register_cvar("csb_adminlist_enabled", "1")
38 + g_pHideFlag = register_cvar("csb_adminlist_hideflag", "a")
39 + g_pShowHidden = register_cvar("csb_adminlist_showhidden", "0")
40 +
41 + register_clcmd("say /admins", "cmdAdmins")
42 + register_clcmd("say_team /admins", "cmdAdmins")
43 + register_clcmd("say /admin", "cmdAdmins")
44 +
45 + /* any flag from a..t marks a real admin; z (ADMIN_USER) does not */
46 + g_iAdminFlags = read_flags("abcdefghijklmnopqrst")
47 +
48 + set_task(1.0, "taskAfkScan", 0, _, _, "b")
49 +}
50 +
51 +public client_connect(id)
52 +{
53 + g_iAfkSeconds[id] = 0
54 + g_fLastOrigin[id][0] = 0.0
55 + g_fLastOrigin[id][1] = 0.0
56 + g_fLastOrigin[id][2] = 0.0
57 +}
58 +
59 +/* Track movement so we can flag AFK admins in the list. */
60 +public taskAfkScan()
61 +{
62 + new players[32], num, id
63 + get_players(players, num, "ch")
64 +
65 + for (new i = 0; i < num; i++)
66 + {
67 + id = players[i]
68 +
69 + if (!is_user_alive(id))
70 + {
71 + g_iAfkSeconds[id] = 0
72 + continue
73 + }
74 +
75 + new Float:origin[3]
76 + get_user_origin_f(id, origin)
77 +
78 + if (floatabs(origin[0] - g_fLastOrigin[id][0]) < 2.0
79 + && floatabs(origin[1] - g_fLastOrigin[id][1]) < 2.0
80 + && floatabs(origin[2] - g_fLastOrigin[id][2]) < 2.0)
81 + g_iAfkSeconds[id]++
82 + else
83 + g_iAfkSeconds[id] = 0
84 +
85 + g_fLastOrigin[id][0] = origin[0]
86 + g_fLastOrigin[id][1] = origin[1]
87 + g_fLastOrigin[id][2] = origin[2]
88 + }
89 +}
90 +
91 +/* get_user_origin returns integer cells; wrap it into floats for comparison */
92 +get_user_origin_f(id, Float:out[3])
93 +{
94 + new iOrigin[3]
95 + get_user_origin(id, iOrigin)
96 + out[0] = float(iOrigin[0])
97 + out[1] = float(iOrigin[1])
98 + out[2] = float(iOrigin[2])
99 +}
100 +
101 +public cmdAdmins(id)
102 +{
103 + if (!get_pcvar_num(g_pEnabled))
104 + {
105 + client_print(id, print_chat, "[CSB] The admin list is disabled.")
106 + return PLUGIN_HANDLED
107 + }
108 +
109 + new hideFlagStr[8], hideFlags, showHidden
110 + get_pcvar_string(g_pHideFlag, hideFlagStr, charsmax(hideFlagStr))
111 + hideFlags = read_flags(hideFlagStr)
112 + showHidden = get_pcvar_num(g_pShowHidden)
113 +
114 + /* a viewer who is an admin himself always sees hidden admins */
115 + if (get_user_flags(id) & g_iAdminFlags)
116 + showHidden = 1
117 +
118 + new players[32], num, pid, listed = 0
119 + get_players(players, num, "ch")
120 +
121 + client_print_color(id, print_team_default, "^x04[CSB]^x01 Online admins:")
122 +
123 + for (new i = 0; i < num; i++)
124 + {
125 + pid = players[i]
126 +
127 + new flags = get_user_flags(pid)
128 +
129 + if (!(flags & g_iAdminFlags))
130 + continue
131 +
132 + if ((flags & hideFlags) && hideFlags != 0 && !showHidden)
133 + continue
134 +
135 + new name[32], flagStr[27]
136 + get_user_name(pid, name, charsmax(name))
137 + get_flags(flags, flagStr, charsmax(flagStr))
138 +
139 + new status[16]
140 + if (!is_user_alive(pid))
141 + copy(status, charsmax(status), "dead")
142 + else if (g_iAfkSeconds[pid] >= AFK_LIMIT)
143 + copy(status, charsmax(status), "AFK")
144 + else
145 + copy(status, charsmax(status), "active")
146 +
147 + client_print_color(id, print_team_default,
148 + "^x04*^x03 %s ^x01[flags: ^x04%s^x01] ^x01(%s)",
149 + name, flagStr, status)
150 +
151 + listed++
152 + }
153 +
154 + if (!listed)
155 + client_print_color(id, print_team_default, "^x01 No admins are online right now.")
156 +
157 + return PLUGIN_HANDLED
158 +}
+52 -0 csb.json A
@@ -0,0 +1,52 @@
1 +{
2 + "name": "CSB Admin List",
3 + "category": "admin",
4 + "tags": "admins, list, say",
5 + "image": "",
6 + "original_author": "Alka (Admins List)",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Admin List",
10 + "short_desc": "Type /admins to see every online admin, their access flags and whether they are AFK.",
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_list.amxx in addons/amxmodx/plugins/\n2. Add it to addons/amxmodx/configs/plugins.ini\n3. Change map",
21 + "known_conflicts": "",
22 + "cvars": [
23 + {
24 + "name": "csb_adminlist_enabled",
25 + "default": "1",
26 + "description": "Enable or disable the /admins command."
27 + },
28 + {
29 + "name": "csb_adminlist_hideflag",
30 + "default": "a",
31 + "description": "Admins holding this flag are hidden from regular players."
32 + },
33 + {
34 + "name": "csb_adminlist_showhidden",
35 + "default": "0",
36 + "description": "1 = show hidden admins to everyone anyway."
37 + }
38 + ],
39 + "commands": [
40 + {
41 + "name": "say /admins",
42 + "access": "",
43 + "description": "List online admins with flags and AFK state."
44 + },
45 + {
46 + "name": "say /admin",
47 + "access": "",
48 + "description": "Alias of /admins."
49 + }
50 + ],
51 + "main": "addons/amxmodx/scripting/csb_admin_list.sma"
52 +}
0 53