/* * CSB Admin Noclip * Copyright (C) 2026 counter-strike-boost.com * * Toggles MOVETYPE_NOCLIP for admins with amx_noclip (bind a key to it too). * A HUD marker shows while noclip is on, and it is disabled automatically on * death and at the start of every round so it cannot be carried into play. * A cvar blocks weapon fire while noclipping so it cannot be abused mid-fight. * * Inspired by the AMX Mod X admin commands. Independent GPL re-implementation. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. It is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See for details. */ #include #include #include new const PLUGIN[] = "CSB Admin Noclip" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" #define MOVETYPE_WALK 3 #define MOVETYPE_NOCLIP 8 #define IN_ATTACK (1<<0) #define IN_ATTACK2 (1<<11) #define ACCESS_FLAG ADMIN_CVAR new g_pEnabled, g_pBlockFire new bool:g_bNoclip[33] new g_iSync public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_noclip_enabled", "1") g_pBlockFire = register_cvar("csb_noclip_blockfire", "1") register_concmd("amx_noclip", "cmdNoclip", ACCESS_FLAG, "- toggle noclip on yourself") register_event("DeathMsg", "eventDeath", "a", "1>0") register_event("HLTV", "eventNewRound", "a", "1=0", "2=0") register_forward(FM_CmdStart, "fwCmdStart") g_iSync = CreateHudSyncObj() set_task(0.5, "taskHud", 0, _, _, "b") } public client_putinserver(id) { g_bNoclip[id] = false } public cmdNoclip(id, level, cid) { if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED if (!get_pcvar_num(g_pEnabled)) { console_print(id, "[CSB] Noclip is disabled.") return PLUGIN_HANDLED } if (!is_user_alive(id)) { client_print(id, print_chat, "[CSB] You must be alive to noclip.") return PLUGIN_HANDLED } setNoclip(id, !g_bNoclip[id]) client_print(id, print_chat, "[CSB] Noclip %s.", g_bNoclip[id] ? "ON" : "OFF") return PLUGIN_HANDLED } setNoclip(id, bool:on) { g_bNoclip[id] = on set_pev(id, pev_movetype, on ? MOVETYPE_NOCLIP : MOVETYPE_WALK) } public eventDeath() { new victim = read_data(2) if (victim >= 1 && victim <= 32 && g_bNoclip[victim]) g_bNoclip[victim] = false } public eventNewRound() { for (new id = 1; id <= 32; id++) { if (g_bNoclip[id]) { g_bNoclip[id] = false if (is_user_alive(id)) set_pev(id, pev_movetype, MOVETYPE_WALK) } } } public fwCmdStart(id, uc_handle, seed) { if (!g_bNoclip[id] || !get_pcvar_num(g_pBlockFire)) return FMRES_IGNORED new buttons = get_uc(uc_handle, UC_Buttons) if (buttons & (IN_ATTACK | IN_ATTACK2)) { buttons &= ~(IN_ATTACK | IN_ATTACK2) set_uc(uc_handle, UC_Buttons, buttons) } return FMRES_HANDLED } public taskHud() { new players[32], num get_players(players, num, "ch") set_hudmessage(0, 255, 255, 0.75, 0.85, 0, 0.0, 0.6, 0.0, 0.0, -1) for (new i = 0; i < num; i++) { new id = players[i] if (g_bNoclip[id]) ShowSyncHudMsg(id, g_iSync, "[ NOCLIP ]") } }