#include <amxmodx>
#include <cstrike>
#include <amxmisc>
#include <engine>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <colorchat>
#define HOOK_LEVEL ADMIN_LEVEL_A // Уровен доступа
#define TRAIL_LIFE 10 // Жизнь полосы
#define TRAIL_WIDTH 10 // Ширина полосы
#define TRAIL_RED 0 // Цвет: Красный
#define TRAIL_GREEN 255 // Цвет: Зелёный
#define TRAIL_BLUE 0 // Цвет: Голубой
#define TRAIL_BRIGTHNESS 220 // Яркость
#define TRAIL_LIF 10 // Жизнь полосы
#define TRAIL_WIDT 10 // Ширина полосы
#define TRAIL_RE 0 // Цвет: Красный
#define TRAIL_GREE 255 // Цвет: Зелёный
#define TRAIL_BLU 255 // Цвет: Голубой
#define TRAIL_BRIGTHNES 220 // Яркость
#pragma tabsize 0
new bool:canusehook[32]
new bool:ishooked[32]
new hookorigin[32][3]
new Enable
new Glow, GlowRandom, GlowR, GlowG, GlowB
new Fade, FadeRandom, fadeR, fadeG, fadeB
new gTrail
new HookSpeed
new g_iBeamSprite
new g_speed[33]
new g_shortSpr[6];
new g_short[6][] =
{
"sprites/Gaming/ef_bootleg_fireball02.spr",
"sprites/Gaming/ef_bootleg_fireball03.spr" ,
"sprites/Gaming/ef_bootleg_fireball01.spr" ,
"sprites/Gaming/Bule.spr" ,
"sprites/Gaming/fire_exp.spr" ,
"sprites/Gaming/LuXo~KING~Gaming.spr"
}
public plugin_init() {
register_plugin("Hook","2.0","LuXo")
register_plugin( "get_user_info", "8.5", "LuXo KING Gaming" );
register_concmd( "amx_getinfo1", "CmdGetInfo", ADMIN_USER, "<name> <info key>" );
register_clcmd("+hook","hook_on",HOOK_LEVEL)
register_clcmd("-hook","hook_off",HOOK_LEVEL)
register_clcmd("hook_speed","Menu_hook")
register_clcmd("hook_give","give_hook",HOOK_LEVEL,"<name|#userid|steamid|@ALL> <on/off>") // Дать/отнять хук
Enable = register_cvar( "hook_enable", "1" ) // Вкл./Выкл. Плагин (По умолчанию Вкл)
Glow = register_cvar( "hook_glow", "1" ) // Аура при полете Вкл./Выкл. (По умолчанию Вкл)
GlowRandom = register_cvar( "hook_glow_random", "1" ) // Рандомная подсветка
GlowR = register_cvar( "hook_glow_r", "255" ) // Цвет свечения(красный)
GlowG = register_cvar( "hook_glow_g", "255" ) // Цвет свечения(зеленый)
GlowB = register_cvar( "hook_glow_b", "255" ) // Цвет свечения(синий)
Fade = register_cvar( "hook_screenfade", "0" ) // Затемнение экрана при полете Вкл./Выкл. (По умолчанию Вкл)
FadeRandom = register_cvar( "hook_screenfade_random", "1" ) // Использовать рандомный цвет (1 - да, 2 -нет)(По умолчанию 1)
fadeR = register_cvar( "hook_fade_r", "255" ) // Цвет затемнения экрана при полете(красный)
fadeG = register_cvar( "hook_fade_g", "255" ) // Цвет затемнения экрана при полете(зеленый)
fadeB = register_cvar( "hook_fade_b", "255" ) // Цвет затемнения экрана при полете(синий)
HookSpeed = register_cvar( "hook_speed", "450" ) // Скорость (По умолчанию: 350)
}
public plugin_precache() {
for(new i=0;i<sizeof(g_short);i++)
g_shortSpr[i] = precache_model(g_short[i]);
g_iBeamSprite = precache_model("sprites/lgtning.spr");
gTrail = precache_model("sprites/vselennaya.spr")
precache_sound("cs/exparrow_shoot1.wav")
}
public Menu_hook(id)
{
if(get_user_flags(id) & ADMIN_LEVEL_F)
{
new menu = menu_create("\r(.::\yПаутинка\r::.) \wНастройка скорости паутинки \y!^n\r(.::\yПаутинка\r::.) \wПаутинка Администрации \y<3^n\r(.::\yПаутинка\r::.) \wНе балуйся \y!","menu_hook")
if(g_speed[id] == 0)
{
menu_additem(menu,"Низкая \d[\yВкл\d]", "1", 0)
}else{
menu_additem(menu,"Низкая \d[\rВыкл\d]", "1", 0)
}
if(g_speed[id] == 1)
{
menu_additem(menu,"Стандартная \d[\yВкл\d]", "2", 0)
}else{
menu_additem(menu,"Стандартная \d[\rВыкл\d]", "2", 0)
}
if(g_speed[id] == 2)
{
menu_additem(menu,"Высокая \d[\yВкл\d]", "3", 0)
}else{
menu_additem(menu,"Высокая \d[\rВыкл\d]", "3", 0)
}
menu_setprop(menu , MPROP_NEXTNAME, "Далее")
menu_setprop(menu , MPROP_BACKNAME, "Назад")
menu_setprop(menu , MPROP_EXITNAME, "Выход")
menu_setprop(menu , MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu)
}else{
ColorChat(id,BLUE,"^4(.::Паутинка::.) ^3У тебя нет паутины. Хотите купить ? обратитесь к ^4Гл.Админу...")
}
return PLUGIN_HANDLED
}
public menu_hook(id, menu, key)
{
if(key == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new accss, clbck, data[6], name[64], itm
menu_item_getinfo(menu, key, accss, data, 5, name, 63, clbck)
itm = str_to_num(data)
switch(itm)
{
case 1:
{
if(g_speed[id] == 0)
{
ColorChat(id,BLUE,"^3(.::Паутинка::.) ^4Уже установлено.")
Menu_hook(id)
}else{
g_speed[id] = 0
ColorChat(id,BLUE,"^3(.::Паутинка::.) ^4Вы выбрали скорость паутины: ^3низкая.")
}
}
case 2:
{
if(g_speed[id] == 1)
{
ColorChat(id,BLUE,"^3(.::Паутинка::.) ^4Уже установлено.")
Menu_hook(id)
}else{
g_speed[id] = 1
ColorChat(id,BLUE,"^3(.::Паутинка::.) ^4Вы выбрали скорость паутины: ^3стандартная.")
}
}
case 3:
{
if(g_speed[id] == 2)
{
ColorChat(id,BLUE,"^3(.::Паутинка::.) ^4Уже установлено.")
Menu_hook(id)
}else{
g_speed[id] = 2
ColorChat(id,BLUE,"^3(.::Паутинка::.) ^4Вы выбрали скорость паутины: ^3высокая.")
}
}
}
return PLUGIN_HANDLED
}
public client_disconnect(id) {
remove_hook(id)
g_speed[id] = 1
}
public client_putinserver(id) {
remove_hook(id)
g_speed[id] = 1
}
public CmdGetInfo( iPlayer, iLevel, iCId ) {
if( !cmd_access( iPlayer, iLevel, iCId, 3 ) ) {
return PLUGIN_HANDLED;
}
new szArg[ 35 ];
read_argv( 1, szArg, 34 );
new iTarget = cmd_target( iPlayer, szArg, ( CMDTARGET_NO_BOTS | CMDTARGET_OBEY_IMMUNITY ) );
if( !iTarget ) {
return PLUGIN_HANDLED;
}
read_argv( 2, szArg, 34 );
new szData[ 64 ];
get_user_info( iTarget, szArg, szData, 63 );
new szName[ 32 ];
get_user_name( iTarget, szName, 31 );
console_print( iPlayer, "Player: %s", szName );
console_print( iPlayer, "setinfo ^"%s^" ^"%s^"", szArg, szData );
return PLUGIN_HANDLED;
}
// =================================================================================================
public give_hook(id,level,cid) {
if(!cmd_access(id,level,cid,3))
return PLUGIN_HANDLED
new name[32]
get_user_name(id,name,32)
new szarg1[32], szarg2[8], bool:mode
read_argv(1,szarg1,32)
read_argv(2,szarg2,32)
if(equal(szarg2,"on"))
mode = true
if(equal(szarg1,"@ALL")) {
for(new i=1;i<=get_maxplayers();i++) {
if(is_user_connected(i) && is_user_alive(i)) {
canusehook[i-1] = mode
if(mode) {
client_print(i,print_chat,"(.::Паутинка::.) Админ %s дал возможность возможность использовать hook",name)
client_print(i,print_chat,"(.::Паутинка::.) Забиндите '+hook' на кнопку")
}
else
client_print(i,print_chat,"(.::Паутинка::.) Админ %s отнял возможность возможность использовать hook",name)
}
}
}
else {
new pid = cmd_target(id,szarg1,2)
if(pid > 0) {
canusehook[pid-1] = mode
if(mode) {
client_print(pid,print_chat,"(.::Паутинка::.) Админ %s дал возможность возможность использовать hook",name)
client_print(pid,print_chat,"(.::Паутинка::.) Забиндите '+hook' на кнопку")
}
else
client_print(pid,print_chat,"(.::Паутинка::.) Админ %s отнял возможность возможность использовать hook",name)
}
}
return PLUGIN_HANDLED
}
// =================================================================================================
public hook_on(id,level,cid)
{
if( get_pcvar_num( Enable ) )
{
if(!canusehook[id-1] && !cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
if(get_user_flags(id) & ADMIN_BAN)
{
get_user_origin(id,hookorigin[id-1],3)
if(callfunc_begin("detect_cheat","prokreedz.amxx") == 1) {
callfunc_push_int(id)
callfunc_push_str("Hook")
callfunc_end()
}
ishooked[id-1] = true
emit_sound(id,CHAN_STATIC,"cs/exparrow_shoot1.wav",1.0,ATTN_NORM,0,PITCH_NORM)
set_task(0.1,"hook_task",id,"",0,"ab")
hook_task(id)
func_break(id)
}
if( is_user_alive( id ) && get_pcvar_num( Glow ) )
{
if( is_user_alive( id ) && get_pcvar_num( GlowRandom ) )
{
set_user_rendering(id, kRenderFxGlowShell, random_num( 0,255 ), random_num( 0,255 ), random_num( 0,255 ), kRenderNormal, 16 )
}
else
{
set_user_rendering(id, kRenderFxGlowShell, ( get_pcvar_num( GlowR ) ), ( get_pcvar_num( GlowG ) ), ( get_pcvar_num( GlowB ) ), kRenderNormal, 16 )
}
}
}
else
{
ColorChat(id, RED,"(.::Паутинка::.) ^4Функция отключена!")
}
if( get_pcvar_num( Fade ) )
{
if( get_pcvar_num( FadeRandom ) )
{
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("ScreenFade"),{0,0,0}, id)
write_short( 10<<12 )
write_short( 10<<16 )
write_short( 1<<1 )
write_byte random_num( 0,255 )
write_byte random_num( 0,255 )
write_byte random_num( 0,255 )
write_byte( 255 )
message_end()
}
else
{
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("ScreenFade"),{0,0,0}, id)
write_short( 10<<12 )
write_short( 10<<16 )
write_short( 1<<1 )
write_byte ( get_pcvar_num( fadeR ) )
write_byte ( get_pcvar_num( fadeG ) )
write_byte ( get_pcvar_num( fadeB ) )
write_byte( 255 )
message_end()
}
}
return PLUGIN_HANDLED
}
// =================================================================================================
public is_hooked(id) {
return ishooked[id-1]
}
// =================================================================================================
public hook_off(id) {
remove_hook(id)
if( is_user_alive( id ) && get_pcvar_num( Glow ) )
{
set_user_rendering(id, kRenderFxGlowShell, random_num( 0,0 ), random_num( 0,0 ), random_num( 0,0 ), kRenderNormal, 16 )
}
if( get_pcvar_num( Fade ) )
{
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("ScreenFade"),{0,0,0}, id)
write_short( 10<<12 )
write_short( 10<<16 )
write_short( 1<<1 )
write_byte ( 255 )
write_byte ( 255 )
write_byte ( 255 )
write_byte( 255 )
message_end()
}
return PLUGIN_HANDLED
}
// =================================================================================================
public hook_task(id) {
if(!is_user_connected(id) || !is_user_alive(id))
remove_hook(id)
remove_beam(id)
f(id)
func_trail(id)
func_trail_ct(id)
new origin[3], Float:velocity[3]
get_user_origin(id,origin)
new distance = get_distance(hookorigin[id-1],origin)
new Float:HSpeed = get_pcvar_float(HookSpeed)
if(distance > 25)
{
if(g_speed[id] == 0)
{
velocity[0] = (hookorigin[id-1][0] - origin[0]) * (4.0 * 100 / distance)
velocity[1] = (hookorigin[id-1][1] - origin[1]) * (4.0 * 100 / distance)
velocity[2] = (hookorigin[id-1][2] - origin[2]) * (4.0 * 100 / distance)
}else if(g_speed[id] == 1){
velocity[0] = (hookorigin[id-1][0] - origin[0]) * (4.0 * 200 / distance)
velocity[1] = (hookorigin[id-1][1] - origin[1]) * (4.0 * 200 / distance)
velocity[2] = (hookorigin[id-1][2] - origin[2]) * (4.0 * 200 / distance)
}else if(g_speed[id] == 2){
velocity[0] = (hookorigin[id-1][0] - origin[0]) * (4.0 * 300 / distance)
velocity[1] = (hookorigin[id-1][1] - origin[1]) * (4.0 * 300 / distance)
velocity[2] = (hookorigin[id-1][2] - origin[2]) * (4.0 * 300 / distance)
}
entity_set_vector(id,EV_VEC_velocity,velocity)
}
else {
entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0})
remove_hook(id)
}
}
// =================================================================================================
public f(id)
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_BEAMENTPOINT);
write_short(id); //Индекс entity
write_coord(hookorigin[id-1][0]); //Конечная точка x
write_coord(hookorigin[id-1][1]); //Конечная точка y
write_coord(hookorigin[id-1][2]); //Конечная точка z
write_short(g_iBeamSprite); //Индекс спрайта
write_byte(0) //Стартовый кадр
write_byte(1); //Скорость анимации
write_byte(1); //Врмея существования
write_byte(42); //Толщина луча
write_byte(30); //Искажение
switch(random(10))
{
case 0:
{
write_byte(255); //Цвет красный
write_byte(255); //Цвеи зеленый
write_byte(0); //Цвет синий
}
case 1:
{
write_byte(0); //Цвет красный
write_byte(255); //Цвеи зеленый
write_byte(255); //Цвет синий
}
case 2:
{
write_byte(255); //Цвет красный
write_byte(0); //Цвеи зеленый
write_byte(255); //Цвет синий
}
case 3:
{
write_byte(75); //Цвет красный
write_byte(0); //Цвеи зеленый
write_byte(130); //Цвет синий
}
case 4:
{
write_byte(0); //Цвет красный
write_byte(255); //Цвеи зеленый
write_byte(0); //Цвет синий
}
case 5:
{
write_byte(0); //Цвет красный
write_byte(0); //Цвеи зеленый
write_byte(255); //Цвет синий
}
case 6:
{
write_byte(255); //Цвет красный
write_byte(0); //Цвеи зеленый
write_byte(0); //Цвет синий
}
case 7:
{
write_byte(255); //Цвет красный
write_byte(192); //Цвеи зеленый
write_byte(203); //Цвет синий
}
case 8:
{
write_byte(255); //Цвет красный
write_byte(20); //Цвеи зеленый
write_byte(147); //Цвет синий
}
case 9:
{
write_byte(0); //Цвет красный
write_byte(128); //Цвеи зеленый
write_byte(128); //Цвет синий
}
}
write_byte(2000); //Яркость
write_byte(0); //...
message_end();
}
// =================================================================================================
public func_break(id)
{
for(new j=0;j<sizeof(g_shortSpr);j++)
{
new origin[3]
get_user_origin(id,origin,3)
message_begin(MSG_ALL,SVC_TEMPENTITY,{0,0,0},id)
write_byte(TE_SPRITETRAIL) //Спрайт захвата
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2]+20)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2]+80)
write_short(g_shortSpr[j]);
write_byte(1)
write_byte(20)
write_byte(4)
write_byte(20)
write_byte(10)
message_end()
}
}
// =================================================================================================
public func_trail(id)
if(cs_get_user_team(id) == CS_TEAM_T)
{
{
{
message_begin (MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (TE_BEAMFOLLOW)
write_short (id)
write_short (gTrail)
write_byte (TRAIL_LIFE)
write_byte (TRAIL_WIDTH)
write_byte (TRAIL_RED)
write_byte (TRAIL_GREEN)
write_byte (TRAIL_BLUE)
write_byte (TRAIL_BRIGTHNESS)
message_end()
}
}
}
public func_trail_ct(id)
if(cs_get_user_team(id) == CS_TEAM_CT)
{
{
{
message_begin (MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (TE_BEAMFOLLOW)
write_short (id)
write_short (gTrail)
write_byte (TRAIL_LIF)
write_byte (TRAIL_WIDT)
write_byte (TRAIL_RE)
write_byte (TRAIL_GREE)
write_byte (TRAIL_BLU)
write_byte (TRAIL_BRIGTHNES)
message_end()
}
}
}
// =================================================================================================
public remove_hook(id) {
if(task_exists(id))
remove_task(id)
remove_beam(id)
ishooked[id-1] = false
}
// =================================================================================================
public remove_beam(id) {
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(99) // TE_KILLBEAM
write_short(id)
message_end()
}