Добро пожаловать на форум, Гость, это ваша панель
  • Страница 1 из 1
  • 1
Помогите пожалуйста с плагином "Hook\Хук"
formen
Дата: Понедельник, 17.08.2015, 15:25 | Сообщение # 1
офлайн

  • Сообщения: 5
  • Награды: 0
  • Замечания:
 
Ребята, всем привет) Помогите пожалуйста совместить эти 2 плагина.
Нужно в первый плагин добавить, что есть во втором:

1. Эффект полёта (CT синяя полоса - T Красная полоса)
2. Эффект касания паутины (Шар)
3. Эффект свечения (подсветка игрока)

А дальше всё оставить как в первом плагине.

Код
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <hamsandwich>

new bool:canusehook[32]
new bool:ishooked[32]
new hookorigin[32][3]
new blockhook[33]

new Sbeam

public plugin_init()
{
register_plugin("Hook","1.1","=)")

RegisterHam(Ham_Spawn, "player", "Spawn_player", 1)

register_clcmd("+hook","hook_on")
register_clcmd("-hook","hook_off")

}

public plugin_precache()
{
precache_sound("hook_wkolota/hook.wav")
Sbeam = precache_model("sprites/hook/hook.spr")
}

public Spawn_player(id)
{
if(is_user_alive(id) && is_user_connected(id))
{
blockhook [id]= 0
}
}

public plugin_cfg()
{
new const szDisableMapTypes[][] = {"35hp_", "ka_"}; // Типы карт, на которых плагин не будет работать
new szMapname[32];
get_mapname(szMapname, charsmax(szMapname));
for(new i; i < sizeof szDisableMapTypes; i++)
if(equali(szMapname, szDisableMapTypes[i], strlen(szDisableMapTypes))) pause("ad");
}

public client_disconnect(id)
{
remove_hook(id)
}

public client_putinserver(id)
{
remove_hook(id)
}

public hook_on(id,level,cid)
{

if(get_user_flags(id) & ADMIN_LEVEL_H) // Флаг доступа для паутинки.
{
if(!canusehook[id-1] && !cmd_access(id,level,cid,1))
{
return PLUGIN_HANDLED
}

if(blockhook[id]<10) //Ограничение
{
get_user_origin(id,hookorigin[id-1],3)

ishooked[id-1] = true
++blockhook
[id]emit_sound(id,CHAN_STATIC,"hook_wkolota/hook.wav",1.0,ATTN_NORM,0,PITCH_NORM)
set_task(0.1,"hook_task",id,"",0,"ab")
hook_task(id)
ChatColor(id,"^1[^4Паутинка^1] Вы использовали !g%d !yраз из !g10!", blockhook[id])
}else{
ChatColor(id,"^1[^4Паутинка^1] Вы истратили свой лимит в этом раунде.")
return PLUGIN_HANDLED
}
}else{
ChatColor(id,"^1[^4Паутинка^1] Доступно только для !gБосса, !yчтобы купить пиши в !teamСкайп: !g****")

return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}

public is_hooked(id)
{
return ishooked[id-1]
}

public hook_off(id)
{
if(get_user_flags(id) & ADMIN_LEVEL_H)
{
remove_hook(id)
}
else
{
return PLUGIN_HANDLED
}

return PLUGIN_HANDLED
}

public hook_task(id)
{
if(!is_user_connected(id) || !is_user_alive(id))
{
remove_hook(id)
}

remove_beam(id)
draw_hook(id)

new origin[3], Float:velocity[3]
get_user_origin(id,origin)
new distance = get_distance(hookorigin[id-1],origin)
if(distance > 25)
{
velocity[0] = (hookorigin[id-1][0] - origin[0]) * (2.0 * 300 / distance)
velocity[1] = (hookorigin[id-1][1] - origin[1]) * (2.0 * 300 / distance)
velocity[2] = (hookorigin[id-1][2] - origin[2]) * (2.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 draw_hook(id)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(1)                // TE_BEAMENTPOINT
write_short(id)                // entid
write_coord(hookorigin[id-1][0])    // origin
write_coord(hookorigin[id-1][1])    // origin
write_coord(hookorigin[id-1][2])    // origin
write_short(Sbeam)            // sprite index
write_byte(0)                // start frame
write_byte(0)                // framerate
write_byte(100)                // life
write_byte(41)                // ширина спрайта
write_byte(0)                // noise
if(get_user_team(id) == 1)
{
write_byte(192) //R //СЕРЫЙ ЦВЕТ (R, G, B )
write_byte(192) //G
write_byte(192) //B
}
else
{
write_byte(192) //R //СЕРЫЙ ЦВЕТ (R, G, B )
write_byte(192) //G
write_byte(192) //B
}
write_byte(250)                // brightness
write_byte(5)                // speed
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)
write_short(id)
message_end()
}

stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players)
write_byte(players);
write_string(msg);
message_end();
}
}
}
}


