Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 143 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_bad_spawn_preventer.sma
+108 -0
A
csb.json
+31 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2026-04-02) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Bad Spawn Fixer</strong> kills the classic deathmatch spawn bug where two players share a spawn point and end up stuck inside each other (and telefrag on the next move). On every spawn the plugin runs a human-hull trace at the spawn origin; if it is solid it first lifts the player straight up in small steps, then searches a ring of directions at growing radius until it finds a clear spot, and moves them there with <code>EngFunc_SetOrigin</code>.</p><h2>Features</h2><ul><li>Human-hull collision check on <code>Ham_Spawn</code> post.</li><li>Vertical lift first, then an outward ring search for free space.</li><li>Zeroes velocity on the nudge so the player lands cleanly.</li><li>Self-contained: <code>fakemeta</code> + <code>hamsandwich</code> only.</li></ul><h2>Installation</h2><ol><li>Enable the <code>fakemeta</code> and <code>hamsandwich</code> modules in <code>modules.ini</code>.</li><li>Compile <code>csb_bad_spawn_preventer.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_bad_spawn_preventer.sma
A
| @@ -0,0 +1,108 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Bad Spawn Fixer | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Prevents spawning inside another player. On spawn the plugin runs a human-hull | |
| 6 | + * trace at the spawn origin; if it is solid (a body is already there) it nudges | |
| 7 | + * the player up and then outward in a ring of directions until a free spot is | |
| 8 | + * found, avoiding the classic deathmatch spawn-stuck and telefrag problem. | |
| 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 | +#include <hamsandwich> | |
| 21 | + | |
| 22 | +new const PLUGIN[] = "CSB Bad Spawn Fixer" | |
| 23 | +new const VERSION[] = "1.0.0" | |
| 24 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 25 | + | |
| 26 | +#define HULL_HUMAN 1 | |
| 27 | + | |
| 28 | +new g_pEnabled | |
| 29 | + | |
| 30 | +public plugin_init() | |
| 31 | +{ | |
| 32 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 33 | + | |
| 34 | + g_pEnabled = register_cvar("csb_badspawn_enabled", "1") | |
| 35 | + | |
| 36 | + RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1) | |
| 37 | +} | |
| 38 | + | |
| 39 | +public fwSpawnPost(id) | |
| 40 | +{ | |
| 41 | + if (!get_pcvar_num(g_pEnabled) || !is_user_alive(id)) | |
| 42 | + return | |
| 43 | + | |
| 44 | + static Float:origin[3] | |
| 45 | + pev(id, pev_origin, origin) | |
| 46 | + | |
| 47 | + if (!isStuck(id, origin)) | |
| 48 | + return | |
| 49 | + | |
| 50 | + static Float:test[3] | |
| 51 | + | |
| 52 | + /* first try lifting straight up in small steps */ | |
| 53 | + for (new z = 8; z <= 40; z += 8) | |
| 54 | + { | |
| 55 | + test[0] = origin[0] | |
| 56 | + test[1] = origin[1] | |
| 57 | + test[2] = origin[2] + float(z) | |
| 58 | + | |
| 59 | + if (!isStuck(id, test)) | |
| 60 | + { | |
| 61 | + moveTo(id, test) | |
| 62 | + return | |
| 63 | + } | |
| 64 | + } | |
| 65 | + | |
| 66 | + /* then a ring of directions at growing radius */ | |
| 67 | + new const dirs = 8 | |
| 68 | + | |
| 69 | + for (new r = 32; r <= 96; r += 32) | |
| 70 | + { | |
| 71 | + for (new d = 0; d < dirs; d++) | |
| 72 | + { | |
| 73 | + new Float:ang = float(d) * (360.0 / float(dirs)) | |
| 74 | + new Float:rad = ang * 3.14159265 / 180.0 | |
| 75 | + | |
| 76 | + test[0] = origin[0] + floatcos(rad, radian) * float(r) | |
| 77 | + test[1] = origin[1] + floatsin(rad, radian) * float(r) | |
| 78 | + test[2] = origin[2] + 16.0 | |
| 79 | + | |
| 80 | + if (!isStuck(id, test)) | |
| 81 | + { | |
| 82 | + moveTo(id, test) | |
| 83 | + return | |
| 84 | + } | |
| 85 | + } | |
| 86 | + } | |
| 87 | +} | |
| 88 | + | |
| 89 | +bool:isStuck(id, const Float:pos[3]) | |
| 90 | +{ | |
| 91 | + engfunc(EngFunc_TraceHull, pos, pos, 0, HULL_HUMAN, id, 0) | |
| 92 | + | |
| 93 | + new startsolid = get_tr2(0, TR_StartSolid) | |
| 94 | + new allsolid = get_tr2(0, TR_AllSolid) | |
| 95 | + | |
| 96 | + return (startsolid != 0 || allsolid != 0) | |
| 97 | +} | |
| 98 | + | |
| 99 | +moveTo(id, const Float:pos[3]) | |
| 100 | +{ | |
| 101 | + engfunc(EngFunc_SetOrigin, id, pos) | |
| 102 | + | |
| 103 | + static Float:zero[3] | |
| 104 | + zero[0] = 0.0 | |
| 105 | + zero[1] = 0.0 | |
| 106 | + zero[2] = 0.0 | |
| 107 | + set_pev(id, pev_velocity, zero) | |
| 108 | +} |
csb.json
A
| @@ -0,0 +1,31 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Bad Spawn Fixer", | |
| 3 | + "category": "movement", | |
| 4 | + "tags": "spawn, telefrag, stuck", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Bad Spawn Fixer", | |
| 10 | + "short_desc": "Stops spawning inside another player: a hull trace on spawn nudges stuck players to the nearest free spot.", | |
| 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,hamsandwich", | |
| 20 | + "install_notes": "1. Enable the fakemeta and hamsandwich modules in addons/amxmodx/configs/modules.ini\n2. Put csb_bad_spawn_preventer.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "Other plugins that reposition players on spawn (random spawns, spawn protection teleports) may conflict; order them after this one.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_badspawn_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Enable or disable the bad-spawn fixer." | |
| 27 | + } | |
| 28 | + ], | |
| 29 | + "commands": [], | |
| 30 | + "main": "addons/amxmodx/scripting/csb_bad_spawn_preventer.sma" | |
| 31 | +} | |
| 0 | 32 |









