Romania XPlayZM.CSBlackDevil.COM # Zombie Plague UltimateX [ Respawn + FDL + VIP 22-12PM + POINTS] ® 11/32
Unknown ❤ RESPAWN.ZAFEST.RO | VIP FREE | FREE FOR ALL ❤ 0/32
France EMIRATES.KiNGS 亗 GAMEAREA ||͇̿P͇̿U͇̿B͇̿L͇̿I͇̿C͇̿| ✪ 32/32
United Kingdom BALKAN.KiNGS.EU ||͇̿P͇̿U͇̿B͇̿L͇̿I͇̿C͇̿| ✪ 25/32
Promocionar servidor
csb-admin-esp / addons / amxmodx / scripting / csb_admin_esp.sma
120 lines 3.2 KiB Pawn Raw Permalink History
/*
 * CSB Admin ESP
 * Copyright (C) 2026 counter-strike-boost.com
 *
 * Gives an admin a wallhack-style glow on players. It hooks FM_AddToFullPack and
 * sets kRenderFxGlowShell + a team colour ONLY in the packets destined for that
 * one admin client, so normal players see nothing changed. Toggled per admin
 * with amx_esp and restricted by a flag.
 *
 * 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 <https://www.gnu.org/licenses/> for details.
 */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new const PLUGIN[] = "CSB Admin ESP"
new const VERSION[] = "1.0.0"
new const AUTHOR[]  = "counter-strike-boost.com"

new bool:g_bEsp[33]
new g_pEnabled
new g_iActive = 0

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)

    g_pEnabled = register_cvar("csb_esp_enabled", "1")

    register_concmd("amx_esp", "cmdEsp", ADMIN_CFG, "[0|1] - toggle wallhack glow ESP for yourself")

    register_forward(FM_AddToFullPack, "fwAddToFullPack", 1)
}

public client_disconnected(id)
{
    if (g_bEsp[id])
    {
        g_bEsp[id] = false
        g_iActive--
    }
}

public cmdEsp(id, level, cid)
{
    if (!cmd_access(id, level, cid, 1))
        return PLUGIN_HANDLED

    if (!get_pcvar_num(g_pEnabled))
    {
        console_print(id, "[CSB] ESP is disabled (csb_esp_enabled 0).")
        return PLUGIN_HANDLED
    }

    new bool:want = !g_bEsp[id]

    if (read_argc() > 1)
    {
        new arg[4]
        read_argv(1, arg, charsmax(arg))
        want = (str_to_num(arg) != 0)
    }

    if (want == g_bEsp[id])
    {
        client_print(id, print_chat, "[CSB] ESP already %s.", want ? "ON" : "OFF")
        return PLUGIN_HANDLED
    }

    g_bEsp[id] = want
    g_iActive += want ? 1 : -1

    client_print(id, print_chat, "[CSB] Admin ESP %s.", want ? "ON" : "OFF")

    new aname[32]
    get_user_name(id, aname, charsmax(aname))
    log_amx("[CSB ESP] %s turned ESP %s", aname, want ? "on" : "off")
    return PLUGIN_HANDLED
}

public fwAddToFullPack(es, e, ent, host, hostflags, player, pSet)
{
    /* only rewrite entity states for player entities... */
    if (!player)
        return FMRES_IGNORED

    /* ...and only when the receiving host is an admin with ESP enabled */
    if (host < 1 || host > 32 || !g_bEsp[host])
        return FMRES_IGNORED

    if (ent == host || !is_user_alive(ent))
        return FMRES_IGNORED

    new r = 200, g = 200, b = 200

    switch (get_user_team(ent))
    {
        case 1:  { r = 255; g = 60;  b = 60;  }   /* T  - red   */
        case 2:  { r = 60;  g = 120; b = 255; }   /* CT - blue  */
        default: { r = 200; g = 200; b = 200; }
    }

    new Float:color[3]
    color[0] = float(r)
    color[1] = float(g)
    color[2] = float(b)

    set_es(es, ES_RenderMode, kRenderNormal)
    set_es(es, ES_RenderFx, kRenderFxGlowShell)
    set_es(es, ES_RenderColor, color)
    set_es(es, ES_RenderAmt, 30.0)

    return FMRES_HANDLED
}