Код
[i]#include <amxmodx>
#include <cstrike>
#include <amxmisc>
#include <engine>
#include <fun>
#include <hamsandwich>
#include <colorchat>

#define HOOK_LEVEL ADMIN_LEVEL_G    // Уровен доступа

#define TRAIL_LIFE        10        // Жизнь полосы
#define TRAIL_WIDTH       10 // Ширина полосы
#define TRAIL_RED         255 // Цвет: Красный
#define TRAIL_GREEN       0    // Цвет: Зелёный
#define TRAIL_BLUE        0 // Цвет: Голубой
#define TRAIL_BRIGTHNESS  220 // Яркость

#define TRAIL_LIF        10         // Жизнь полосы
#define TRAIL_WIDT       10 // Ширина полосы
#define TRAIL_RE         0 // Цвет: Красный
#define TRAIL_GREE       0     // Цвет: Зелёный
#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 Tsprite, STsprite, sprstandart
new Fade, FadeRandom, fadeR, fadeG, fadeB
new model_gibs, gTrail
new HookSpeed

public plugin_init() {
register_plugin("MG Hook","2.0","LLInH9rA, Remake Nickron")

register_clcmd("+hook","hook_on",HOOK_LEVEL)
register_clcmd("-hook","hook_off",HOOK_LEVEL)
register_clcmd("say /hook","Menu_hook",HOOK_LEVEL)
register_clcmd("amx_menuhook","Menu_hook",HOOK_LEVEL)
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" ) // Цвет свечения(синий)
sprstandart = register_cvar( "hook_sprite_new", "1" ) // Новый или старый спрайт хука (По умолчанию новый)
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() {
precache_sound("MG_hook/mg_hook.wav") // Загрузка звука
precache_sound("MG_hook/mg_item.wav") // Загрузка звука меню
precache_sound("MG_hook/mg_menu.wav") // Загрузка звука меню вещей

Tsprite = precache_model("sprites/MG_hook/hook_ALL.spr") // Загрузка спрайта паутины
STsprite = precache_model("sprites/laserbeam.spr") // Загрузка стандартного спрайта
gTrail          =   precache_model("sprites/MG_hook/speed.spr") // Загрузка спрайта полосы
model_gibs      =   precache_model("sprites/knife_v2/watergun.spr") // Загрузка модели земли

}

// ================================================================================
=================

public Menu_hook(id)
{
if(get_user_flags(id) & ADMIN_LEVEL_H || get_user_flags(id) & ADMIN_KICK)
client_cmd(id, "spk MG_hook/mg_menu.wav")
{
new menu = menu_create("\rMG Hook: \yМеню смотрящего ^n\dRemake Nickron ^n\d˙·٠●• •●٠·˙","menu_hook")

menu_additem(menu,"Взять \r[Комплект Гранат] \yツ", "1", 0)
menu_additem(menu,"Взять \r [AWP]\yツ", "2", 0)
menu_additem(menu,"Взять \r[Прыжок] \yツ", "3", 0)
menu_additem(menu,"Подарить \r[Жизни] \yツ", "4", 0)

menu_setprop(menu , MPROP_NEXTNAME, "Далее")
menu_setprop(menu , MPROP_BACKNAME, "Назад")
menu_setprop(menu , MPROP_EXITNAME, "\rВыход")
menu_setprop(menu , MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu)
}
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:
{
{
client_cmd(id, "spk MG_hook/mg_item.wav")
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_smokegrenade")
give_item(id, "weapon_flashbang")
ColorChat(id,BLUE,"^3[MG Hook] ^4Вы взяли комплект гранат: ^3HE, Flash, Smoke")
}
}
case 2:
{
{
client_cmd(id, "spk MG_hook/mg_item.wav")
give_item(id, "weapon_awp")
ColorChat(id,BLUE,"^3[MG Hook] ^4Вы взяли: ^3AWP - 10")
}
}
case 3:
{
{
client_cmd(id, "spk MG_hook/mg_item.wav")
set_user_gravity(id,0.3)
ColorChat(id,BLUE,"^3[MG Hook] ^4Наш форум: ^3Magick-Mod.RU")
}
}
case 4:
{
{
HEALTHMenu(id)
}
}
}
return PLUGIN_HANDLED
}

