Sunucu tanitimi
Black Friday Bitmesine Master Server yeri ve Client listesinde %50 indirim, birlikte OMUR BOYU PREMIUM
19 Saat 06 Dk 00 Sn
Firsatlari gor

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit c64fb28d6e4f5e900e8ad4427ddfcc3cc2330e6a
4 changed files with 205 additions and 0 deletions
+3 -0 CHANGELOG.md A
@@ -0,0 +1,3 @@
1 +## 1.0.0 (2025-09-03)
2 +
3 +1.0.0 - Initial release.
+1 -0 README.md A
@@ -0,0 +1 @@
1 +<p><strong>CSB HUD Clock</strong> puts the real server clock in a small HUD corner. Choose 12h or 24h with a cvar, optionally show the elapsed map time next to it, and let each player nudge the displayed time to their own timezone with <code>/clock +2</code> or <code>/clock -3</code>. <code>/clock</code> on its own toggles the display for that player.</p><h2>Features</h2><ul><li>Real server time via <code>get_time</code>, refreshed every second.</li><li>12h or 24h format cvar.</li><li>Per-player hour offset for timezones.</li><li>Optional map-elapsed-minutes readout.</li></ul><h2>Installation</h2><ol><li>Compile <code>csb_hud_clock.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>
+154 -0 addons/amxmodx/scripting/csb_hud_clock.sma A
@@ -0,0 +1,154 @@
1 +/*
2 + * CSB HUD Clock
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * Shows the real server clock in a small HUD corner, in 12h or 24h format
6 + * (cvar), and can show the elapsed map time next to it. A per-player cvar-driven
7 + * offset lets a player nudge the shown time to their own timezone with /clock.
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 +
19 +new const PLUGIN[] = "CSB HUD Clock"
20 +new const VERSION[] = "1.0.0"
21 +new const AUTHOR[] = "counter-strike-boost.com"
22 +
23 +new g_pEnabled, g_pFormat, g_pElapsed
24 +new g_iSync
25 +new Float:g_fMapStart
26 +
27 +new bool:g_bShow[33]
28 +new g_iOffset[33]
29 +
30 +public plugin_init()
31 +{
32 + register_plugin(PLUGIN, VERSION, AUTHOR)
33 +
34 + g_pEnabled = register_cvar("csb_clock_enabled", "1")
35 + g_pFormat = register_cvar("csb_clock_24h", "1")
36 + g_pElapsed = register_cvar("csb_clock_elapsed", "1")
37 +
38 + register_clcmd("say /clock", "cmdClock")
39 + register_clcmd("say_team /clock", "cmdClock")
40 +
41 + g_iSync = CreateHudSyncObj()
42 + g_fMapStart = get_gametime()
43 +
44 + set_task(1.0, "taskClock", 55, _, _, "b")
45 +}
46 +
47 +public client_putinserver(id)
48 +{
49 + g_bShow[id] = true
50 + g_iOffset[id] = 0
51 +}
52 +
53 +public cmdClock(id)
54 +{
55 + new args[32]
56 + read_args(args, charsmax(args))
57 + remove_quotes(args)
58 +
59 + /* "/clock" toggles; "/clock +2" or "/clock -3" sets an hour offset */
60 + new tok[16]
61 + strtok(args, tok, charsmax(tok), tok, charsmax(tok), ' ')
62 +
63 + if (containi(args, " ") != -1)
64 + {
65 + new rest[16]
66 + copy(rest, charsmax(rest), args[7])
67 + trim(rest)
68 +
69 + new off = str_to_num(rest)
70 +
71 + if (off < -12)
72 + off = -12
73 + if (off > 14)
74 + off = 14
75 +
76 + g_iOffset[id] = off
77 + client_print(id, print_chat, "[CSB] Clock offset set to %+d hour(s).", off)
78 + return PLUGIN_HANDLED
79 + }
80 +
81 + g_bShow[id] = !g_bShow[id]
82 + client_print(id, print_chat, "[CSB] HUD clock %s.", g_bShow[id] ? "shown" : "hidden")
83 + return PLUGIN_HANDLED
84 +}
85 +
86 +public taskClock()
87 +{
88 + if (!get_pcvar_num(g_pEnabled))
89 + return
90 +
91 + new bool:elapsed = get_pcvar_num(g_pElapsed) != 0
92 + new bool:h24 = get_pcvar_num(g_pFormat) != 0
93 +
94 + new mapMin = floatround((get_gametime() - g_fMapStart) / 60.0, floatround_floor)
95 +
96 + new players[32], num
97 + get_players(players, num, "ch")
98 +
99 + set_hudmessage(120, 220, 255, 0.82, 0.02, 0, 0.0, 1.2, 0.0, 0.0, -1)
100 +
101 + for (new i = 0; i < num; i++)
102 + {
103 + new id = players[i]
104 +
105 + if (!g_bShow[id])
106 + continue
107 +
108 + new hh, mm, ss
109 + serverClock(g_iOffset[id], hh, mm, ss)
110 +
111 + new line[64]
112 +
113 + if (h24)
114 + {
115 + formatex(line, charsmax(line), "%02d:%02d:%02d", hh, mm, ss)
116 + }
117 + else
118 + {
119 + new ampm = (hh >= 12) ? 'P' : 'A'
120 + new h12 = hh % 12
121 + if (h12 == 0)
122 + h12 = 12
123 + formatex(line, charsmax(line), "%d:%02d:%02d %cM", h12, mm, ss, ampm)
124 + }
125 +
126 + if (elapsed)
127 + {
128 + new full[80]
129 + formatex(full, charsmax(full), "%s (map %d min)", line, mapMin)
130 + ShowSyncHudMsg(id, g_iSync, "%s", full)
131 + }
132 + else
133 + {
134 + ShowSyncHudMsg(id, g_iSync, "%s", line)
135 + }
136 + }
137 +}
138 +
139 +serverClock(offsetHours, &hh, &mm, &ss)
140 +{
141 + new t[16]
142 + get_time("%H", t, charsmax(t))
143 + hh = str_to_num(t)
144 +
145 + get_time("%M", t, charsmax(t))
146 + mm = str_to_num(t)
147 +
148 + get_time("%S", t, charsmax(t))
149 + ss = str_to_num(t)
150 +
151 + hh = (hh + offsetHours) % 24
152 + if (hh < 0)
153 + hh += 24
154 +}
+47 -0 csb.json A
@@ -0,0 +1,47 @@
1 +{
2 + "name": "CSB HUD Clock",
3 + "category": "hud-info",
4 + "tags": "clock, time, hud",
5 + "image": "",
6 + "original_author": "",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB HUD Clock",
10 + "short_desc": "Shows the real server time in a HUD corner with 12/24h format, a per-player timezone offset and optional map elapsed time.",
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_hud_clock.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n2. Change map",
21 + "known_conflicts": "Other plugins drawing a HUD message in the top-right corner may overlap the clock.",
22 + "cvars": [
23 + {
24 + "name": "csb_clock_enabled",
25 + "default": "1",
26 + "description": "Enable or disable the HUD clock."
27 + },
28 + {
29 + "name": "csb_clock_24h",
30 + "default": "1",
31 + "description": "1 = 24-hour format, 0 = 12-hour AM/PM."
32 + },
33 + {
34 + "name": "csb_clock_elapsed",
35 + "default": "1",
36 + "description": "Show elapsed map minutes next to the clock."
37 + }
38 + ],
39 + "commands": [
40 + {
41 + "name": "say /clock",
42 + "access": "",
43 + "description": "Toggle the clock, or '/clock +2' to set an hour offset."
44 + }
45 + ],
46 + "main": "addons/amxmodx/scripting/csb_hud_clock.sma"
47 +}
0 48