Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 207 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_jump_stats.sma
+161 -0
A
csb.json
+42 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-10-26) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Jump Stats</strong> watches every player in <code>PlayerPostThink</code>. When they leave the ground it stores the takeoff point and starts tracking peak horizontal speed; on landing it measures the horizontal distance covered. Jumps longer than <code>csb_js_mindist</code> are printed to the jumper, and the single longest jump on the current map is stored in an nVault and announced server-wide when someone beats it.</p><h2>Features</h2><ul><li>Distance and peak speed measured per jump.</li><li>Threshold cvar so only notable jumps are announced.</li><li>Per-map longest-jump record persisted in nVault.</li><li><code>say /jumprecord</code> shows the current map record.</li></ul><h2>Installation</h2><ol><li>Enable the <code>fakemeta</code> and <code>nvault</code> modules in <code>modules.ini</code>.</li><li>Compile <code>csb_jump_stats.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> |
addons/amxmodx/scripting/csb_jump_stats.sma
A
| @@ -0,0 +1,161 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Jump Stats | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Announces notable jumps. Every player is watched in PlayerPostThink: when they | |
| 6 | + * leave the ground the takeoff origin is stored, the peak horizontal speed while | |
| 7 | + * airborne is tracked, and on landing the horizontal distance covered is | |
| 8 | + * measured. Jumps over a distance threshold are printed to chat, and the longest | |
| 9 | + * jump on the current map is kept in an nVault, announced when it is beaten. | |
| 10 | + * | |
| 11 | + * This program is free software: you can redistribute it and/or modify it under | |
| 12 | + * the terms of the GNU General Public License as published by the Free Software | |
| 13 | + * Foundation, either version 3 of the License, or (at your option) any later | |
| 14 | + * version. It is distributed in the hope that it will be useful, but WITHOUT | |
| 15 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 16 | + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details. | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#include <amxmodx> | |
| 20 | +#include <fakemeta> | |
| 21 | +#include <nvault> | |
| 22 | + | |
| 23 | +new const PLUGIN[] = "CSB Jump Stats" | |
| 24 | +new const VERSION[] = "1.0.0" | |
| 25 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 26 | + | |
| 27 | +#if !defined FL_ONGROUND | |
| 28 | + #define FL_ONGROUND (1<<9) | |
| 29 | +#endif | |
| 30 | + | |
| 31 | +new g_pEnabled, g_pMinDist | |
| 32 | + | |
| 33 | +new bool:g_bInAir[33] | |
| 34 | +new Float:g_fTakeoff[33][3] | |
| 35 | +new Float:g_fMaxSpeed[33] | |
| 36 | + | |
| 37 | +new g_vault | |
| 38 | +new g_szMap[32] | |
| 39 | +new Float:g_fRecord | |
| 40 | +new g_szRecordHolder[32] | |
| 41 | + | |
| 42 | +public plugin_init() | |
| 43 | +{ | |
| 44 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 45 | + | |
| 46 | + g_pEnabled = register_cvar("csb_js_enabled", "1") | |
| 47 | + g_pMinDist = register_cvar("csb_js_mindist", "200") | |
| 48 | + | |
| 49 | + register_forward(FM_PlayerPostThink, "fwPostThink") | |
| 50 | + | |
| 51 | + register_clcmd("say /jumprecord", "cmdRecord") | |
| 52 | + register_clcmd("say_team /jumprecord", "cmdRecord") | |
| 53 | + | |
| 54 | + get_mapname(g_szMap, charsmax(g_szMap)) | |
| 55 | + g_vault = nvault_open("csb_jumpstats") | |
| 56 | + loadRecord() | |
| 57 | +} | |
| 58 | + | |
| 59 | +public plugin_end() | |
| 60 | +{ | |
| 61 | + nvault_close(g_vault) | |
| 62 | +} | |
| 63 | + | |
| 64 | +loadRecord() | |
| 65 | +{ | |
| 66 | + new key[48] | |
| 67 | + formatex(key, charsmax(key), "rec_%s", g_szMap) | |
| 68 | + | |
| 69 | + new data[64] | |
| 70 | + if (nvault_get(g_vault, key, data, charsmax(data))) | |
| 71 | + { | |
| 72 | + new distStr[16] | |
| 73 | + strtok(data, distStr, charsmax(distStr), g_szRecordHolder, charsmax(g_szRecordHolder), '|') | |
| 74 | + g_fRecord = str_to_float(distStr) | |
| 75 | + } | |
| 76 | + else | |
| 77 | + { | |
| 78 | + g_fRecord = 0.0 | |
| 79 | + copy(g_szRecordHolder, charsmax(g_szRecordHolder), "nobody") | |
| 80 | + } | |
| 81 | +} | |
| 82 | + | |
| 83 | +saveRecord() | |
| 84 | +{ | |
| 85 | + new key[48], data[64] | |
| 86 | + formatex(key, charsmax(key), "rec_%s", g_szMap) | |
| 87 | + formatex(data, charsmax(data), "%f|%s", g_fRecord, g_szRecordHolder) | |
| 88 | + nvault_set(g_vault, key, data) | |
| 89 | +} | |
| 90 | + | |
| 91 | +public client_putinserver(id) | |
| 92 | +{ | |
| 93 | + g_bInAir[id] = false | |
| 94 | + g_fMaxSpeed[id] = 0.0 | |
| 95 | +} | |
| 96 | + | |
| 97 | +public fwPostThink(id) | |
| 98 | +{ | |
| 99 | + if (!get_pcvar_num(g_pEnabled) || !is_user_alive(id)) | |
| 100 | + return FMRES_IGNORED | |
| 101 | + | |
| 102 | + new flags = pev(id, pev_flags) | |
| 103 | + new bool:onground = (flags & FL_ONGROUND) != 0 | |
| 104 | + | |
| 105 | + static Float:fVel[3] | |
| 106 | + pev(id, pev_velocity, fVel) | |
| 107 | + new Float:hspeed = floatsqroot(fVel[0] * fVel[0] + fVel[1] * fVel[1]) | |
| 108 | + | |
| 109 | + if (!onground) | |
| 110 | + { | |
| 111 | + if (!g_bInAir[id]) | |
| 112 | + { | |
| 113 | + g_bInAir[id] = true | |
| 114 | + pev(id, pev_origin, g_fTakeoff[id]) | |
| 115 | + g_fMaxSpeed[id] = hspeed | |
| 116 | + } | |
| 117 | + else if (hspeed > g_fMaxSpeed[id]) | |
| 118 | + { | |
| 119 | + g_fMaxSpeed[id] = hspeed | |
| 120 | + } | |
| 121 | + } | |
| 122 | + else if (g_bInAir[id]) | |
| 123 | + { | |
| 124 | + g_bInAir[id] = false | |
| 125 | + landed(id) | |
| 126 | + } | |
| 127 | + | |
| 128 | + return FMRES_IGNORED | |
| 129 | +} | |
| 130 | + | |
| 131 | +landed(id) | |
| 132 | +{ | |
| 133 | + static Float:fNow[3] | |
| 134 | + pev(id, pev_origin, fNow) | |
| 135 | + | |
| 136 | + new Float:dx = fNow[0] - g_fTakeoff[id][0] | |
| 137 | + new Float:dy = fNow[1] - g_fTakeoff[id][1] | |
| 138 | + new Float:dist = floatsqroot(dx * dx + dy * dy) | |
| 139 | + | |
| 140 | + if (dist < get_pcvar_float(g_pMinDist)) | |
| 141 | + return | |
| 142 | + | |
| 143 | + new name[32] | |
| 144 | + get_user_name(id, name, charsmax(name)) | |
| 145 | + | |
| 146 | + client_print(id, print_chat, "^x04[CSB]^x01 Jump: %.1f units at %.0f u/s.", dist, g_fMaxSpeed[id]) | |
| 147 | + | |
| 148 | + if (dist > g_fRecord) | |
| 149 | + { | |
| 150 | + g_fRecord = dist | |
| 151 | + copy(g_szRecordHolder, charsmax(g_szRecordHolder), name) | |
| 152 | + saveRecord() | |
| 153 | + client_print(0, print_chat, "^x04[CSB]^x01 NEW MAP RECORD! %s jumped %.1f units!", name, dist) | |
| 154 | + } | |
| 155 | +} | |
| 156 | + | |
| 157 | +public cmdRecord(id) | |
| 158 | +{ | |
| 159 | + client_print(id, print_chat, "^x04[CSB]^x01 Longest jump on %s: %.1f units by %s.", g_szMap, g_fRecord, g_szRecordHolder) | |
| 160 | + return PLUGIN_HANDLED | |
| 161 | +} |
csb.json
A
| @@ -0,0 +1,42 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Jump Stats", | |
| 3 | + "category": "movement", | |
| 4 | + "tags": "jump, stats, distance", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Jump Stats", | |
| 10 | + "short_desc": "Measures each jump's distance and peak speed on landing, announces long jumps and keeps the map's longest jump in nVault.", | |
| 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,nvault", | |
| 20 | + "install_notes": "1. Enable the fakemeta and nvault modules in addons/amxmodx/configs/modules.ini\n2. Put csb_jump_stats.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "None known.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_js_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Enable or disable jump stats." | |
| 27 | + }, | |
| 28 | + { | |
| 29 | + "name": "csb_js_mindist", | |
| 30 | + "default": "200", | |
| 31 | + "description": "Minimum jump distance (units) before it is announced." | |
| 32 | + } | |
| 33 | + ], | |
| 34 | + "commands": [ | |
| 35 | + { | |
| 36 | + "name": "say /jumprecord", | |
| 37 | + "access": "", | |
| 38 | + "description": "Show the longest jump recorded on this map." | |
| 39 | + } | |
| 40 | + ], | |
| 41 | + "main": "addons/amxmodx/scripting/csb_jump_stats.sma" | |
| 42 | +} | |
| 0 | 43 |









