Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 126 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_knockback_shots.sma
+81 -0
A
csb.json
+41 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-05-21) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Knockback Shots</strong> gives every hit real weight. In a <code>Ham_TakeDamage</code> hook the victim's velocity is shoved along the line from the attacker to the target, scaled by the damage that landed and a tunable power multiplier, with a small upward component so people get lifted a little on big hits. It turns shotguns into cannons and makes fun servers feel punchy without changing damage values.</p><h2>Features</h2><ul><li>Push direction is the real attacker-to-victim vector, so it always feels right.</li><li>Force scales with the damage of the shot — a shotgun blast throws harder than a pistol tap.</li><li><code>csb_kb_power</code> and <code>csb_kb_vertical</code> tune horizontal and upward push.</li><li>Only player-vs-player hits push; self-damage and world damage are ignored.</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_knockback_shots.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_knockback_shots.sma
A
| @@ -0,0 +1,81 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Knockback Shots | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Adds a physical push to every bullet hit: in a Ham_TakeDamage hook the victim | |
| 6 | + * is shoved along the shot direction (attacker -> victim) with a force scaled by | |
| 7 | + * the damage dealt and a per-weapon multiplier. Great for shotgun / fun servers. | |
| 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 | +#include <fakemeta> | |
| 19 | +#include <hamsandwich> | |
| 20 | + | |
| 21 | +new const PLUGIN[] = "CSB Knockback Shots" | |
| 22 | +new const VERSION[] = "1.0.0" | |
| 23 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 24 | + | |
| 25 | +new g_pEnabled, g_pPower, g_pVertical | |
| 26 | + | |
| 27 | +public plugin_init() | |
| 28 | +{ | |
| 29 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 30 | + | |
| 31 | + g_pEnabled = register_cvar("csb_kb_enabled", "1") | |
| 32 | + g_pPower = register_cvar("csb_kb_power", "8.0") | |
| 33 | + g_pVertical = register_cvar("csb_kb_vertical", "0.35") | |
| 34 | + | |
| 35 | + RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage", 0) | |
| 36 | +} | |
| 37 | + | |
| 38 | +public fwTakeDamage(victim, inflictor, attacker, Float:damage, damagebits) | |
| 39 | +{ | |
| 40 | + if (!get_pcvar_num(g_pEnabled)) | |
| 41 | + return HAM_IGNORED | |
| 42 | + | |
| 43 | + if (!is_user_alive(victim)) | |
| 44 | + return HAM_IGNORED | |
| 45 | + | |
| 46 | + /* only real player-vs-player bullet/blast pushes */ | |
| 47 | + if (attacker < 1 || attacker > 32 || attacker == victim) | |
| 48 | + return HAM_IGNORED | |
| 49 | + | |
| 50 | + if (!is_user_connected(attacker)) | |
| 51 | + return HAM_IGNORED | |
| 52 | + | |
| 53 | + static Float:fVic[3], Float:fAtt[3], Float:fDir[3] | |
| 54 | + pev(victim, pev_origin, fVic) | |
| 55 | + pev(attacker, pev_origin, fAtt) | |
| 56 | + | |
| 57 | + fDir[0] = fVic[0] - fAtt[0] | |
| 58 | + fDir[1] = fVic[1] - fAtt[1] | |
| 59 | + fDir[2] = 0.0 | |
| 60 | + | |
| 61 | + new Float:len = floatsqroot(fDir[0] * fDir[0] + fDir[1] * fDir[1]) | |
| 62 | + | |
| 63 | + if (len < 1.0) | |
| 64 | + return HAM_IGNORED | |
| 65 | + | |
| 66 | + fDir[0] /= len | |
| 67 | + fDir[1] /= len | |
| 68 | + | |
| 69 | + new Float:power = get_pcvar_float(g_pPower) | |
| 70 | + new Float:force = damage * power | |
| 71 | + | |
| 72 | + static Float:fVel[3] | |
| 73 | + pev(victim, pev_velocity, fVel) | |
| 74 | + | |
| 75 | + fVel[0] += fDir[0] * force | |
| 76 | + fVel[1] += fDir[1] * force | |
| 77 | + fVel[2] += force * get_pcvar_float(g_pVertical) | |
| 78 | + | |
| 79 | + set_pev(victim, pev_velocity, fVel) | |
| 80 | + return HAM_IGNORED | |
| 81 | +} |
csb.json
A
| @@ -0,0 +1,41 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Knockback Shots", | |
| 3 | + "category": "fun", | |
| 4 | + "tags": "knockback, push, fun", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Knockback Shots", | |
| 10 | + "short_desc": "Every bullet physically pushes the victim along the shot direction, scaled by damage. Perfect for shotgun and fun servers.", | |
| 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_knockback_shots.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "Other plugins that overwrite pev_velocity on damage can fight this one.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_kb_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Enable or disable knockback." | |
| 27 | + }, | |
| 28 | + { | |
| 29 | + "name": "csb_kb_power", | |
| 30 | + "default": "8.0", | |
| 31 | + "description": "Horizontal push multiplier per point of damage." | |
| 32 | + }, | |
| 33 | + { | |
| 34 | + "name": "csb_kb_vertical", | |
| 35 | + "default": "0.35", | |
| 36 | + "description": "Fraction of the push applied upward." | |
| 37 | + } | |
| 38 | + ], | |
| 39 | + "commands": [], | |
| 40 | + "main": "addons/amxmodx/scripting/csb_knockback_shots.sma" | |
| 41 | +} | |
| 0 | 42 |









