Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 383 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_teleport_menu.sma
+343 -0
A
csb.json
+36 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2026-02-10) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Teleport Menu</strong> (<code>amx_teleportmenu</code>) covers the everyday admin moves: teleport yourself to a player, bring a player to you, or send a player to your current aim point. You can also save your position as a named location (stored per map in <code>addons/amxmodx/data/csb_teleport/<map>.ini</code>) and jump back to any saved location from the menu. Every destination is validated with a player-hull trace and nudged upward until free, so nobody gets teleported into a wall.</p><p>Inspired by the classic AMXX teleport plugins; independent GPL re-implementation.</p><h2>Features</h2><ul><li>Player-pick submenus for all player-targeted moves.</li><li>Aim-point teleport via eye traceline.</li><li>Named locations persisted per map, editable by hand.</li><li>Solid-space safety check on every move.</li></ul><h2>Installation</h2><ol><li>Enable the <code>engine</code> module.</li><li>Compile, install, add to <code>plugins.ini</code>, change map.</li></ol> |
addons/amxmodx/scripting/csb_teleport_menu.sma
A
| @@ -0,0 +1,343 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Teleport Menu | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Admin teleport toolbox. amx_teleportmenu opens a menu to: teleport yourself | |
| 6 | + * to a player, bring a player to you, send a player to your current aim point | |
| 7 | + * (traced from your eyes), save your current position as a named location and | |
| 8 | + * jump to any saved location. Locations are stored per map in | |
| 9 | + * addons/amxmodx/data/csb_teleport/<map>.ini. Every destination is validated | |
| 10 | + * with a player-hull trace and nudged upwards until it is free. | |
| 11 | + * | |
| 12 | + * Inspired by the classic AMXX teleport plugins; independent GPL | |
| 13 | + * re-implementation, no original code reused. | |
| 14 | + * | |
| 15 | + * This program is free software: you can redistribute it and/or modify it under | |
| 16 | + * the terms of the GNU General Public License as published by the Free Software | |
| 17 | + * Foundation, either version 3 of the License, or (at your option) any later | |
| 18 | + * version. It is distributed in the hope that it will be useful, but WITHOUT | |
| 19 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 20 | + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details. | |
| 21 | + */ | |
| 22 | + | |
| 23 | +#include <amxmodx> | |
| 24 | +#include <amxmisc> | |
| 25 | +#include <fakemeta> | |
| 26 | +#include <engine> | |
| 27 | + | |
| 28 | +new const PLUGIN[] = "CSB Teleport Menu" | |
| 29 | +new const VERSION[] = "1.0.0" | |
| 30 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 31 | + | |
| 32 | +#define MAX_LOCS 32 | |
| 33 | + | |
| 34 | +new g_szLocName[MAX_LOCS][32] | |
| 35 | +new Float:g_fLoc[MAX_LOCS][3] | |
| 36 | +new g_iLocCount | |
| 37 | + | |
| 38 | +new g_iMenuAction[33] | |
| 39 | + | |
| 40 | +public plugin_init() | |
| 41 | +{ | |
| 42 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 43 | + | |
| 44 | + register_concmd("amx_teleportmenu", "cmdMenu", ADMIN_SLAY, "- open the teleport menu") | |
| 45 | + register_concmd("amx_saveloc", "cmdSaveLoc", ADMIN_SLAY, "<name> - save your position") | |
| 46 | + | |
| 47 | + loadLocations() | |
| 48 | +} | |
| 49 | + | |
| 50 | +/* ---------- main menu ---------- */ | |
| 51 | + | |
| 52 | +public cmdMenu(id, level, cid) | |
| 53 | +{ | |
| 54 | + if (!cmd_access(id, level, cid, 1)) | |
| 55 | + return PLUGIN_HANDLED | |
| 56 | + | |
| 57 | + new menu = menu_create("\yCSB Teleport Menu", "handlerMenu") | |
| 58 | + | |
| 59 | + menu_additem(menu, "Teleport to a player", "1") | |
| 60 | + menu_additem(menu, "Bring a player to you", "2") | |
| 61 | + menu_additem(menu, "Send a player to your aim", "3") | |
| 62 | + menu_additem(menu, "Save your position (console: amx_saveloc <name>)", "4") | |
| 63 | + menu_additem(menu, "Go to a saved location", "5") | |
| 64 | + | |
| 65 | + menu_display(id, menu, 0) | |
| 66 | + return PLUGIN_HANDLED | |
| 67 | +} | |
| 68 | + | |
| 69 | +public handlerMenu(id, menu, item) | |
| 70 | +{ | |
| 71 | + menu_destroy(menu) | |
| 72 | + | |
| 73 | + if (item == MENU_EXIT) | |
| 74 | + return PLUGIN_HANDLED | |
| 75 | + | |
| 76 | + switch (item) | |
| 77 | + { | |
| 78 | + case 0: | |
| 79 | + { | |
| 80 | + g_iMenuAction[id] = 1 | |
| 81 | + showPlayerMenu(id, "Teleport to whom?") | |
| 82 | + } | |
| 83 | + case 1: | |
| 84 | + { | |
| 85 | + g_iMenuAction[id] = 2 | |
| 86 | + showPlayerMenu(id, "Bring whom?") | |
| 87 | + } | |
| 88 | + case 2: | |
| 89 | + { | |
| 90 | + g_iMenuAction[id] = 3 | |
| 91 | + showPlayerMenu(id, "Send whom to your aim?") | |
| 92 | + } | |
| 93 | + case 3: | |
| 94 | + { | |
| 95 | + client_print(id, print_chat, "[CSB] Type in console: amx_saveloc <name>") | |
| 96 | + } | |
| 97 | + case 4: | |
| 98 | + { | |
| 99 | + showLocMenu(id) | |
| 100 | + } | |
| 101 | + } | |
| 102 | + | |
| 103 | + return PLUGIN_HANDLED | |
| 104 | +} | |
| 105 | + | |
| 106 | +/* ---------- player pick submenu ---------- */ | |
| 107 | + | |
| 108 | +showPlayerMenu(id, const title[]) | |
| 109 | +{ | |
| 110 | + new menu = menu_create(title, "handlerPlayers") | |
| 111 | + | |
| 112 | + new players[32], num | |
| 113 | + get_players(players, num, "ch") | |
| 114 | + | |
| 115 | + for (new i = 0; i < num; i++) | |
| 116 | + { | |
| 117 | + new target = players[i] | |
| 118 | + new name[32], sid[8] | |
| 119 | + get_user_name(target, name, charsmax(name)) | |
| 120 | + num_to_str(target, sid, charsmax(sid)) | |
| 121 | + menu_additem(menu, name, sid) | |
| 122 | + } | |
| 123 | + | |
| 124 | + menu_display(id, menu, 0) | |
| 125 | +} | |
| 126 | + | |
| 127 | +public handlerPlayers(id, menu, item) | |
| 128 | +{ | |
| 129 | + if (item == MENU_EXIT) | |
| 130 | + { | |
| 131 | + menu_destroy(menu) | |
| 132 | + return PLUGIN_HANDLED | |
| 133 | + } | |
| 134 | + | |
| 135 | + new sid[8], dummy[32], access, callback | |
| 136 | + menu_item_getinfo(menu, item, access, sid, charsmax(sid), dummy, charsmax(dummy), callback) | |
| 137 | + menu_destroy(menu) | |
| 138 | + | |
| 139 | + new target = str_to_num(sid) | |
| 140 | + | |
| 141 | + if (!is_user_connected(target)) | |
| 142 | + { | |
| 143 | + client_print(id, print_chat, "[CSB] That player left.") | |
| 144 | + return PLUGIN_HANDLED | |
| 145 | + } | |
| 146 | + | |
| 147 | + new Float:dest[3] | |
| 148 | + | |
| 149 | + switch (g_iMenuAction[id]) | |
| 150 | + { | |
| 151 | + case 1: | |
| 152 | + { | |
| 153 | + pev(target, pev_origin, dest) | |
| 154 | + if (moveSafely(id, dest)) | |
| 155 | + client_print(id, print_chat, "[CSB] Teleported to player.") | |
| 156 | + } | |
| 157 | + case 2: | |
| 158 | + { | |
| 159 | + pev(id, pev_origin, dest) | |
| 160 | + if (is_user_alive(target) && moveSafely(target, dest)) | |
| 161 | + client_print(id, print_chat, "[CSB] Player brought to you.") | |
| 162 | + } | |
| 163 | + case 3: | |
| 164 | + { | |
| 165 | + new iaim[3] | |
| 166 | + get_user_origin(id, iaim, 3) | |
| 167 | + IVecFVec(iaim, dest) | |
| 168 | + | |
| 169 | + if (is_user_alive(target) && moveSafely(target, dest)) | |
| 170 | + client_print(id, print_chat, "[CSB] Player sent to your aim point.") | |
| 171 | + } | |
| 172 | + } | |
| 173 | + | |
| 174 | + return PLUGIN_HANDLED | |
| 175 | +} | |
| 176 | + | |
| 177 | +/* ---------- saved locations ---------- */ | |
| 178 | + | |
| 179 | +public cmdSaveLoc(id, level, cid) | |
| 180 | +{ | |
| 181 | + if (!cmd_access(id, level, cid, 2)) | |
| 182 | + return PLUGIN_HANDLED | |
| 183 | + | |
| 184 | + if (g_iLocCount >= MAX_LOCS) | |
| 185 | + { | |
| 186 | + client_print(id, print_console, "[CSB] Location list is full (%d).", MAX_LOCS) | |
| 187 | + return PLUGIN_HANDLED | |
| 188 | + } | |
| 189 | + | |
| 190 | + new name[32] | |
| 191 | + read_argv(1, name, charsmax(name)) | |
| 192 | + | |
| 193 | + new Float:orig[3] | |
| 194 | + pev(id, pev_origin, orig) | |
| 195 | + | |
| 196 | + copy(g_szLocName[g_iLocCount], charsmax(g_szLocName[]), name) | |
| 197 | + g_fLoc[g_iLocCount][0] = orig[0] | |
| 198 | + g_fLoc[g_iLocCount][1] = orig[1] | |
| 199 | + g_fLoc[g_iLocCount][2] = orig[2] | |
| 200 | + g_iLocCount++ | |
| 201 | + | |
| 202 | + saveLocations() | |
| 203 | + | |
| 204 | + client_print(id, print_console, "[CSB] Location ^"%s^" saved (%.0f %.0f %.0f).", | |
| 205 | + name, orig[0], orig[1], orig[2]) | |
| 206 | + return PLUGIN_HANDLED | |
| 207 | +} | |
| 208 | + | |
| 209 | +showLocMenu(id) | |
| 210 | +{ | |
| 211 | + if (g_iLocCount < 1) | |
| 212 | + { | |
| 213 | + client_print(id, print_chat, "[CSB] No saved locations on this map yet.") | |
| 214 | + return | |
| 215 | + } | |
| 216 | + | |
| 217 | + new menu = menu_create("\yGo to location:", "handlerLocs") | |
| 218 | + | |
| 219 | + for (new i = 0; i < g_iLocCount; i++) | |
| 220 | + { | |
| 221 | + new sid[8] | |
| 222 | + num_to_str(i, sid, charsmax(sid)) | |
| 223 | + menu_additem(menu, g_szLocName[i], sid) | |
| 224 | + } | |
| 225 | + | |
| 226 | + menu_display(id, menu, 0) | |
| 227 | +} | |
| 228 | + | |
| 229 | +public handlerLocs(id, menu, item) | |
| 230 | +{ | |
| 231 | + if (item == MENU_EXIT) | |
| 232 | + { | |
| 233 | + menu_destroy(menu) | |
| 234 | + return PLUGIN_HANDLED | |
| 235 | + } | |
| 236 | + | |
| 237 | + new sid[8], dummy[32], access, callback | |
| 238 | + menu_item_getinfo(menu, item, access, sid, charsmax(sid), dummy, charsmax(dummy), callback) | |
| 239 | + menu_destroy(menu) | |
| 240 | + | |
| 241 | + new idx = str_to_num(sid) | |
| 242 | + | |
| 243 | + if (idx < 0 || idx >= g_iLocCount || !is_user_alive(id)) | |
| 244 | + return PLUGIN_HANDLED | |
| 245 | + | |
| 246 | + new Float:dest[3] | |
| 247 | + dest[0] = g_fLoc[idx][0] | |
| 248 | + dest[1] = g_fLoc[idx][1] | |
| 249 | + dest[2] = g_fLoc[idx][2] | |
| 250 | + | |
| 251 | + if (moveSafely(id, dest)) | |
| 252 | + client_print(id, print_chat, "[CSB] Teleported to ^"%s^".", g_szLocName[idx]) | |
| 253 | + | |
| 254 | + return PLUGIN_HANDLED | |
| 255 | +} | |
| 256 | + | |
| 257 | +/* ---------- helpers ---------- */ | |
| 258 | + | |
| 259 | +bool:moveSafely(id, Float:dest[3]) | |
| 260 | +{ | |
| 261 | + /* nudge up until a player hull fits (max 4 attempts) */ | |
| 262 | + for (new i = 0; i < 4; i++) | |
| 263 | + { | |
| 264 | + if (!(trace_hull(dest, HULL_HUMAN, id) & 1)) | |
| 265 | + { | |
| 266 | + static Float:zero[3] | |
| 267 | + set_pev(id, pev_velocity, zero) | |
| 268 | + set_pev(id, pev_origin, dest) | |
| 269 | + return true | |
| 270 | + } | |
| 271 | + | |
| 272 | + dest[2] += 36.0 | |
| 273 | + } | |
| 274 | + | |
| 275 | + client_print(id, print_chat, "[CSB] Destination is blocked - teleport cancelled.") | |
| 276 | + return false | |
| 277 | +} | |
| 278 | + | |
| 279 | +getLocFile(path[], len) | |
| 280 | +{ | |
| 281 | + new map[32], dir[96] | |
| 282 | + get_mapname(map, charsmax(map)) | |
| 283 | + get_localinfo("amxx_datadir", dir, charsmax(dir)) | |
| 284 | + formatex(path, len, "%s/csb_teleport/%s.ini", dir, map) | |
| 285 | +} | |
| 286 | + | |
| 287 | +loadLocations() | |
| 288 | +{ | |
| 289 | + new path[160] | |
| 290 | + getLocFile(path, charsmax(path)) | |
| 291 | + | |
| 292 | + g_iLocCount = 0 | |
| 293 | + | |
| 294 | + if (!file_exists(path)) | |
| 295 | + return | |
| 296 | + | |
| 297 | + new file = fopen(path, "rt") | |
| 298 | + if (!file) | |
| 299 | + return | |
| 300 | + | |
| 301 | + new line[128] | |
| 302 | + | |
| 303 | + while (!feof(file) && g_iLocCount < MAX_LOCS) | |
| 304 | + { | |
| 305 | + fgets(file, line, charsmax(line)) | |
| 306 | + trim(line) | |
| 307 | + | |
| 308 | + if (!line[0] || line[0] == ';') | |
| 309 | + continue | |
| 310 | + | |
| 311 | + new name[32], sx[16], sy[16], sz[16] | |
| 312 | + parse(line, name, charsmax(name), sx, charsmax(sx), sy, charsmax(sy), sz, charsmax(sz)) | |
| 313 | + | |
| 314 | + copy(g_szLocName[g_iLocCount], charsmax(g_szLocName[]), name) | |
| 315 | + g_fLoc[g_iLocCount][0] = str_to_float(sx) | |
| 316 | + g_fLoc[g_iLocCount][1] = str_to_float(sy) | |
| 317 | + g_fLoc[g_iLocCount][2] = str_to_float(sz) | |
| 318 | + g_iLocCount++ | |
| 319 | + } | |
| 320 | + | |
| 321 | + fclose(file) | |
| 322 | +} | |
| 323 | + | |
| 324 | +saveLocations() | |
| 325 | +{ | |
| 326 | + new path[160] | |
| 327 | + getLocFile(path, charsmax(path)) | |
| 328 | + | |
| 329 | + new file = fopen(path, "wt") | |
| 330 | + if (!file) | |
| 331 | + { | |
| 332 | + log_amx("[CSB] Teleport: cannot write %s", path) | |
| 333 | + return | |
| 334 | + } | |
| 335 | + | |
| 336 | + for (new i = 0; i < g_iLocCount; i++) | |
| 337 | + { | |
| 338 | + fprintf(file, "%s %.1f %.1f %.1f^n", | |
| 339 | + g_szLocName[i], g_fLoc[i][0], g_fLoc[i][1], g_fLoc[i][2]) | |
| 340 | + } | |
| 341 | + | |
| 342 | + fclose(file) | |
| 343 | +} |
csb.json
A
| @@ -0,0 +1,36 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Teleport Menu", | |
| 3 | + "category": "movement", | |
| 4 | + "tags": "teleport, menu, admin", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "AMX Mod X Teleport Menu", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Teleport Menu", | |
| 10 | + "short_desc": "Admin teleport toolbox: go to player, bring player, send to aim point, and named per-map saved locations.", | |
| 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,engine", | |
| 20 | + "install_notes": "1. Compile the .sma (or use the site compiler)\n2. Put the .amxx in addons/amxmodx/plugins/\n3. Add it to addons/amxmodx/configs/plugins.ini\n4. Change map", | |
| 21 | + "known_conflicts": "", | |
| 22 | + "cvars": [], | |
| 23 | + "commands": [ | |
| 24 | + { | |
| 25 | + "name": "amx_teleportmenu", | |
| 26 | + "access": "ADMIN_SLAY", | |
| 27 | + "description": "Open the teleport menu." | |
| 28 | + }, | |
| 29 | + { | |
| 30 | + "name": "amx_saveloc <name>", | |
| 31 | + "access": "ADMIN_SLAY", | |
| 32 | + "description": "Save your current position as a named location." | |
| 33 | + } | |
| 34 | + ], | |
| 35 | + "main": "addons/amxmodx/scripting/csb_teleport_menu.sma" | |
| 36 | +} | |
| 0 | 37 |









