Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 214 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_atac.sma
+154 -0
A
csb.json
+56 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-12-17) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Anti Team Attack</strong> handles friendly fire two ways. With <code>csb_atac_block</code> on, a <code>Ham_TakeDamage</code> hook zeroes any damage between teammates — simple and absolute. With it off, the plugin instead counts team damage and team kills per player per map, and when someone crosses <code>csb_atac_dmg_limit</code> damage or <code>csb_atac_tk_limit</code> kills it punishes them.</p><p>The punishment is chosen by <code>csb_atac_action</code>: 1 slays, 2 kicks, 3 bans for <code>csb_atac_bantime</code> minutes. Every team kill is announced with a running count so players know where they stand. Inspired by <em>ATAC</em> by BAILOPAN; independent GPL re-implementation.</p><h2>Features</h2><ul><li>Block mode: cancel all team damage via <code>SetHamParamFloat</code>.</li><li>Punish mode: per-map team-damage and team-kill counters.</li><li>Configurable action — slay, kick or timed ban — on threshold.</li><li>Public team-kill announcements with a running tally.</li></ul><h2>Installation</h2><ol><li>Compile <code>csb_atac.sma</code> and copy it to <code>addons/amxmodx/plugins/</code>.</li><li>Add it to <code>plugins.ini</code> and change the map.</li></ol><p>Block mode needs friendly fire to actually be reaching the damage hook, so it works whether <code>mp_friendlyfire</code> is on or off. Bans are written with <code>writeid</code>.</p> |
addons/amxmodx/scripting/csb_atac.sma
A
| @@ -0,0 +1,154 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Anti Team Attack | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Blocks or punishes team damage. With csb_atac_block on, a Ham_TakeDamage hook | |
| 6 | + * zeroes damage between teammates. Otherwise it counts team damage and team | |
| 7 | + * kills per map and auto-slays, kicks or bans a player who crosses the | |
| 8 | + * configured threshold. | |
| 9 | + * | |
| 10 | + * Inspired by ATAC by BAILOPAN. Independent GPL re-implementation; no original | |
| 11 | + * code is reused. | |
| 12 | + * | |
| 13 | + * This program is free software: you can redistribute it and/or modify it under | |
| 14 | + * the terms of the GNU General Public License as published by the Free Software | |
| 15 | + * Foundation, either version 3 of the License, or (at your option) any later | |
| 16 | + * version. It is distributed in the hope that it will be useful, but WITHOUT | |
| 17 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 18 | + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details. | |
| 19 | + */ | |
| 20 | + | |
| 21 | +#include <amxmodx> | |
| 22 | +#include <amxmisc> | |
| 23 | +#include <hamsandwich> | |
| 24 | + | |
| 25 | +new const PLUGIN[] = "CSB Anti Team Attack" | |
| 26 | +new const VERSION[] = "1.0.0" | |
| 27 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 28 | + | |
| 29 | +new g_pEnabled, g_pBlock, g_pTkLimit, g_pDmgLimit, g_pAction, g_pBanTime | |
| 30 | + | |
| 31 | +new g_iTeamDmg[33] | |
| 32 | +new g_iTeamKills[33] | |
| 33 | +new bool:g_bPunished[33] | |
| 34 | + | |
| 35 | +public plugin_init() | |
| 36 | +{ | |
| 37 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 38 | + | |
| 39 | + g_pEnabled = register_cvar("csb_atac_enabled", "1") | |
| 40 | + g_pBlock = register_cvar("csb_atac_block", "1") | |
| 41 | + g_pTkLimit = register_cvar("csb_atac_tk_limit", "3") | |
| 42 | + g_pDmgLimit = register_cvar("csb_atac_dmg_limit", "300") | |
| 43 | + g_pAction = register_cvar("csb_atac_action", "1") | |
| 44 | + g_pBanTime = register_cvar("csb_atac_bantime", "30") | |
| 45 | + | |
| 46 | + RegisterHam(Ham_TakeDamage, "player", "fwdTakeDamage") | |
| 47 | + | |
| 48 | + register_event("DeathMsg", "eventDeath", "a", "1>0") | |
| 49 | + register_logevent("eventNewMap", 2, "1=Round_Start") | |
| 50 | +} | |
| 51 | + | |
| 52 | +public client_putinserver(id) | |
| 53 | +{ | |
| 54 | + g_iTeamDmg[id] = 0 | |
| 55 | + g_iTeamKills[id] = 0 | |
| 56 | + g_bPunished[id] = false | |
| 57 | +} | |
| 58 | + | |
| 59 | +public eventNewMap() | |
| 60 | +{ | |
| 61 | + /* nothing per-round; counters persist across the map on purpose */ | |
| 62 | +} | |
| 63 | + | |
| 64 | +public fwdTakeDamage(victim, inflictor, attacker, Float:damage, damagebits) | |
| 65 | +{ | |
| 66 | + if (!get_pcvar_num(g_pEnabled)) | |
| 67 | + return HAM_IGNORED | |
| 68 | + | |
| 69 | + if (attacker < 1 || attacker > 32 || attacker == victim) | |
| 70 | + return HAM_IGNORED | |
| 71 | + | |
| 72 | + if (!is_user_connected(victim) || get_user_team(victim) != get_user_team(attacker)) | |
| 73 | + return HAM_IGNORED | |
| 74 | + | |
| 75 | + if (get_pcvar_num(g_pBlock)) | |
| 76 | + { | |
| 77 | + SetHamParamFloat(4, 0.0) | |
| 78 | + return HAM_IGNORED | |
| 79 | + } | |
| 80 | + | |
| 81 | + g_iTeamDmg[attacker] += floatround(damage) | |
| 82 | + | |
| 83 | + if (!g_bPunished[attacker] && g_iTeamDmg[attacker] >= get_pcvar_num(g_pDmgLimit)) | |
| 84 | + punish(attacker, "team damage") | |
| 85 | + | |
| 86 | + return HAM_IGNORED | |
| 87 | +} | |
| 88 | + | |
| 89 | +public eventDeath() | |
| 90 | +{ | |
| 91 | + if (!get_pcvar_num(g_pEnabled) || get_pcvar_num(g_pBlock)) | |
| 92 | + return | |
| 93 | + | |
| 94 | + new killer = read_data(1) | |
| 95 | + new victim = read_data(2) | |
| 96 | + | |
| 97 | + if (killer < 1 || killer > 32 || killer == victim || !is_user_connected(victim)) | |
| 98 | + return | |
| 99 | + | |
| 100 | + if (get_user_team(killer) != get_user_team(victim)) | |
| 101 | + return | |
| 102 | + | |
| 103 | + g_iTeamKills[killer]++ | |
| 104 | + | |
| 105 | + new kname[32], vname[32] | |
| 106 | + get_user_name(killer, kname, charsmax(kname)) | |
| 107 | + get_user_name(victim, vname, charsmax(vname)) | |
| 108 | + | |
| 109 | + client_print(0, print_chat, "[CSB] %s team-killed %s (%d/%d this map).", | |
| 110 | + kname, vname, g_iTeamKills[killer], get_pcvar_num(g_pTkLimit)) | |
| 111 | + log_amx("[CSB ATAC] %s team-killed %s", kname, vname) | |
| 112 | + | |
| 113 | + if (!g_bPunished[killer] && g_iTeamKills[killer] >= get_pcvar_num(g_pTkLimit)) | |
| 114 | + punish(killer, "team kills") | |
| 115 | +} | |
| 116 | + | |
| 117 | +punish(id, const reason[]) | |
| 118 | +{ | |
| 119 | + g_bPunished[id] = true | |
| 120 | + | |
| 121 | + new name[32], authid[35] | |
| 122 | + get_user_name(id, name, charsmax(name)) | |
| 123 | + get_user_authid(id, authid, charsmax(authid)) | |
| 124 | + | |
| 125 | + new action = get_pcvar_num(g_pAction) | |
| 126 | + | |
| 127 | + switch (action) | |
| 128 | + { | |
| 129 | + case 1: | |
| 130 | + { | |
| 131 | + if (is_user_alive(id)) | |
| 132 | + user_kill(id) | |
| 133 | + client_print(0, print_chat, "[CSB ATAC] %s was slain for %s.", name, reason) | |
| 134 | + } | |
| 135 | + case 2: | |
| 136 | + { | |
| 137 | + client_print(0, print_chat, "[CSB ATAC] %s was kicked for %s.", name, reason) | |
| 138 | + server_cmd("kick #%d ^"Kicked by ATAC: %s^"", get_user_userid(id), reason) | |
| 139 | + } | |
| 140 | + case 3: | |
| 141 | + { | |
| 142 | + new mins = get_pcvar_num(g_pBanTime) | |
| 143 | + client_print(0, print_chat, "[CSB ATAC] %s was banned for %d min for %s.", name, mins, reason) | |
| 144 | + server_cmd("banid %d #%d kick", mins, get_user_userid(id)) | |
| 145 | + server_cmd("writeid") | |
| 146 | + } | |
| 147 | + default: | |
| 148 | + { | |
| 149 | + client_print(0, print_chat, "[CSB ATAC] %s crossed the %s threshold.", name, reason) | |
| 150 | + } | |
| 151 | + } | |
| 152 | + | |
| 153 | + log_amx("[CSB ATAC] punished %s <%s> for %s (action %d)", name, authid, reason, action) | |
| 154 | +} |
csb.json
A
| @@ -0,0 +1,56 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Anti Team Attack", | |
| 3 | + "category": "admin", | |
| 4 | + "tags": "atac, teamkill, friendly fire", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "BAILOPAN (ATAC)", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Anti Team Attack", | |
| 10 | + "short_desc": "Blocks team damage outright, or counts team damage/kills per map and auto-slays, kicks or bans repeat offenders.", | |
| 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": "hamsandwich", | |
| 20 | + "install_notes": "1. Put csb_atac.amxx in addons/amxmodx/plugins/\n2. Add it to addons/amxmodx/configs/plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "Other friendly-fire or anti-teamkill plugins that also hook Ham_TakeDamage can conflict; run only one.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_atac_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Master enable for the plugin." | |
| 27 | + }, | |
| 28 | + { | |
| 29 | + "name": "csb_atac_block", | |
| 30 | + "default": "1", | |
| 31 | + "description": "1 = cancel team damage; 0 = count and punish instead." | |
| 32 | + }, | |
| 33 | + { | |
| 34 | + "name": "csb_atac_tk_limit", | |
| 35 | + "default": "3", | |
| 36 | + "description": "Team kills in one map before punishment (punish mode)." | |
| 37 | + }, | |
| 38 | + { | |
| 39 | + "name": "csb_atac_dmg_limit", | |
| 40 | + "default": "300", | |
| 41 | + "description": "Team damage in one map before punishment (punish mode)." | |
| 42 | + }, | |
| 43 | + { | |
| 44 | + "name": "csb_atac_action", | |
| 45 | + "default": "1", | |
| 46 | + "description": "Punishment: 1 slay, 2 kick, 3 ban." | |
| 47 | + }, | |
| 48 | + { | |
| 49 | + "name": "csb_atac_bantime", | |
| 50 | + "default": "30", | |
| 51 | + "description": "Ban length in minutes when action is 3." | |
| 52 | + } | |
| 53 | + ], | |
| 54 | + "commands": [], | |
| 55 | + "main": "addons/amxmodx/scripting/csb_atac.sma" | |
| 56 | +} | |
| 0 | 57 |









