Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 226 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_drug.sma
+180 -0
A
csb.json
+42 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-07-12) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Drug</strong> is the classic joke command, rebuilt cleanly. <code>amx_drug <target> [seconds]</code> hits the victim with a repeating cocktail of a random-colour <code>ScreenFade</code>, a <code>ScreenShake</code> and randomised view punch angles (set through fakemeta) so their screen swims. It is a task-driven effect, not a one-shot, and it clears itself when the timer runs out, on death, or on disconnect.</p><p>Inspired by the well-known AMX Mod X "Drug" plugin. Independent GPL re-implementation; no original code is reused.</p><h2>Features</h2><ul><li><code>amx_drug <name or #userid> [seconds]</code> - defaults to <code>csb_drug_duration</code>.</li><li>Targeting through <code>cmd_target</code> with <code>ADMIN_IMMUNITY</code> respected.</li><li>Everything is reverted on expiry, on death and on disconnect - no stuck screens.</li></ul><h2>Installation</h2><ol><li>Compile <code>csb_drug.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><code>amx_drug</code> needs the <code>ADMIN_SLAY</code> flag (<code>h</code>) by default.</p> |
addons/amxmodx/scripting/csb_drug.sma
A
| @@ -0,0 +1,180 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Drug | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * amx_drug messes with a target's screen for a set duration: repeated random | |
| 6 | + * ScreenFade colours, a ScreenShake, and randomised punchangles applied through | |
| 7 | + * fakemeta. Everything is cleared and the view restored when it wears off, on | |
| 8 | + * death or on disconnect. | |
| 9 | + * | |
| 10 | + * Inspired by the classic "Drug" plugin for AMX Mod X. This is an independent | |
| 11 | + * GPL re-implementation; no original 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 <fakemeta> | |
| 24 | + | |
| 25 | +new const PLUGIN[] = "CSB Drug" | |
| 26 | +new const VERSION[] = "1.0.0" | |
| 27 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 28 | + | |
| 29 | +#define TASK_DRUG 8200 | |
| 30 | + | |
| 31 | +new g_pEnabled, g_pDuration | |
| 32 | +new bool:g_bDrugged[33] | |
| 33 | +new g_iTicks[33] | |
| 34 | +new g_msgShake, g_msgFade | |
| 35 | + | |
| 36 | +public plugin_init() | |
| 37 | +{ | |
| 38 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 39 | + | |
| 40 | + g_pEnabled = register_cvar("csb_drug_enabled", "1") | |
| 41 | + g_pDuration = register_cvar("csb_drug_duration", "20") | |
| 42 | + | |
| 43 | + register_concmd("amx_drug", "cmdDrug", ADMIN_SLAY, "<target> [seconds] - drug a player's screen") | |
| 44 | + | |
| 45 | + register_event("DeathMsg", "eventDeath", "a", "1>0") | |
| 46 | + | |
| 47 | + g_msgShake = get_user_msgid("ScreenShake") | |
| 48 | + g_msgFade = get_user_msgid("ScreenFade") | |
| 49 | +} | |
| 50 | + | |
| 51 | +public client_disconnected(id) | |
| 52 | +{ | |
| 53 | + if (g_bDrugged[id]) | |
| 54 | + stopDrug(id) | |
| 55 | +} | |
| 56 | + | |
| 57 | +public eventDeath() | |
| 58 | +{ | |
| 59 | + new victim = read_data(2) | |
| 60 | + | |
| 61 | + if (victim >= 1 && victim <= 32 && g_bDrugged[victim]) | |
| 62 | + stopDrug(victim) | |
| 63 | +} | |
| 64 | + | |
| 65 | +public cmdDrug(id, level, cid) | |
| 66 | +{ | |
| 67 | + if (!cmd_access(id, level, cid, 2)) | |
| 68 | + return PLUGIN_HANDLED | |
| 69 | + | |
| 70 | + if (!get_pcvar_num(g_pEnabled)) | |
| 71 | + { | |
| 72 | + console_print(id, "[CSB] Drug is disabled (csb_drug_enabled 0).") | |
| 73 | + return PLUGIN_HANDLED | |
| 74 | + } | |
| 75 | + | |
| 76 | + new arg[32] | |
| 77 | + read_argv(1, arg, charsmax(arg)) | |
| 78 | + | |
| 79 | + new target = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY) | |
| 80 | + if (!target) | |
| 81 | + return PLUGIN_HANDLED | |
| 82 | + | |
| 83 | + if (!is_user_alive(target)) | |
| 84 | + { | |
| 85 | + client_print(id, print_chat, "[CSB] That player is not alive.") | |
| 86 | + return PLUGIN_HANDLED | |
| 87 | + } | |
| 88 | + | |
| 89 | + new secs = get_pcvar_num(g_pDuration) | |
| 90 | + if (read_argc() > 2) | |
| 91 | + { | |
| 92 | + new sArg[8] | |
| 93 | + read_argv(2, sArg, charsmax(sArg)) | |
| 94 | + new n = str_to_num(sArg) | |
| 95 | + if (n > 0) | |
| 96 | + secs = n | |
| 97 | + } | |
| 98 | + | |
| 99 | + g_bDrugged[target] = true | |
| 100 | + g_iTicks[target] = secs * 2 | |
| 101 | + | |
| 102 | + remove_task(target + TASK_DRUG) | |
| 103 | + set_task(0.5, "taskDrug", target + TASK_DRUG, _, _, "b") | |
| 104 | + | |
| 105 | + new aname[32], tname[32] | |
| 106 | + if (id) | |
| 107 | + get_user_name(id, aname, charsmax(aname)) | |
| 108 | + else | |
| 109 | + copy(aname, charsmax(aname), "CONSOLE") | |
| 110 | + get_user_name(target, tname, charsmax(tname)) | |
| 111 | + | |
| 112 | + client_print(0, print_chat, "^x04[CSB]^x01 %s drugged^x03 %s^x01 for %d seconds.", aname, tname, secs) | |
| 113 | + log_amx("[CSB Drug] %s drugged %s for %d s", aname, tname, secs) | |
| 114 | + | |
| 115 | + return PLUGIN_HANDLED | |
| 116 | +} | |
| 117 | + | |
| 118 | +public taskDrug(taskid) | |
| 119 | +{ | |
| 120 | + new id = taskid - TASK_DRUG | |
| 121 | + | |
| 122 | + if (!is_user_connected(id) || !is_user_alive(id) || !g_bDrugged[id]) | |
| 123 | + { | |
| 124 | + stopDrug(id) | |
| 125 | + return | |
| 126 | + } | |
| 127 | + | |
| 128 | + g_iTicks[id]-- | |
| 129 | + if (g_iTicks[id] <= 0) | |
| 130 | + { | |
| 131 | + stopDrug(id) | |
| 132 | + return | |
| 133 | + } | |
| 134 | + | |
| 135 | + /* random full-screen colour wash */ | |
| 136 | + message_begin(MSG_ONE, g_msgFade, _, id) | |
| 137 | + write_short(1 << 11) // fade duration | |
| 138 | + write_short(1 << 11) // hold time | |
| 139 | + write_short(0x0000) // flags: modulate | |
| 140 | + write_byte(random_num(0, 255)) // r | |
| 141 | + write_byte(random_num(0, 255)) // g | |
| 142 | + write_byte(random_num(0, 255)) // b | |
| 143 | + write_byte(random_num(90, 170)) // alpha | |
| 144 | + message_end() | |
| 145 | + | |
| 146 | + /* jitter the screen */ | |
| 147 | + message_begin(MSG_ONE, g_msgShake, _, id) | |
| 148 | + write_short(random_num(5, 11) << 12) // amplitude | |
| 149 | + write_short(1 << 12) // duration | |
| 150 | + write_short(random_num(5, 11) << 12) // frequency | |
| 151 | + message_end() | |
| 152 | + | |
| 153 | + /* nudge the view angles */ | |
| 154 | + new Float:punch[3] | |
| 155 | + punch[0] = random_float(-9.0, 9.0) | |
| 156 | + punch[1] = random_float(-9.0, 9.0) | |
| 157 | + punch[2] = random_float(-9.0, 9.0) | |
| 158 | + set_pev(id, pev_punchangle, punch) | |
| 159 | +} | |
| 160 | + | |
| 161 | +stopDrug(id) | |
| 162 | +{ | |
| 163 | + g_bDrugged[id] = false | |
| 164 | + g_iTicks[id] = 0 | |
| 165 | + remove_task(id + TASK_DRUG) | |
| 166 | + | |
| 167 | + if (is_user_connected(id)) | |
| 168 | + { | |
| 169 | + /* clear the colour wash */ | |
| 170 | + message_begin(MSG_ONE, g_msgFade, _, id) | |
| 171 | + write_short(1 << 11) | |
| 172 | + write_short(0) | |
| 173 | + write_short(0x0000) | |
| 174 | + write_byte(0) | |
| 175 | + write_byte(0) | |
| 176 | + write_byte(0) | |
| 177 | + write_byte(0) | |
| 178 | + message_end() | |
| 179 | + } | |
| 180 | +} |
csb.json
A
| @@ -0,0 +1,42 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Drug", | |
| 3 | + "category": "fun", | |
| 4 | + "tags": "drug, screen, fun", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "AMXX community \"Drug\" plugin", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Drug", | |
| 10 | + "short_desc": "amx_drug scrambles a target's screen for a set time with repeated random ScreenFade colours, a ScreenShake and randomised punchangles, then restores the view.", | |
| 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", | |
| 20 | + "install_notes": "1. Put csb_drug.amxx in addons/amxmodx/plugins/\n2. Add it to addons/amxmodx/configs/plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_drug_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Enable or disable the command." | |
| 27 | + }, | |
| 28 | + { | |
| 29 | + "name": "csb_drug_duration", | |
| 30 | + "default": "20", | |
| 31 | + "description": "Default drug duration in seconds." | |
| 32 | + } | |
| 33 | + ], | |
| 34 | + "commands": [ | |
| 35 | + { | |
| 36 | + "name": "amx_drug", | |
| 37 | + "access": "h (ADMIN_SLAY)", | |
| 38 | + "description": "amx_drug <target> [seconds] - drug a player's screen." | |
| 39 | + } | |
| 40 | + ], | |
| 41 | + "main": "addons/amxmodx/scripting/csb_drug.sma" | |
| 42 | +} | |
| 0 | 43 |









