*
|
Управление кнопками W, S, R.
|
W - Включение/Выключение Линий.
|
S - Включение/Выключение Квадратов.
|
R - Включение/Выключение Линий и Квадратов.
|
Включение/Выключение работает только в режиме наблюдения от 1 лица.
|
Все настройки запоминаются не зависимо друг от друга.
|
*/
|
|
#include
|
#include
|
|
#define ADMIN_NONE -1
|
#if AMXX_VERSION_NUM < 183
|
#include
|
#define MAX_PLAYERS 32
|
#define client_disconnected client_disconnect
|
#endif
|
|
#define BUTTON_MANAGEMENT // Управление кнопками.
|
#define ADMIN_ESP ADMIN_BAN // Флаг админа для доступа к ESP (ADMIN_NONE - Доступ для всех)
|
|
new g_iLaser
|
new bool:g_bAdmin[MAX_PLAYERS +1], bool:g_IsAlive[MAX_PLAYERS +1]
|
new bool:g_OnOff[MAX_PLAYERS +1], bool:g_QSwitch[MAX_PLAYERS +1], bool:g_LSwitch[MAX_PLAYERS +1]
|
|
#if !defined BUTTON_MANAGEMENT
|
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3
|
#endif
|
|
new team_colors[4][3] =
|
{
|
{0, 0, 0}, {150, 0, 0}, {0, 0, 150}, {0, 150, 0}
|
}
|
|
public plugin_precache()
|
g_iLaser = precache_model("sprites/laserbeam.spr")
|
|
public plugin_end()
|
{
|
new pl[MAX_PLAYERS], pnum
|
get_players(pl, pnum)
|
for(new i; i < pnum; i ++)
|
remove_task(pl[i])
|
}
|
|
public plugin_init()
|
{
|
#define VERSION "1.1"
|
register_plugin("Lite Admin ESP", VERSION, "neygomon, AcE")
|
register_cvar("lite_aesp", VERSION, FCVAR_SERVER | FCVAR_SPONLY)
|
|
register_event("DeathMsg", "eDeathMsg", "a", "1>0")
|
register_event("ResetHUD", "eResetHud", "be")
|
register_event("TextMsg", "eSpecMode", "b", "2Spec_M")
|
|
#if !defined BUTTON_MANAGEMENT
|
register_clcmd("say /esp", "esp_menu", ADMIN_ESP, "Shows ESP Menu")
|
register_clcmd("say_team /esp", "esp_menu", ADMIN_ESP, "Shows ESP Menu")
|
register_menucmd(register_menuid("Menu"), keys, "show_esp_menu")
|
#endif
|
}
|
|
public client_putinserver(id)
|
{
|
g_IsAlive[id] = false
|
g_bAdmin[id] = g_OnOff[id] = g_QSwitch[id] = g_LSwitch[id] = (get_user_flags(id) & ADMIN_ESP) ? true : false
|
}
|
|
public client_disconnected(id)
|
{
|
if (g_bAdmin[id])
|
g_OnOff[id] = false
|
remove_task(id)
|
}
|
|
public eResetHud(id)
|
g_IsAlive[id] = true
|
|
public eDeathMsg()
|
g_IsAlive[read_data(2)] = false
|
|
public eSpecMode(id)
|
{
|
if (!g_bAdmin[id]) return
|
if (entity_get_int(id, EV_INT_iuser1) == 4)
|
set_task(0.3, "EspTimer", id, .flags = "b")
|
else remove_task(id)
|
}
|
|
#if defined BUTTON_MANAGEMENT
|
public client_PreThink(id)
|
{
|
if (g_IsAlive[id])
|
return PLUGIN_HANDLED
|
|
static button, oldbutton
|
button = entity_get_int(id, EV_INT_button)
|
oldbutton = entity_get_int(id, EV_INT_oldbuttons)
|
|
if (button == 0)
|
return PLUGIN_HANDLED
|
|
if (g_bAdmin[id])
|
{
|
if (entity_get_int(id, EV_INT_iuser1) == 4)
|
{
|
if ((button & IN_RELOAD) && !(oldbutton & IN_RELOAD))
|
{
|
g_OnOff[id] = !g_OnOff[id]
|
client_print_color(id, print_team_default, "^1[^4ESP^1] ^3Admin Spectator ^4%s", g_OnOff[id] ? "Включён" : "Выключен")
|
}
|
if ((button & IN_FORWARD) && !(oldbutton & IN_FORWARD))
|
{
|
g_LSwitch[id] = !g_LSwitch[id]
|
client_print_color(id, print_team_default, "^1[^4ESP^1] ^3Линии ^4%s", g_LSwitch[id] ? "Включены" : "Выключены")
|
}
|
if ((button & IN_BACK) && !(oldbutton & IN_BACK))
|
{
|
g_QSwitch[id] = !g_QSwitch[id]
|
client_print_color(id, print_team_default, "^1[^4ESP^1] ^3Квадраты ^4%s", g_QSwitch[id] ? "Включены" : "Выключены")
|
}
|
}
|
}
|
return PLUGIN_HANDLED
|
}
|
#else
|
public esp_menu(id)
|
{
|
new menu[501], len = 0, onoff[2][] = {{"\rВыкл"}, {"\yВкл"}}
|
len = formatex(menu[len], charsmax(menu) - len, "\r[\yESP\r] \wAdmin Spectator^n")
|
len += formatex(menu[len], charsmax(menu) - len, "\r1. \wESP: %s^n", onoff[g_OnOff[id]])
|
len += formatex(menu[len], charsmax(menu) - len, "\r2. \wЛинии: %s^n", onoff[g_LSwitch[id]])
|
len += formatex(menu[len], charsmax(menu) - len, "\r3. \wКвадраты: %s^n", onoff[g_QSwitch[id]])
|
len += formatex(menu[len], charsmax(menu) - len, "\r0. \wВыход")
|
show_menu(id, keys, menu, -1, "Menu")
|
}
|
|
public show_esp_menu(id, key)
|
{
|
switch(key)
|
{
|
case 0:
|
{
|
g_OnOff[id] = !g_OnOff[id]
|
esp_menu(id)
|
}
|
case 1:
|
{
|
g_LSwitch[id] = !g_LSwitch[id]
|
esp_menu(id)
|
}
|
case 2:
|
{
|
g_QSwitch[id] = !g_QSwitch[id]
|
esp_menu(id)
|
}
|
}
|
}
|
#endif
|
|
public EspTimer(id)
|
{
|
if (!g_OnOff[id]) return
|
switch(g_IsAlive[id])
|
{
|
case false:
|
{
|
static iTarget; iTarget = entity_get_int(id, EV_INT_iuser2)
|
if (iTarget && is_user_alive(iTarget) && is_valid_ent(iTarget))
|
SendAdminEsp(id, iTarget)
|
}
|
case true: remove_task(id)
|
}
|
}
|
|
SendAdminEsp(id, iTarget)
|
{
|
static pl[MAX_PLAYERS], pnum, my_team
|
static Float:my_origin[3], Float:target_origin[3], Float:v_middle[3], Float:v_hitpoint[3]
|
static Float:distance, Float:distance_to_hitpoint, Float:distance_target_hitpoint, Float:scaled_bone_len
|
static Float:v_bone_start[3], Float:v_bone_end[3], Float:offset_vector[3], Float:eye_level[3]
|
|
entity_get_vector(iTarget, EV_VEC_origin, my_origin)
|
my_team = get_user_team(iTarget)
|
get_players(pl, pnum, "ah")
|
|
for(new i; i < pnum; i ++)
|
{
|
if (pl[i] == iTarget) continue
|
if (my_team == get_user_team(pl[i])) continue
|
entity_get_vector(pl[i], EV_VEC_origin, target_origin)
|
distance = vector_distance(my_origin, target_origin)
|
trace_line(-1, my_origin, target_origin, v_hitpoint)
|
|
subVec(target_origin, my_origin, v_middle)
|
normalize(v_middle, offset_vector, (distance_to_hitpoint = vector_distance(my_origin, v_hitpoint)) - 10.0)
|
|
copyVec(my_origin, eye_level)
|
eye_level[2] += 17.5
|
addVec(offset_vector, eye_level)
|
copyVec(offset_vector, v_bone_start)
|
copyVec(offset_vector, v_bone_end)
|
v_bone_end[2] -= (scaled_bone_len = distance_to_hitpoint / distance * 50.0)
|
|
if (distance_to_hitpoint == distance) continue
|
distance_target_hitpoint = (distance - distance_to_hitpoint) / 12
|
|
if (g_QSwitch[id])
|
{
|
MakeQuadrate(id, v_bone_start, v_bone_end, floatround(scaled_bone_len * 3.0), (distance_target_hitpoint < 170.0) ? (255 - floatround(distance_target_hitpoint)) : 85)
|
}
|
if (g_LSwitch[id])
|
{
|
static width
|
if (!(distance < 2040.0)) width = 1
|
else width = (255 - floatround(distance / 8.0)) / 3
|
MakeLine(id, target_origin, width, my_team)
|
}
|
}
|
}
|
|
stock normalize(Float:Vec[3], Float:Ret[3], Float:multiplier)
|
{
|
static Float:len
|
len = vector_distance(Vec, Float:{0.0, 0.0, 0.0})
|
copyVec(Vec, Ret)
|
Ret[0] /= len
|
Ret[1] /= len
|
Ret[2] /= len
|
Ret[0] *= multiplier
|
Ret[1] *= multiplier
|
Ret[2] *= multiplier
|
}
|
|
stock copyVec(Float:Vec[3], Float:Ret[3])
|
{
|
Ret[0] = Vec[0]
|
Ret[1] = Vec[1]
|
Ret[2] = Vec[2]
|
}
|
|
stock subVec(Float:Vec1[3], Float:Vec2[3], Float:Ret[3])
|
{
|
Ret[0] = Vec1[0] - Vec2[0]
|
Ret[1] = Vec1[1] - Vec2[1]
|
Ret[2] = Vec1[2] - Vec2[2]
|
}
|
|
stock addVec(Float:Vec1[3], Float:Vec2[3])
|
{
|
Vec1[0] += Vec2[0]
|
Vec1[1] += Vec2[1]
|
Vec1[2] += Vec2[2]
|
}
|
|
MakeLine(id, Float:target_origin[3], width, my_team)
|
{
|
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id)
|
write_byte(1)
|
write_short(id)
|
write_coord(floatround(target_origin[0]))
|
write_coord(floatround(target_origin[1]))
|
write_coord(floatround(target_origin[2]))
|
write_short(g_iLaser)
|
write_byte(1)
|
write_byte(1)
|
write_byte(3)
|
write_byte(width)
|
write_byte(0)
|
write_byte(team_colors[my_team][0])
|
write_byte(team_colors[my_team][1])
|
write_byte(team_colors[my_team][2])
|
write_byte(255)
|
write_byte(0)
|
message_end()
|
}
|
|
MakeQuadrate(id, Float:Vec1[3], Float:Vec2[3], width, brightness)
|
{
|
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, {0, 0, 0}, id)
|
write_byte(0)
|
write_coord(floatround(Vec1[0]))
|
write_coord(floatround(Vec1[1]))
|
write_coord(floatround(Vec1[2]))
|
write_coord(floatround(Vec2[0]))
|
write_coord(floatround(Vec2[1]))
|
write_coord(floatround(Vec2[2]))
|
write_short(g_iLaser)
|
write_byte(3)
|
write_byte(0)
|
write_byte(3)
|
write_byte(width)
|
write_byte(0)
|
write_byte(0)
|
write_byte(255)
|
write_byte(0)
|
write_byte(brightness)
|
write_byte(0)
|
message_end()
|
} |