Promotiraj s'rv'r

Initial release 1.0.0

Browse Source
1.0.0 - Initial release.
Daemon666 committed commit d199be32e61e4842a8d147a56129809c0d060417
4 changed files with 172 additions and 0 deletions
+3 -0 CHANGELOG.md A
@@ -0,0 +1,3 @@
1 +## 1.0.0 (2025-05-21)
2 +
3 +1.0.0 - Initial release.
+1 -0 README.md A
@@ -0,0 +1 @@
1 +<p><strong>CSB Speedometer</strong> shows how fast you are actually moving. On a short task it reads <code>pev_velocity</code>, drops the vertical component and prints the horizontal speed in units/s as a live HUD number. The number changes colour as you cross the <code>csb_speed_mid</code> and <code>csb_speed_fast</code> thresholds, and a KZ-style <strong>peak speed</strong> line tracks the fastest you reached during the current life (it resets on every spawn).</p><h2>Features</h2><ul><li>Horizontal speed in units/s from <code>pev_velocity</code>.</li><li>Green / amber / red colour thresholds you can tune with cvars.</li><li>Peak-speed line per life, reset on spawn.</li><li>Per-player toggle with <code>say /speed</code>.</li></ul><h2>Installation</h2><ol><li>Enable the <code>fakemeta</code> module in <code>addons/amxmodx/configs/modules.ini</code>.</li><li>Compile <code>csb_speedometer.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>
+116 -0 addons/amxmodx/scripting/csb_speedometer.sma A
@@ -0,0 +1,116 @@
1 +/*
2 + * CSB Speedometer
3 + * Copyright (C) 2026 counter-strike-boost.com
4 + *
5 + * Shows the player's horizontal speed (units/s, from pev_velocity) as a live
6 + * HUD number, colours it against configurable thresholds, and tracks a KZ-style
7 + * peak speed for the current life. Refreshed on a short task and toggled per
8 + * player with say /speed.
9 + *
10 + * This program is free software: you can redistribute it and/or modify it under
11 + * the terms of the GNU General Public License as published by the Free Software
12 + * Foundation, either version 3 of the License, or (at your option) any later
13 + * version. It is distributed in the hope that it will be useful, but WITHOUT
14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details.
16 + */
17 +
18 +#include <amxmodx>
19 +#include <fakemeta>
20 +
21 +new const PLUGIN[] = "CSB Speedometer"
22 +new const VERSION[] = "1.0.0"
23 +new const AUTHOR[] = "counter-strike-boost.com"
24 +
25 +new g_pEnabled, g_pMid, g_pFast, g_pShowPeak
26 +new bool:g_bShow[33]
27 +new Float:g_fPeak[33]
28 +new g_iSync
29 +
30 +public plugin_init()
31 +{
32 + register_plugin(PLUGIN, VERSION, AUTHOR)
33 +
34 + g_pEnabled = register_cvar("csb_speed_enabled", "1")
35 + g_pMid = register_cvar("csb_speed_mid", "300")
36 + g_pFast = register_cvar("csb_speed_fast", "500")
37 + g_pShowPeak = register_cvar("csb_speed_peak", "1")
38 +
39 + register_clcmd("say /speed", "cmdToggle")
40 + register_clcmd("say_team /speed", "cmdToggle")
41 +
42 + register_event("ResetHUD", "eventSpawn", "b")
43 +
44 + g_iSync = CreateHudSyncObj()
45 + set_task(0.2, "taskSpeed", 0, _, _, "b")
46 +}
47 +
48 +public client_putinserver(id)
49 +{
50 + g_bShow[id] = true
51 + g_fPeak[id] = 0.0
52 +}
53 +
54 +public cmdToggle(id)
55 +{
56 + g_bShow[id] = !g_bShow[id]
57 + client_print(id, print_chat, "[CSB] Speedometer %s.", g_bShow[id] ? "enabled" : "disabled")
58 + return PLUGIN_HANDLED
59 +}
60 +
61 +public eventSpawn(id)
62 +{
63 + g_fPeak[id] = 0.0
64 +}
65 +
66 +public taskSpeed()
67 +{
68 + if (!get_pcvar_num(g_pEnabled))
69 + return
70 +
71 + new mid = get_pcvar_num(g_pMid)
72 + new fast = get_pcvar_num(g_pFast)
73 + new bool:peak = get_pcvar_num(g_pShowPeak) != 0
74 +
75 + new players[32], num, id
76 + get_players(players, num, "a")
77 +
78 + for (new i = 0; i < num; i++)
79 + {
80 + id = players[i]
81 +
82 + if (!g_bShow[id])
83 + continue
84 +
85 + static Float:fVel[3]
86 + pev(id, pev_velocity, fVel)
87 +
88 + new Float:speed = floatsqroot(fVel[0] * fVel[0] + fVel[1] * fVel[1])
89 + new iSpeed = floatround(speed)
90 +
91 + if (speed > g_fPeak[id])
92 + g_fPeak[id] = speed
93 +
94 + new r = 0, g = 255, b = 0
95 +
96 + if (iSpeed >= fast)
97 + {
98 + r = 255
99 + g = 40
100 + b = 40
101 + }
102 + else if (iSpeed >= mid)
103 + {
104 + r = 255
105 + g = 200
106 + b = 0
107 + }
108 +
109 + set_hudmessage(r, g, b, -1.0, 0.82, 0, 0.0, 0.25, 0.0, 0.0, -1)
110 +
111 + if (peak)
112 + ShowSyncHudMsg(id, g_iSync, "%d u/s^nPeak: %d u/s", iSpeed, floatround(g_fPeak[id]))
113 + else
114 + ShowSyncHudMsg(id, g_iSync, "%d u/s", iSpeed)
115 + }
116 +}
+52 -0 csb.json A
@@ -0,0 +1,52 @@
1 +{
2 + "name": "CSB Speedometer",
3 + "category": "hud-info",
4 + "tags": "speed, hud, kz",
5 + "image": "",
6 + "original_author": "Speedometer by KZ community",
7 + "original_url": "",
8 + "license": "GPL-3.0",
9 + "title": "CSB Speedometer",
10 + "short_desc": "Live horizontal-speed HUD (units/s) with colour thresholds and a KZ-style peak-speed line, toggled with /speed.",
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",
20 + "install_notes": "1. Enable the fakemeta module in addons/amxmodx/configs/modules.ini\n2. Put csb_speedometer.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n3. Change map",
21 + "known_conflicts": "Other plugins that draw a HUD message in the same lower-screen area may overlap this one.",
22 + "cvars": [
23 + {
24 + "name": "csb_speed_enabled",
25 + "default": "1",
26 + "description": "Enable or disable the speedometer."
27 + },
28 + {
29 + "name": "csb_speed_mid",
30 + "default": "300",
31 + "description": "Speed (u/s) at which the number turns amber."
32 + },
33 + {
34 + "name": "csb_speed_fast",
35 + "default": "500",
36 + "description": "Speed (u/s) at which the number turns red."
37 + },
38 + {
39 + "name": "csb_speed_peak",
40 + "default": "1",
41 + "description": "Show the per-life peak speed line."
42 + }
43 + ],
44 + "commands": [
45 + {
46 + "name": "say /speed",
47 + "access": "",
48 + "description": "Toggle the speedometer for yourself."
49 + }
50 + ],
51 + "main": "addons/amxmodx/scripting/csb_speedometer.sma"
52 +}
0 53