// ================================================================================
=================

public HEALTHMenu(id)
{
if(get_user_flags(id) & ADMIN_LEVEL_H)
{
new menu = menu_create( "\rМеню Жизней", "menu_health" )
new players[32], pnum, tempid
new szName[32], szTempid[10]
cs_get_user_team(id)

get_players(players, pnum)

for(new i; i<pnum; i++)
{
cs_get_user_team(players)

tempid = players

if(!is_user_alive(tempid))
{
}
else if(get_user_health(tempid) < 250)
{
get_user_name(tempid, szName, 31)
num_to_str(tempid, szTempid, 9)

menu_additem(menu, szName, szTempid, 0)
}
}

menu_display(id, menu, 0)
}
return PLUGIN_HANDLED
}

public menu_health(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}

new data[6], iName[64], playername[33], playername2[33]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)

new tempid = str_to_num(data)
cs_get_user_team(tempid)

get_user_name(id, playername, 32)
get_user_name(tempid, playername2, 32)

set_user_health(tempid, 250)
client_cmd(id,"health_menu")
ColorChat(0,BLUE, "^3[MG Hook] ^4Смотрящий ^3%s ^4дал жизни ^3%s", playername, playername2)

menu_destroy(menu)
return PLUGIN_HANDLED
}

public client_disconnect(id) {
remove_hook(id)
}

public client_putinserver(id) {
remove_hook(id)
}

// ================================================================================
=================

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,"[MG Hook] Админ %s дал возможность возможность использовать hook",name)
client_print(i,print_chat,"[MG Hook] Забиндите '+hook' на кнопку")
}
else
client_print(i,print_chat,"[MG Hook] Админ %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,"[MG Hook] Админ %s дал возможность возможность использовать hook",name)
client_print(pid,print_chat,"[MG Hook] Забиндите '+hook' на кнопку")
}
else
client_print(pid,print_chat,"[MG Hook] Админ %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

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,"MG_hook/mg_hook.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,"[MG Hook] ^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)
draw_hook(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)  {
velocity[0] = (hookorigin[id-1][0] - origin[0]) * (2.0 * HSpeed / distance)
velocity[1] = (hookorigin[id-1][1] - origin[1]) * (2.0 * HSpeed / distance)
velocity[2] = (hookorigin[id-1][2] - origin[2]) * (2.0 * HSpeed / 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 draw_hook(id) {
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(1) // TE_BEAMENTPOINT
write_short(id) // entid
write_coord(hookorigin[id-1][0]) // origin
write_coord(hookorigin[id-1][1]) // origin
write_coord(hookorigin[id-1][2]) // origin
if( get_pcvar_num( sprstandart ) ) // sprite index
{
if(get_user_team(id) == 1) {
write_short( Tsprite )
}
else
{
write_short( Tsprite )
}
}
else
{
write_short( STsprite )
}
write_byte( 0 ) // start frame
write_byte( 0 ) // framerate
write_byte( 100 ) // life
write_byte( 20 ) // width
write_byte( 0 ) // noise
if( get_pcvar_num( sprstandart ) )
{
if(get_user_team(id) == 1) { // Террористы
write_byte( 255 ) // красный
write_byte( 255 ) // зеленый
write_byte( 255 ) // синий
}
else
{ // Контры
write_byte( 255 ) // красный
write_byte( 255 ) // зеленый
write_byte( 255 ) // синий
}
}
else
{
if(get_user_team(id) == 1) { // Террористы
write_byte( 255 ) // красный
write_byte( 0 ) // зеленый
write_byte( 0 ) // синий
}
else
{ // Контры
write_byte( 0 ) // красный
write_byte( 0 ) // зеленый
write_byte( 255 ) // синий
}
}
write_byte( 150 ) // brightness
write_byte(0) // Скорость
message_end()
}

// ================================================================================
=================

public func_break(id)
{
new origin[3]

get_user_origin(id, origin, 3)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPRITE)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_short(model_gibs)
write_byte(13)
write_byte(255)
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()
}


Сообщение отредактировал formen - Пятница, 21.08.2015, 13:41
 
NaSok
Дата: Четверг, 20.08.2015, 12:48 | Сообщение # 2
офлайн

  • Сообщения: 80
  • Награды: 1
  • Замечания:
 
Код в тэг:

Код
Код



 
  • Страница 1 из 1
  • 1
Поиск: