Скриптер
Проверенный
Пользователь
- Сообщения
- 3,593
- Реакции
- 1,576
- Помог
- 141 раз(а)
Воот, я думал так сделать.. но как правильно натив туда запихнуть :/BiZaJe, зачем? просто натив прокинуть на джетпак, и в ножах при уроне чекать, активен ли джетпак.
Нигде не видел плагин с 5 слотом или просто другим слотом(отдельно)Nordic Warrior, можно и так, но опять же костыль получается
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <engine>
#include <zp_level_system>
#define JETPACK_COST 30
#define LVL_COUNT 5
native zp_get_user_zombie(id)
native zp_register_extra_item(const name[], cost, teams)
new const ClassInfoTarget[] = "info_target"
new const ClassBreakAble[] = "func_breakable"
new const ClassnameJetPack[] = "n4d_jetpack"
new const ClassnameRocket[] = "n4d_bazooka"
new const ModelVJetPack[] = "models/mu/v_jp_mu.mdl"
new const ModelPJetPack[] = "models/mu/p_jp_mu.mdl"
new const ModelWJetPack[] = "models/mu/w_jp_mu.mdl"
new const ModelRocket[] = "models/rpgrocket.mdl"
new const SoundPickup[] = "items/gunpickup2.wav"
new const SoundShoot[] = "mu/at4-1.wav"
new const SoundTravel[] = "mu/bfuu.wav"
new const SoundFly[] = "mu/fly.wav"
new const SoundBlow[] = "mu/blow.wav"
new bool:bHasJetPack[33]
new Float:fJetpackFuel[33]
new Float:fLastShoot[33]
new SprExp, SprTrail, ItemJetPack, MsgSayText
new CvarMaxFuel, CvarRadius, CvarDamage, CvarSpeed, CvarCooldown, CvarRegen, CvarRocketSpeed
new Float:CMaxFuel, Float:CRadius, Float:CDamage, CSpeed, Float:CCooldown, Float:CRegen, CRocketSpeed
#define ZP_TEAM_HUMAN (1<<1)
#define ZP_PLUGIN_HANDLED 97
//Uncomment this to draw ring effect
#define DrawRing
//Uncomment this to draw flame effect
#define DrawFlame
#if defined DrawRing
new SprRing
#endif
#if defined DrawFlame
new SprFlame
#endif
public plugin_precache()
{
precache_sound(SoundPickup)
precache_sound(SoundShoot)
precache_sound(SoundTravel)
precache_sound(SoundFly)
precache_sound(SoundBlow)
SprExp = precache_model("sprites/zerogxplode.spr")
SprTrail = precache_model("sprites/smoke.spr")
#if defined DrawFlame
SprFlame = precache_model("sprites/xfireball3.spr")
#endif
#if defined DrawRing
SprRing = precache_model("sprites/shockwave.spr")
#endif
precache_model(ModelVJetPack)
precache_model(ModelPJetPack)
precache_model(ModelWJetPack)
precache_model(ModelRocket)
}
public plugin_init()
{
register_plugin("New Jetpack", "0.0.3", "Bad_Bud,ZmOutStanding,Connor,wbyokomo")
register_event("HLTV", "OnNewRound", "a", "1=0", "2=0")
register_logevent("OnRoundEnd", 2, "1=Round_End")
RegisterHam(Ham_Killed, "player", "OnPlayerKilled")
RegisterHam(Ham_Player_Jump, "player", "OnPlayerJump")
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "OnKnifeSecAtkPost", 1)
RegisterHam(Ham_Item_Deploy, "weapon_knife", "OnKnifeDeployPost", 1)
register_forward(FM_PlayerPreThink, "OnPlayerPreThink")
register_touch(ClassnameRocket, "*", "OnTouchRocket")
register_touch(ClassnameJetPack, "player", "OnTouchJetPack")
register_think(ClassnameJetPack, "OnThinkJetPack")
CvarMaxFuel = register_cvar("jp_maxfuel", "350.0")
CvarRadius = register_cvar("jp_radius", "300.0")
CvarDamage = register_cvar("jp_damage", "1200.0")
CvarSpeed = register_cvar("jp_speed", "450")
CvarCooldown = register_cvar("jp_cooldown", "15.0")
CvarRegen = register_cvar("jp_regen", "0.5")
CvarRocketSpeed = register_cvar("jp_rocket_speed", "1500")
MsgSayText = get_user_msgid("SayText")
ItemJetPack = zp_register_extra_item("Jetpack", JETPACK_COST, ZP_TEAM_HUMAN)
register_clcmd("drop", "CmdDropJP")
}
public client_putinserver(id)
{
ResetValues(id)
}
public client_disconnect(id)
{
ResetValues(id)
}
public OnNewRound()
{
RemoveAllJetPack()
CMaxFuel = get_pcvar_float(CvarMaxFuel)
CRadius = get_pcvar_float(CvarRadius)
CDamage = get_pcvar_float(CvarDamage)
CSpeed = get_pcvar_num(CvarSpeed)
CCooldown = get_pcvar_float(CvarCooldown)
CRegen = get_pcvar_float(CvarRegen)
CRocketSpeed = get_pcvar_num(CvarRocketSpeed)
}
public OnRoundEnd()
{
RemoveAllJetPack()
}
public OnPlayerKilled(id)
{
if(bHasJetPack[id]) DropJetPack(id);
ResetValues(id)
}
public OnPlayerJump(id)
{
if(bHasJetPack[id] && fJetpackFuel[id] > 0.0 && get_user_weapon(id) == CSW_KNIFE && pev(id, pev_button) & IN_DUCK && ~pev(id, pev_flags) & FL_ONGROUND)
{
static Float:vVelocity[3], Float:upSpeed
pev(id, pev_velocity, vVelocity)
upSpeed = vVelocity[2] + 35.0
velocity_by_aim(id, CSpeed, vVelocity)
vVelocity[2] = upSpeed > 300.0 ? 300.0 : upSpeed
set_pev(id, pev_velocity, vVelocity)
#if defined DrawFlame
pev(id, pev_origin, vVelocity)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vVelocity, 0)
write_byte(TE_SPRITE)
engfunc(EngFunc_WriteCoord, vVelocity[0])
engfunc(EngFunc_WriteCoord, vVelocity[1])
engfunc(EngFunc_WriteCoord, vVelocity[2])
write_short(SprFlame)
write_byte(8)
write_byte(128)
message_end()
#endif
fJetpackFuel[id] > 80.0 ? emit_sound(id, CHAN_STREAM, SoundFly, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) : emit_sound(id, CHAN_STREAM, SoundBlow, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
fJetpackFuel[id] -= 1.0
}
}
public zp_user_infected_pre(id)
{
if(bHasJetPack[id]) DropJetPack(id);
ResetValues(id)
}
public zp_extra_item_selected(id, item)
{
if(item == ItemJetPack)
{
if(zp_level(id) >= LVL_COUNT)
{
if(bHasJetPack[id])
{
zp_colored_print(id, "^x01[^x04ZP^x01] У вас уже есть Джет-Пак!")
return ZP_PLUGIN_HANDLED;
}
bHasJetPack[id] = true
zp_colored_print(id, "^x01[^x04ZP^x01] Джет-Пак:^x04 JUMP + DUCK ^x01f^x04^x01")
engclient_cmd(id, "weapon_knife")
}
else
{
zp_colored_print(id, "^x01[^x04ZP^x01] Вы не достигли ^x04%d ^x01уровня!", LVL_COUNT)
return ZP_PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE;
}
public give_jetpack(id)
{
if(bHasJetPack[id])
{
zp_colored_print(id, "^x01[^x04ZP^x01] У вас уже есть Джет-Пак!")
return ZP_PLUGIN_HANDLED;
}
bHasJetPack[id] = true
zp_colored_print(id, "^x01[^x04ZP^x01] Джет-Пак:^x04 JUMP + DUCK ^x01f^x04^x01")
engclient_cmd(id, "weapon_knife")
ReplaceModel(id)
return PLUGIN_CONTINUE;
}
public is_jetpack(id) {
if (!is_user_connected(id))
return -1;
return bHasJetPack[id];
}
public plugin_natives()
{
register_native("give_weapon_jetpack", "give_jetpack", 1);
register_native("is_weapon_jetpack", "is_jetpack", 1);
}
public OnKnifeSecAtkPost(ent2)
{
if(pev_valid(ent2) == 2)
{
static id, Float:ctime
id = get_pdata_cbase(ent2, 41, 4)
ctime = get_gametime()
if(is_user_alive(id) && bHasJetPack[id] && fLastShoot[id] < ctime)
{
new ent = create_entity(ClassInfoTarget)
if(ent)
{
engfunc(EngFunc_SetModel, ent, ModelRocket)
engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0})
new Float:fOrigin[3]
pev(id, pev_origin, fOrigin)
fOrigin[2] += 16.0
engfunc(EngFunc_SetOrigin, ent, fOrigin)
set_pev(ent, pev_classname, ClassnameRocket)
set_pev(ent, pev_dmg, 100.0)
set_pev(ent, pev_owner, id)
velocity_by_aim(id, CRocketSpeed, fOrigin)
set_pev(ent, pev_velocity, fOrigin)
new Float:vecAngles[3]
engfunc(EngFunc_VecToAngles, fOrigin, vecAngles)
set_pev(ent, pev_angles, vecAngles)
set_pev(ent, pev_movetype, MOVETYPE_FLY)
set_pev(ent, pev_solid, SOLID_BBOX)
emit_sound(id, CHAN_STATIC, SoundShoot, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(ent, CHAN_WEAPON, SoundTravel, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW)
write_short(ent)
write_short(SprTrail)
write_byte(40)
write_byte(5)
write_byte(224)
write_byte(224)
write_byte(255)
write_byte(192)
message_end()
fLastShoot[id] = ctime + CCooldown
}
else
{
fLastShoot[id] = ctime+1.5
}
}
}
}
public OnKnifeDeployPost(ent)
{
if(pev_valid(ent) == 2)
{
static id; id = get_pdata_cbase(ent, 41, 4)
if(is_user_alive(id) && bHasJetPack[id]) ReplaceModel(id);
}
}
public OnPlayerPreThink(id)
{
if(bHasJetPack[id] && fJetpackFuel[id] < CMaxFuel)
{
static button; button = pev(id, pev_button)
if(!(button & IN_DUCK) && !(button & IN_JUMP)) fJetpackFuel[id] += CRegen;
}
}
public OnTouchRocket(ent, id)
{
static Float:fOrigin[3]
pev(ent, pev_origin, fOrigin)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fOrigin, 0)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, fOrigin[0])
engfunc(EngFunc_WriteCoord, fOrigin[1])
engfunc(EngFunc_WriteCoord, fOrigin[2])
write_short(SprExp)
write_byte(40)
write_byte(30)
write_byte(10)
message_end()
#if defined DrawRing
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fOrigin, 0)
write_byte(TE_BEAMCYLINDER)
engfunc(EngFunc_WriteCoord, fOrigin[0])
engfunc(EngFunc_WriteCoord, fOrigin[1])
engfunc(EngFunc_WriteCoord, fOrigin[2])
engfunc(EngFunc_WriteCoord, fOrigin[0])
engfunc(EngFunc_WriteCoord, fOrigin[1])
engfunc(EngFunc_WriteCoord, fOrigin[2]+555.0)
write_short(SprRing)
write_byte(0)
write_byte(1)
write_byte(6)
write_byte(8)
write_byte(10)
write_byte(224)
write_byte(224)
write_byte(255)
write_byte(192)
write_byte(5)
message_end()
#endif
static attacker; attacker = pev(ent, pev_owner)
if(!is_user_connected(attacker))
{
engfunc(EngFunc_RemoveEntity, ent)
return PLUGIN_CONTINUE;
}
if(pev_valid(id) && !is_user_connected(id))
{
static szClassname[32]
pev(id, pev_classname, szClassname, 31)
if(equal(szClassname, ClassBreakAble) && (pev(id, pev_solid) != SOLID_NOT))
{
dllfunc(DLLFunc_Use, id, ent)
}
}
static victim; victim = -1
while((victim = engfunc(EngFunc_FindEntityInSphere, victim, fOrigin, CRadius)) != 0)
{
if(is_user_alive(victim) && zp_get_user_zombie(victim))
{
static Float:originV[3], Float:dist, Float:damage
pev(victim, pev_origin, originV)
dist = get_distance_f(fOrigin, originV)
damage = CDamage-(CDamage/CRadius)*dist
if(damage > 0.0)
{
ExecuteHamB(Ham_TakeDamage, victim, ent, attacker, damage, DMG_BULLET)
//client_print(attacker, print_chat, "[Jp] Rocket damage: %.1f", damage)
}
}
}
engfunc(EngFunc_RemoveEntity, ent)
return PLUGIN_CONTINUE;
}
public OnTouchJetPack(ent, id)
{
if((pev(ent, pev_iuser4) != 11111) && is_user_alive(id) && !zp_get_user_zombie(id) && !bHasJetPack[id])
{
engfunc(EngFunc_RemoveEntity, ent)
bHasJetPack[id] = true
emit_sound(id, CHAN_STATIC, SoundPickup, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
engclient_cmd(id,"weapon_knife")
ReplaceModel(id)
}
}
public OnThinkJetPack(ent)
{
if(pev_valid(ent) == 2)
{
switch(pev(ent, pev_flTimeStepSound))
{
case 200:
{
set_pev(ent, pev_iuser4, 22222)
set_pev(ent, pev_flTimeStepSound, 201)
}
case 201:
{
engfunc(EngFunc_RemoveEntity, ent)
}
}
}
}
public CmdDropJP(id)
{
if(is_user_alive(id) && bHasJetPack[id] && get_user_weapon(id) == CSW_KNIFE)
{
DropJetPack(id)
bHasJetPack[id] = false
set_pev(id, pev_viewmodel2, "models/v_knife.mdl")
set_pev(id, pev_weaponmodel2, "models/p_knife.mdl")
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
ReplaceModel(id)
{
set_pev(id, pev_viewmodel2, ModelVJetPack)
set_pev(id, pev_weaponmodel2, ModelPJetPack)
}
DropJetPack(id)
{
new ent = create_entity(ClassInfoTarget)
if(!ent) return;
engfunc(EngFunc_SetModel, ent, ModelWJetPack)
engfunc(EngFunc_SetSize, ent, Float:{-8.0, -8.0, -8.0}, Float:{8.0, 8.0, 8.0})
new Float:fOrigin[3]
pev(id, pev_origin, fOrigin)
fOrigin[2] += 16.0
engfunc(EngFunc_SetOrigin, ent, fOrigin)
set_pev(ent, pev_classname, ClassnameJetPack)
velocity_by_aim(id, 800, fOrigin) //if it too far then reduce it
set_pev(ent, pev_velocity, fOrigin)
set_pev(ent, pev_movetype, MOVETYPE_TOSS)
set_pev(ent, pev_iuser4, 11111)
set_pev(ent, pev_solid, SOLID_TRIGGER)
set_pev(ent, pev_flTimeStepSound, 200)
set_pev(ent, pev_nextthink, get_gametime()+2.0) // prevent drop/pickup exploit
}
RemoveAllJetPack()
{
new ent = engfunc(EngFunc_FindEntityByString, -1, "classname", ClassnameJetPack)
while(ent > 0)
{
engfunc(EngFunc_RemoveEntity, ent)
ent = engfunc(EngFunc_FindEntityByString, -1, "classname", ClassnameJetPack)
}
}
ResetValues(id)
{
bHasJetPack[id] = false
fJetpackFuel[id] = CMaxFuel
}
zp_colored_print(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()
if (!target)
{
static iPlayers[32], iNum, j, player
get_players(iPlayers, iNum, "ch")
for (j = 0; j < iNum; j++)
{
player = iPlayers[j]
static changed[5], changedcount
changedcount = 0
for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()
for (i = 0; i < changedcount; i++) setarg(changed[i], 0, LANG_PLAYER);
}
}
else
{
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE, MsgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#define PLUGIN "[ZP] Addon: Knifes"
#define VERSION "1.1"
#define AUTHOR "Mr.TheFold, redacted by _RedGamer_"
native is_weapon_jetpack(id)
#define VIP ADMIN_LEVEL_H
#define SUPER_VIP ADMIN_LEVEL_F
#define OWNER ADMIN_LEVEL_G
#define CREATOR ADMIN_MENU
// Поджог
#define TASK_FBURN 100
#define ID_FBURN ( taskid - TASK_FBURN )
#define FIRE_DURATION 6
#define FIRE_DAMAGE 25
// Отравление
#define TASK_POISBURN 100
#define ID_POISBURN ( taskid - TASK_POISBURN )
#define POISON_DURATION 12
#define POISON_DAMAGE 50
// Максимальное количество игроков
#define MAX_CLIENTS 32
const Float:TIME_FREEZE = 5.0
const Float:TIME_WAIT_FREEZE = 10.0
// OFFSETS
#define m_pPlayer 41
#define m_iId 43
#define m_Weapon_flNextSecondaryAttack 47
#define m_Weapon_flTimeWeaponIdle 48
#define m_Weapon_iWeaponState 74
#define m_pActiveItem 373
#define m_flNextAttack 83
#define m_flTimeWeaponIdle 48
#define PDATA_SAFE 2
#define linux_diff_weapon 4
#define linux_diff_player 5
// Number Animation Stab
const WeaponAnim_Stab = 4; // Stab animation
// Value Hammers
const Float: WeaponAnim_Stab_Time = 0.826; // Stab animation time
const Float: WeaponSecondaryAttackDelay = 0.5; // After this time, we did secondary attack
// Value DemonSword
const Float: Weapon_AnimSword_Stab_Time = 1.63; // Stab Demon Sword animation time
const Float: WeaponSwordSecondaryAttackDelay = 0.633; // After this time, we did secondary attack
new HamHook: gl_HamHook_SendWeaponAnim_Pre;
new KNIFE1_V_MODEL[] = "models/CSO_Knifes/v_strong.mdl"
new KNIFE1_P_MODEL[] = "models/CSO_Knifes/p_strong.mdl"
new KNIFE2_V_MODEL[] = "models/CSO_Knifes/v_katana.mdl"
new KNIFE2_P_MODEL[] = "models/CSO_Knifes/p_katana.mdl"
new KNIFE3_V_MODEL[] = "models/CSO_Knifes/v_combat.mdl"
new KNIFE3_P_MODEL[] = "models/CSO_Knifes/p_combat.mdl"
new KNIFE4_V_MODEL[] = "models/CSO_Knifes/v_hammer_fire.mdl"
new KNIFE4_P_MODEL[] = "models/CSO_Knifes/p_hammer_fire.mdl"
new KNIFE5_V_MODEL[] = "models/CSO_Knifes/v_hammer_ice.mdl"
new KNIFE5_P_MODEL[] = "models/CSO_Knifes/p_hammer_ice.mdl"
new KNIFE6_V_MODEL[] = "models/CSO_Knifes/v_hammer_poison.mdl"
new KNIFE6_P_MODEL[] = "models/CSO_Knifes/p_hammer_poison.mdl"
new KNIFE7_V_MODEL[] = "models/CSO_Knifes/v_demonsword.mdl"
new KNIFE7_P_MODEL[] = "models/CSO_Knifes/p_demonsword.mdl"
new const g_SpriteGlasses[] = "models/glassgibs.mdl"
new bool:g_has_strong[33]
new bool:g_has_katana[33]
new bool:g_has_combat[33]
new bool:g_has_hammer_fire[33]
new bool:g_has_hammer_ice[33]
new bool:g_has_hammer_poison[33]
new bool:g_has_demonsword[33]
new bool:g_fRoundEnd
new g_flameSpr, g_smokeSpr, g_burning_duration[ MAX_CLIENTS + 1 ]
new g_freeze_wait[33]
new g_poisonSpr, g_poisoning_duration[ MAX_CLIENTS + 1 ]
new g_antidote_wait[33]
new g_frozen[33], g_SpriteGlass
new g_knife_menu, g_vip_knife_menu, g_supervip_knife_menu, g_owner_knife_menu, g_creator_knife_menu
new cvar_knock_strong, cvar_jump_strong, cvar_speed_strong, cvar_damage_strong
new cvar_knock_katana, cvar_jump_katana, cvar_speed_katana, cvar_damage_katana
new cvar_knock_combat, cvar_jump_combat, cvar_speed_combat, cvar_damage_combat
new cvar_knock_hammer_fire, cvar_jump_hammer_fire, cvar_speed_hammer_fire, cvar_damage_hammer_fire
new cvar_knock_hammer_ice, cvar_jump_hammer_ice, cvar_speed_hammer_ice, cvar_damage_hammer_ice
new cvar_knock_hammer_poison, cvar_jump_hammer_poison, cvar_speed_hammer_poison, cvar_damage_hammer_poison
new cvar_knock_demonsword, cvar_jump_demonsword, cvar_speed_demonsword, cvar_damage_demonsword
new const g_sound_knife[] = { "items/gunpickup2.wav" }
/*
new const old_sounds[][] =
{
"weapons/knife_deploy1.wav",
"weapons/knife_hit1.wav",
"weapons/knife_hitwall1.wav",
"weapons/knife_slash1.wav",
"weapons/knife_slash2.wav",
"weapons/knife_stab.wav"
}
*/
new const strong_sounds[][] =
{
"CSO_Knifes/strong_draw.wav",
"CSO_Knifes/strong_hit_01.wav",
"CSO_Knifes/strong_hit_02.wav",
"CSO_Knifes/strong_hit_wall.wav",
"CSO_Knifes/strong_miss.wav",
"CSO_Knifes/strong_stab.wav"
}
new const katana_sounds[][] =
{
"CSO_Knifes/katana_draw.wav",
"CSO_Knifes/katana_hit_01.wav",
"CSO_Knifes/katana_hit_02.wav",
"CSO_Knifes/katana_hit_wall.wav",
"CSO_Knifes/katana_miss.wav",
"CSO_Knifes/katana_stab.wav"
}
new const combat_sounds[][] =
{
"CSO_Knifes/combat_draw.wav",
"CSO_Knifes/combat_hit_01.wav",
"CSO_Knifes/combat_hit_02.wav",
"CSO_Knifes/combat_hit_wall.wav",
"CSO_Knifes/combat_miss.wav",
"CSO_Knifes/combat_stab.wav"
}
new const hammer_fire_sounds[][] =
{
"knife_zp/hammer_draw.wav",
"knife_zp/hammer_hit_01.wav",
"knife_zp/hammer_hit_02.wav",
"knife_zp/hammer_hit_wall.wav",
"knife_zp/hammer_miss.wav",
"knife_zp/hammer_stab.wav"
}
new const hammer_ice_sounds[][] =
{
"knife_zp/hammer_draw.wav",
"knife_zp/hammer_hit_01.wav",
"knife_zp/hammer_hit_02.wav",
"knife_zp/hammer_hit_wall.wav",
"knife_zp/hammer_miss.wav",
"knife_zp/hammer_stab.wav"
}
new const hammer_poison_sounds[][] =
{
"knife_zp/hammer_draw.wav",
"knife_zp/hammer_hit_01.wav",
"knife_zp/hammer_hit_02.wav",
"knife_zp/hammer_hit_wall.wav",
"knife_zp/hammer_miss.wav",
"knife_zp/hammer_stab.wav"
}
new const demonsword_sounds[][] =
{
"Skull/knife_draw_fix.wav",
"Skull/knife_hit_fix.wav",
"Skull/knife_hit_02_fix.wav",
"Skull/knife_wall_fix.wav",
"Skull/knife_slash_fix.wav",
"Skull/knife_stab_fix.wav"
}
public plugin_init()
{
register_plugin(PLUGIN , VERSION , AUTHOR);
register_cvar("zp_addon_knife", VERSION, FCVAR_SERVER);
g_knife_menu = menu_create("Выбор ножа","menu_handle")
g_vip_knife_menu = menu_create("Выбор ножа","menu_handle_vip")
g_supervip_knife_menu = menu_create("Выбор ножа", "menu_handle_supervip")
g_owner_knife_menu = menu_create("Выбор ножа", "menu_handle_owner")
g_creator_knife_menu = menu_create("Выбор ножа", "menu_handle_creator")
register_clcmd("/knife","knifemenu",ADMIN_ALL,"knife_menu")
build_menu()
build_menu_vip()
build_menu_supervip()
build_menu_owner()
build_menu_creator()
register_event("CurWeapon","checkWeapon","be","1=1");
register_forward(FM_EmitSound, "CEntity__EmitSound");
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink");
register_forward(FM_UpdateClientData, "FM_Hook_UpdateClientData_Post", true);
RegisterHam(Ham_Item_Holster, "weapon_knife", "Ham_CKnife__Deploy_Post", true);
RegisterHam(Ham_Item_PostFrame, "weapon_knife", "Ham_CKnife__PostFrame_Pre", false);
RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "Ham_CKnife__SecondaryAttack_Pre", false);
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
RegisterHam(Ham_Use, "func_tank", "fw_UseStationary_Post", 1)
RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary_Post", 1)
RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary_Post", 1)
RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary_Post", 1)
DisableHamForward(gl_HamHook_SendWeaponAnim_Pre = RegisterHam(Ham_CS_Weapon_SendWeaponAnim, "weapon_knife", "Ham_CKnife__SendWeaponAnim_Pre", false))
register_message(get_user_msgid("DeathMsg"), "message_DeathMsg");
register_clcmd("zm_knife_katana", "clcmd_knife")
register_clcmd("zm_knife_combat", "clcmd_knife")
register_clcmd("zm_knife_strong", "clcmd_knife")
register_clcmd("zm_knife_hammer_fire", "clcmd_knife")
register_clcmd("zm_knife_hammer_ice", "clcmd_knife")
register_clcmd("zm_knife_hammer_poison", "clcmd_knife")
register_clcmd("zm_knife_demonsword", "clcmd_knife")
cvar_jump_strong = register_cvar("zp_strong_jump", "340.0")
cvar_speed_strong = register_cvar("zp_strong_speed", "245.0")
cvar_damage_strong = register_cvar("zp_strong_damage", "5.2")
cvar_knock_strong = register_cvar("zp_strong_knockback", "3.2")
cvar_jump_katana = register_cvar("zp_katana_jump", "380.0")
cvar_speed_katana = register_cvar("zp_katana_speed", "245.0")
cvar_damage_katana = register_cvar("zp_katana_damage", "3.2")
cvar_knock_katana = register_cvar("zp_katana_knockback", "2.4")
cvar_jump_combat = register_cvar("zp_combat_jump", "350.0")
cvar_speed_combat = register_cvar("zp_combat_speed", "280.0")
cvar_damage_combat = register_cvar("zp_combat_damage", "3.2")
cvar_knock_combat = register_cvar("zp_combat_knockback", "2.6")
cvar_jump_hammer_fire = register_cvar("zp_hammer_fire_jump", "360.0")
cvar_speed_hammer_fire = register_cvar("zp_hammer_fire_speed", "280.0")
cvar_damage_hammer_fire = register_cvar("zp_hammer_fire_damage", "10.0")
cvar_knock_hammer_fire = register_cvar("zp_hammer_fire_knockback", "5.0")
cvar_jump_hammer_ice = register_cvar("zp_hammer_ice_jump", "380.0")
cvar_speed_hammer_ice = register_cvar("zp_hammer_ice_speed", "280.0")
cvar_damage_hammer_ice = register_cvar("zp_hammer_ice_damage", "12.5")
cvar_knock_hammer_ice = register_cvar("zp_hammer_ice_knockback", "5.0")
cvar_jump_hammer_poison = register_cvar("zp_hammer_poison_jump", "400.0")
cvar_speed_hammer_poison = register_cvar("zp_hammer_poison_speed", "280.0")
cvar_damage_hammer_poison = register_cvar("zp_hammer_poison_damage", "15")
cvar_knock_hammer_poison = register_cvar("zp_hammer_poison_knockback", "5.0")
cvar_jump_demonsword = register_cvar("zp_demonsword_jump", "420.0")
cvar_speed_demonsword = register_cvar("zp_demonsword_speed", "280.0")
cvar_damage_demonsword = register_cvar("zp_demonsword_damage", "17.5")
cvar_knock_demonsword = register_cvar("zp_demonsword_knockback", "5.0")
}
public client_connect(id)
{
g_has_strong[id] = true
g_has_katana[id] = false
g_has_combat[id] = false
g_has_hammer_fire[id] = false
g_has_hammer_ice[id] = false
g_has_hammer_poison[id] = false
g_has_demonsword[id] = false
}
public client_disconnect(id)
{
g_has_strong[id] = false
g_has_katana[id] = false
g_has_combat[id] = false
g_has_hammer_fire[id] = false
g_has_hammer_ice[id] = false
g_has_hammer_poison[id] = false
g_has_demonsword[id] = false
}
public plugin_precache()
{
// Flame Sprites
g_flameSpr = precache_model( "sprites/flame.spr" );
g_smokeSpr = precache_model( "sprites/black_smoke3.spr" );
// Poison Sprites
g_poisonSpr = precache_model( "sprites/flame_poison.spr" );
g_smokeSpr = precache_model( "sprites/black_smoke3.spr" );
// Freeze Glass
g_SpriteGlass = precache_model(g_SpriteGlasses);
// Precache Knife Models
precache_model(KNIFE1_V_MODEL)
precache_model(KNIFE1_P_MODEL)
precache_model(KNIFE2_V_MODEL)
precache_model(KNIFE2_P_MODEL)
precache_model(KNIFE3_V_MODEL)
precache_model(KNIFE3_P_MODEL)
precache_model(KNIFE4_V_MODEL)
precache_model(KNIFE4_P_MODEL)
precache_model(KNIFE5_V_MODEL)
precache_model(KNIFE5_P_MODEL)
precache_model(KNIFE6_V_MODEL)
precache_model(KNIFE6_P_MODEL)
precache_model(KNIFE7_V_MODEL)
precache_model(KNIFE7_P_MODEL)
precache_generic("sprites/zm_knife_katana.txt")
precache_generic("sprites/zm_knife_combat.txt")
precache_generic("sprites/zm_knife_strong.txt")
precache_generic("sprites/zm_knife_hammer_fire.txt")
precache_generic("sprites/zm_knife_hammer_ice.txt")
precache_generic("sprites/zm_knife_hammer_poison.txt")
precache_generic("sprites/zm_knife_demonsword.txt")
precache_generic("sprites/CSO_Knifes/640hud7.spr")
precache_generic("sprites/CSO_Knifes/640hud53.spr")
precache_generic("sprites/CSO_Knifes/640hud38.spr")
precache_generic("sprites/CSO_Knifes/640hud40.spr")
precache_generic("sprites/CSO_Knifes/640hud57.spr")
// Precache Knife Sounds
precache_sound(g_sound_knife)
for(new i = 0; i < sizeof strong_sounds; i++)
precache_sound(strong_sounds[i])
for(new i = 0; i < sizeof katana_sounds; i++)
precache_sound(katana_sounds[i])
for(new i = 0; i < sizeof combat_sounds; i++)
precache_sound(combat_sounds[i])
for(new i = 0; i < sizeof hammer_fire_sounds; i++)
precache_sound(hammer_fire_sounds[i])
for(new i = 0; i < sizeof hammer_ice_sounds; i++)
precache_sound(hammer_ice_sounds[i])
for(new i = 0; i < sizeof hammer_poison_sounds; i++)
precache_sound(hammer_poison_sounds[i])
for(new i = 0; i < sizeof demonsword_sounds; i++)
precache_sound(demonsword_sounds[i])
}
public clcmd_knife(id)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED;
engclient_cmd(id, "weapon_knife")
return PLUGIN_HANDLED;
}
build_menu()
{
menu_additem(g_knife_menu, "\y[Katana] \r[Прыжок]", "2")
menu_additem(g_knife_menu, "\y[Combat] \r[Скорость]", "3")
menu_additem(g_knife_menu, "\y[Strong] \r[Урон]", "1")
menu_additem(g_knife_menu, "\y[Hammer Fire] \r[VIP]", "4")
menu_additem(g_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5")
menu_additem(g_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6")
menu_additem(g_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7")
menu_setprop(g_knife_menu, MPROP_PERPAGE, 0)
}
build_menu_vip()
{
menu_additem(g_vip_knife_menu, "\y[Katana] \r[Прыжок]", "2")
menu_additem(g_vip_knife_menu, "\y[Combat] \r[Скорость]", "3")
menu_additem(g_vip_knife_menu, "\y[Strong] \r[Урон]", "1")
menu_additem(g_vip_knife_menu, "\y[Hammer Fire] \r[VIP]", "4")
menu_additem(g_vip_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5")
menu_additem(g_vip_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6")
menu_additem(g_vip_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7")
menu_setprop(g_vip_knife_menu, MPROP_PERPAGE, 0)
}
build_menu_supervip()
{
menu_additem(g_supervip_knife_menu, "\y[Katana] \r[Прыжок]", "2")
menu_additem(g_supervip_knife_menu, "\y[Combat] \r[Скорость]", "3")
menu_additem(g_supervip_knife_menu, "\y[Strong] \r[Урон]", "1")
menu_additem(g_supervip_knife_menu, "\y[Hammer Fire] \r[VIP]", "4")
menu_additem(g_supervip_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5")
menu_additem(g_supervip_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6")
menu_additem(g_supervip_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7")
menu_setprop(g_supervip_knife_menu, MPROP_PERPAGE, 0)
}
build_menu_owner()
{
menu_additem(g_owner_knife_menu, "\y[Katana] \r[Прыжок]", "2")
menu_additem(g_owner_knife_menu, "\y[Combat] \r[Скорость]", "3")
menu_additem(g_owner_knife_menu, "\y[Strong] \r[Урон]", "1")
menu_additem(g_owner_knife_menu, "\y[Hammer Fire] \r[VIP]", "4")
menu_additem(g_owner_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5")
menu_additem(g_owner_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6")
menu_additem(g_owner_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7")
menu_setprop(g_owner_knife_menu, MPROP_PERPAGE, 0)
}
build_menu_creator()
{
menu_additem(g_creator_knife_menu, "\y[Katana] \r[Прыжок]", "2")
menu_additem(g_creator_knife_menu, "\y[Combat] \r[Скорость]", "3")
menu_additem(g_creator_knife_menu, "\y[Strong] \r[Урон]", "1")
menu_additem(g_creator_knife_menu, "\y[Hammer Fire] \r[VIP]", "4")
menu_additem(g_creator_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5")
menu_additem(g_creator_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6")
menu_additem(g_creator_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7")
menu_setprop(g_creator_knife_menu, MPROP_PERPAGE, 0)
}
public knifemenu(id)
{
menu_display(id, !(get_user_flags(id) & VIP) ? g_knife_menu : g_vip_knife_menu, 0)
menu_display(id, !(get_user_flags(id) & SUPER_VIP) ? g_knife_menu : g_supervip_knife_menu, 0)
menu_display(id, !(get_user_flags(id) & OWNER) ? g_knife_menu : g_owner_knife_menu, 0)
menu_display(id, !(get_user_flags(id) & CREATOR) ? g_knife_menu : g_creator_knife_menu, 0)
return PLUGIN_HANDLED;
}
public menu_handle_vip(id, menu, item)
{
if(item < 0)
return PLUGIN_CONTINUE
new cmd[2];
new access, callback;
menu_item_getinfo(menu, item, access, cmd,2,_,_, callback);
new choice = str_to_num(cmd)
switch (choice)
{
case 1: buy_knife1(id)
case 2: buy_knife2(id)
case 3: buy_knife3(id)
case 4: buy_knife4(id)
case 5: buy_knife5(id)
case 6: buy_knife6(id)
case 7: buy_knife7(id)
}
return PLUGIN_HANDLED;
}
public menu_handle_supervip(id, menu, item)
{
if(item < 0)
return PLUGIN_CONTINUE
new cmd[2];
new access, callback;
menu_item_getinfo(menu, item, access, cmd,2,_,_, callback);
new choice = str_to_num(cmd)
switch (choice)
{
case 1: buy_knife1(id)
case 2: buy_knife2(id)
case 3: buy_knife3(id)
case 4: buy_knife4(id)
case 5: buy_knife5(id)
case 6: buy_knife6(id)
case 7: buy_knife7(id)
}
return PLUGIN_HANDLED;
}
public menu_handle_owner(id, menu, item)
{
if(item < 0)
return PLUGIN_CONTINUE
new cmd[2];
new access, callback;
menu_item_getinfo(menu, item, access, cmd,2,_,_, callback);
new choice = str_to_num(cmd)
switch (choice)
{
case 1: buy_knife1(id)
case 2: buy_knife2(id)
case 3: buy_knife3(id)
case 4: buy_knife4(id)
case 5: buy_knife5(id)
case 6: buy_knife6(id)
case 7: buy_knife7(id)
}
return PLUGIN_HANDLED;
}
public menu_handle_creator(id, menu, item)
{
if(item < 0)
return PLUGIN_CONTINUE
new cmd[2];
new access, callback;
menu_item_getinfo(menu, item, access, cmd,2,_,_, callback);
new choice = str_to_num(cmd)
switch (choice)
{
case 1: buy_knife1(id)
case 2: buy_knife2(id)
case 3: buy_knife3(id)
case 4: buy_knife4(id)
case 5: buy_knife5(id)
case 6: buy_knife6(id)
case 7: buy_knife7(id)
}
return PLUGIN_HANDLED;
}
public menu_handle(id, menu, item)
{
if(item < 0)
return PLUGIN_CONTINUE
new cmd[2];
new access, callback;
menu_item_getinfo(menu, item, access, cmd,2,_,_, callback);
new choice = str_to_num(cmd)
switch (choice)
{
case 1: buy_knife1(id)
case 2: buy_knife2(id)
case 3: buy_knife3(id)
case 4: buy_knife4(id)
case 5: buy_knife5(id)
case 6: buy_knife6(id)
case 7: buy_knife7(id)
}
return PLUGIN_HANDLED;
}
public buy_knife1(id)
{
g_has_strong[id] = true
g_has_katana[id] = false
g_has_combat[id] = false
g_has_hammer_fire[id] = false
g_has_hammer_ice[id] = false
g_has_hammer_poison[id] = false
g_has_demonsword[id] = false
set_sprite(id)
message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id)
write_byte(29)
message_end()
checkWeapon(id)
engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
return PLUGIN_HANDLED;
}
public buy_knife2(id)
{
g_has_strong[id] = false
g_has_katana[id] = true
g_has_combat[id] = false
g_has_hammer_fire[id] = false
g_has_hammer_ice[id] = false
g_has_hammer_poison[id] = false
g_has_demonsword[id] = false
set_sprite(id)
message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id)
write_byte(29)
message_end()
checkWeapon(id)
engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
return PLUGIN_HANDLED;
}
public buy_knife3(id)
{
g_has_strong[id] = false
g_has_katana[id] = false
g_has_combat[id] = true
g_has_hammer_fire[id] = false
g_has_hammer_ice[id] = false
g_has_hammer_poison[id] = false
g_has_demonsword[id] = false
set_sprite(id)
message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id)
write_byte(29)
message_end()
checkWeapon(id)
engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
return PLUGIN_HANDLED;
}
public buy_knife4(id)
{
if (get_user_flags(id) & VIP)
{
g_has_strong[id] = false
g_has_katana[id] = false
g_has_combat[id] = false
g_has_hammer_fire[id] = true
g_has_hammer_ice[id] = false
g_has_hammer_poison[id] = false
g_has_demonsword[id] = false
set_sprite(id)
message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id)
write_byte(29)
message_end()
checkWeapon(id)
engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else
{
knifemenu(id)
ChatColor(id, "!y[!gZP!y] !yНож !teamHammer Fire !yдоступен только для !gВипа!")
}
return PLUGIN_HANDLED;
}
public buy_knife5(id)
{
if (get_user_flags(id) & SUPER_VIP)
{
g_has_strong[id] = false
g_has_katana[id] = false
g_has_combat[id] = false
g_has_hammer_fire[id] = false
g_has_hammer_ice[id] = true
g_has_hammer_poison[id] = false
g_has_demonsword[id] = false
set_sprite(id)
message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id)
write_byte(29)
message_end()
checkWeapon(id)
engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else
{
knifemenu(id)
ChatColor(id, "!y[!gZP!y] !yНож !teamHammer Ice !yдоступен только для !gСупер Випа!")
}
return PLUGIN_HANDLED;
}
public buy_knife6(id)
{
if (get_user_flags(id) & OWNER)
{
g_has_strong[id] = false
g_has_katana[id] = false
g_has_combat[id] = false
g_has_hammer_fire[id] = false
g_has_hammer_ice[id] = false
g_has_hammer_poison[id] = true
g_has_demonsword[id] = false
set_sprite(id)
message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id)
write_byte(29)
message_end()
checkWeapon(id)
engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else
{
knifemenu(id)
ChatColor(id, "!y[!gZP!y] !yНож !teamHammer Poison !yдоступен только для !gВладельца!")
}
return PLUGIN_HANDLED;
}
public buy_knife7(id)
{
if (get_user_flags(id) & CREATOR)
{
g_has_strong[id] = false
g_has_katana[id] = false
g_has_combat[id] = false
g_has_hammer_fire[id] = false
g_has_hammer_ice[id] = false
g_has_hammer_poison[id] = false
g_has_demonsword[id] = true
set_sprite(id)
message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id)
write_byte(29)
message_end()
checkWeapon(id)
engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
else
{
knifemenu(id)
ChatColor(id, "!y[!gZP!y] !yНож !teamDemon Sword !yдоступен только для !gСоздателя!")
}
return PLUGIN_HANDLED;
}
public fw_UseStationary_Post(entity, caller, activator, use_type)
{
if (use_type == 0 && is_user_connected(caller))
checkWeapon(caller)
}
public zp_user_infected_post(id)
{
set_sprite(id)
}
public checkWeapon(id)
{
if(get_user_weapon(id) != CSW_KNIFE)
return;
if (g_has_strong[id] || g_has_katana[id] || g_has_combat[id] || g_has_hammer_fire[id] || g_has_hammer_ice[id] || g_has_hammer_poison[id] || g_has_demonsword[id])
{
checkModel(id)
}
return;
}
public checkModel(id)
{
if (zp_get_user_zombie(id))
{
set_sprite(id)
return;
}
if(get_user_weapon(id) != CSW_KNIFE)
return;
if (g_has_strong[id])
{
set_pev(id, pev_viewmodel2, KNIFE1_V_MODEL)
set_pev(id, pev_weaponmodel2, KNIFE1_P_MODEL)
}
else if (g_has_katana[id])
{
set_pev(id, pev_viewmodel2, KNIFE2_V_MODEL)
set_pev(id, pev_weaponmodel2, KNIFE2_P_MODEL)
}
else if (g_has_combat[id])
{
set_pev(id, pev_viewmodel2, KNIFE3_V_MODEL)
set_pev(id, pev_weaponmodel2, KNIFE3_P_MODEL)
}
else if (g_has_hammer_fire[id])
{
set_pev(id, pev_viewmodel2, KNIFE4_V_MODEL)
set_pev(id, pev_weaponmodel2, KNIFE4_P_MODEL)
}
else if (g_has_hammer_ice[id])
{
set_pev(id, pev_viewmodel2, KNIFE5_V_MODEL)
set_pev(id, pev_weaponmodel2, KNIFE5_P_MODEL)
}
else if (g_has_hammer_poison[id])
{
set_pev(id, pev_viewmodel2, KNIFE6_V_MODEL)
set_pev(id, pev_weaponmodel2, KNIFE6_P_MODEL)
}
else if (g_has_demonsword[id])
{
set_pev(id, pev_viewmodel2, KNIFE7_V_MODEL)
set_pev(id, pev_weaponmodel2, KNIFE7_P_MODEL)
}
set_sprite(id)
}
public CEntity__EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch)
{
if (!is_user_connected(id))
return HAM_IGNORED
if (zp_get_user_zombie(id))
return HAM_IGNORED
if (sample[8] == 'k' && sample[9] == 'n' && sample[10] == 'i')
{
if (sample[14] == 'd')
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[0], volume, attn, flags, pitch)
if(g_has_katana[id])
emit_sound(id, channel, katana_sounds[0], volume, attn, flags, pitch)
if(g_has_combat[id])
emit_sound(id, channel, combat_sounds[0], volume, attn, flags, pitch)
if(g_has_hammer_fire[id])
emit_sound(id, channel, hammer_fire_sounds[0], volume, attn, flags, pitch)
if(g_has_hammer_ice[id])
emit_sound(id, channel, hammer_ice_sounds[0], volume, attn, flags, pitch)
if(g_has_hammer_poison[id])
emit_sound(id, channel, hammer_poison_sounds[0], volume, attn, flags, pitch)
if(g_has_demonsword[id])
emit_sound(id, channel, demonsword_sounds[0], volume, attn, flags, pitch)
}
else if (sample[14] == 'h')
{
if (sample[17] == 'w')
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[3], volume, attn, flags, pitch)
if(g_has_katana[id])
emit_sound(id, channel, katana_sounds[3], volume, attn, flags, pitch)
if(g_has_combat[id])
emit_sound(id, channel, combat_sounds[3], volume, attn, flags, pitch)
if(g_has_hammer_fire[id])
emit_sound(id, channel, hammer_fire_sounds[3], volume, attn, flags, pitch)
if(g_has_hammer_ice[id])
emit_sound(id, channel, hammer_ice_sounds[3], volume, attn, flags, pitch)
if(g_has_hammer_poison[id])
emit_sound(id, channel, hammer_poison_sounds[3], volume, attn, flags, pitch)
if(g_has_demonsword[id])
emit_sound(id, channel, demonsword_sounds[3], volume, attn, flags, pitch)
}
else
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[random_num(1,2)], volume, attn, flags, pitch)
if(g_has_katana[id])
emit_sound(id, channel, katana_sounds[random_num(1,2)], volume, attn, flags, pitch)
if(g_has_combat[id])
emit_sound(id, channel, combat_sounds[random_num(1,2)], volume, attn, flags, pitch)
if(g_has_hammer_fire[id])
emit_sound(id, channel, hammer_fire_sounds[random_num(1,2)], volume, attn, flags, pitch)
if(g_has_hammer_ice[id])
emit_sound(id, channel, hammer_ice_sounds[random_num(1,2)], volume, attn, flags, pitch)
if(g_has_hammer_poison[id])
emit_sound(id, channel, hammer_poison_sounds[random_num(1,2)], volume, attn, flags, pitch)
if(g_has_demonsword[id])
emit_sound(id, channel, demonsword_sounds[random_num(1,2)], volume, attn, flags, pitch)
}
}
else
{
if (sample[15] == 'l')
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[4], volume, attn, flags, pitch)
if(g_has_katana[id])
emit_sound(id, channel, katana_sounds[4], volume, attn, flags, pitch)
if(g_has_combat[id])
emit_sound(id, channel, combat_sounds[4], volume, attn, flags, pitch)
if(g_has_hammer_fire[id])
emit_sound(id, channel, hammer_fire_sounds[4], volume, attn, flags, pitch)
if(g_has_hammer_ice[id])
emit_sound(id, channel, hammer_ice_sounds[4], volume, attn, flags, pitch)
if(g_has_hammer_poison[id])
emit_sound(id, channel, hammer_poison_sounds[4], volume, attn, flags, pitch)
if(g_has_demonsword[id])
emit_sound(id, channel, demonsword_sounds[4], volume, attn, flags, pitch)
}
else
{
if(g_has_strong[id])
emit_sound(id, channel, strong_sounds[5], volume, attn, flags, pitch)
if(g_has_katana[id] )
emit_sound(id, channel, katana_sounds[5], volume, attn, flags, pitch)
if(g_has_combat[id] )
emit_sound(id, channel, combat_sounds[5], volume, attn, flags, pitch)
if(g_has_hammer_fire[id])
emit_sound(id, channel, hammer_fire_sounds[5], volume, attn, flags, pitch)
if(g_has_hammer_ice[id])
emit_sound(id, channel, hammer_ice_sounds[5], volume, attn, flags, pitch)
if(g_has_hammer_poison[id])
emit_sound(id, channel, hammer_poison_sounds[5], volume, attn, flags, pitch)
if(g_has_demonsword[id])
emit_sound(id, channel, demonsword_sounds[5], volume, attn, flags, pitch)
}
}
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public FM_Hook_UpdateClientData_Post( const pPlayer, const iSendWeapons, const CD_Handle )
{
if ( !is_user_alive( pPlayer ) )
return;
if ( zp_get_user_zombie( pPlayer ) )
return;
static pActiveItem; pActiveItem = get_pdata_cbase( pPlayer, m_pActiveItem, linux_diff_player );
if ( pev_valid( pActiveItem ) != PDATA_SAFE || get_pdata_int( pActiveItem, m_iId, linux_diff_weapon ) != CSW_KNIFE )
return;
// свой нож чекай
if(!(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer] || g_has_demonsword[pPlayer]))
return;
set_cd( CD_Handle, CD_flNextAttack, 2.0 );
}
public Ham_CKnife__Deploy_Post( const pItem )
{
if ( pev_valid( pItem ) != PDATA_SAFE )
return;
new pPlayer = get_pdata_cbase( pItem, m_pPlayer, linux_diff_weapon );
if ( !is_user_alive( pPlayer ) )
return;
// check player on zombie, if has zombie => return HAM_IGNORED;
if(zp_get_user_zombie(pPlayer))
return;
// check knife, if not valid => return HAM_IGNORED;
if(!(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer] || g_has_demonsword[pPlayer]))
return;
set_pdata_int( pItem, m_Weapon_iWeaponState, false, linux_diff_weapon );
return;
}
public Ham_CKnife__PostFrame_Pre( const pItem )
{
if ( pev_valid( pItem ) != PDATA_SAFE )
return HAM_IGNORED;
static pPlayer; pPlayer = get_pdata_cbase( pItem, m_pPlayer, linux_diff_weapon );
// check player on zombie, if has zombie => return HAM_IGNORED;
if(zp_get_user_zombie(pPlayer))
return HAM_IGNORED
// check knife, if not valid => return HAM_IGNORED;
if(!(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer] || g_has_demonsword[pPlayer]))
return HAM_IGNORED
if ( get_pdata_int( pItem, m_Weapon_iWeaponState, linux_diff_weapon ) && get_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, linux_diff_weapon ) <= 0.0 )
{
// Call EmitSound forward only for block or change sound to custom
EnableHamForward( gl_HamHook_SendWeaponAnim_Pre );
ExecuteHam( Ham_Weapon_SecondaryAttack, pItem );
DisableHamForward( gl_HamHook_SendWeaponAnim_Pre );
if(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer])
{
set_pdata_int( pItem, m_Weapon_iWeaponState, false, linux_diff_weapon );
set_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, WeaponAnim_Stab_Time - WeaponSecondaryAttackDelay, linux_diff_weapon );
}
else if(g_has_demonsword[pPlayer])
{
set_pdata_int( pItem, m_Weapon_iWeaponState, false, linux_diff_weapon );
set_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, Weapon_AnimSword_Stab_Time - WeaponSwordSecondaryAttackDelay, linux_diff_weapon );
}
}
return HAM_IGNORED;
}
public Ham_CKnife__SecondaryAttack_Pre( const pItem )
{
if ( pev_valid( pItem ) != PDATA_SAFE )
return HAM_IGNORED;
new pPlayer = get_pdata_cbase( pItem, m_pPlayer, linux_diff_weapon );
if ( !is_user_alive( pPlayer ) )
return HAM_IGNORED;
//check player on zombie, if has zombie => return HAM_IGNORED;
if(zp_get_user_zombie(pPlayer))
return HAM_IGNORED
//check knife, if not valid => return HAM_IGNORED;
if(!(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer] || g_has_demonsword[pPlayer]))
return HAM_IGNORED
//We already in secondary attack delay
if ( get_pdata_int( pItem, m_Weapon_iWeaponState, linux_diff_weapon ) )
return HAM_SUPERCEDE;
UTIL_SendWeaponAnim( pPlayer, WeaponAnim_Stab );
if(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer])
{
set_pdata_int( pItem, m_Weapon_iWeaponState, true, linux_diff_weapon );
set_pdata_float( pItem, m_Weapon_flTimeWeaponIdle, WeaponAnim_Stab_Time, linux_diff_weapon );
set_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, WeaponSecondaryAttackDelay, linux_diff_weapon );
}
else if(g_has_demonsword[pPlayer])
{
set_pdata_int( pItem, m_Weapon_iWeaponState, true, linux_diff_weapon );
set_pdata_float( pItem, m_Weapon_flTimeWeaponIdle, Weapon_AnimSword_Stab_Time, linux_diff_weapon );
set_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, WeaponSwordSecondaryAttackDelay, linux_diff_weapon );
}
else return HAM_IGNORED;
return HAM_SUPERCEDE
}
public fw_PlayerPreThink(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id))
return FMRES_IGNORED
new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
if (weapon == CSW_KNIFE && g_has_strong[id])
{
set_user_maxspeed(id,get_pcvar_float(cvar_speed_strong))
if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
{
new flags = pev(id, pev_flags)
new waterlvl = pev(id, pev_waterlevel)
if (!(flags & FL_ONGROUND))
return FMRES_IGNORED
if (flags & FL_WATERJUMP)
return FMRES_IGNORED
if (waterlvl > 1)
return FMRES_IGNORED
new Float:fVelocity[3]
pev(id, pev_velocity, fVelocity)
fVelocity[2] += get_pcvar_num(cvar_jump_strong)
set_pev(id, pev_velocity, fVelocity)
set_pev(id, pev_gaitsequence, 6)
}
}
if(weapon == CSW_KNIFE && g_has_katana[id])
{
set_user_maxspeed(id,get_pcvar_float(cvar_speed_katana))
if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
{
new flags = pev(id, pev_flags)
new waterlvl = pev(id, pev_waterlevel)
if (!(flags & FL_ONGROUND))
return FMRES_IGNORED
if (flags & FL_WATERJUMP)
return FMRES_IGNORED
if (waterlvl > 1)
return FMRES_IGNORED
new Float:fVelocity[3]
pev(id, pev_velocity, fVelocity)
fVelocity[2] += get_pcvar_num(cvar_jump_katana)
set_pev(id, pev_velocity, fVelocity)
set_pev(id, pev_gaitsequence, 6)
}
}
if(weapon == CSW_KNIFE && g_has_combat[id])
{
if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
{
new flags = pev(id, pev_flags)
new waterlvl = pev(id, pev_waterlevel)
if (!(flags & FL_ONGROUND))
return FMRES_IGNORED
if (flags & FL_WATERJUMP)
return FMRES_IGNORED
if (waterlvl > 1)
return FMRES_IGNORED
new Float:fVelocity[3]
pev(id, pev_velocity, fVelocity)
fVelocity[2] += get_pcvar_num(cvar_jump_combat)
set_pev(id, pev_velocity, fVelocity)
set_pev(id, pev_gaitsequence, 6)
}
set_user_maxspeed(id,get_pcvar_float(cvar_speed_combat))
}
if (weapon == CSW_KNIFE && g_has_hammer_fire[id])
{
if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
{
new flags = pev(id, pev_flags)
new waterlvl = pev(id, pev_waterlevel)
if (!(flags & FL_ONGROUND))
return FMRES_IGNORED
if (flags & FL_WATERJUMP)
return FMRES_IGNORED
if (waterlvl > 1)
return FMRES_IGNORED
new Float:fVelocity[3]
pev(id, pev_velocity, fVelocity)
fVelocity[2] += get_pcvar_num(cvar_jump_hammer_fire)
set_pev(id, pev_velocity, fVelocity)
set_pev(id, pev_gaitsequence, 6)
}
set_user_maxspeed(id, get_pcvar_float(cvar_speed_hammer_fire))
}
if (weapon == CSW_KNIFE && g_has_hammer_ice[id])
{
if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
{
new flags = pev(id, pev_flags)
new waterlvl = pev(id, pev_waterlevel)
if (!(flags & FL_ONGROUND))
return FMRES_IGNORED
if (flags & FL_WATERJUMP)
return FMRES_IGNORED
if (waterlvl > 1)
return FMRES_IGNORED
new Float:fVelocity[3]
pev(id, pev_velocity, fVelocity)
fVelocity[2] += get_pcvar_num(cvar_jump_hammer_ice)
set_pev(id, pev_velocity, fVelocity)
set_pev(id, pev_gaitsequence, 6)
}
set_user_maxspeed(id, get_pcvar_float(cvar_speed_hammer_ice))
}
if (weapon == CSW_KNIFE && g_has_hammer_poison[id])
{
if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
{
new flags = pev(id, pev_flags)
new waterlvl = pev(id, pev_waterlevel)
if (!(flags & FL_ONGROUND))
return FMRES_IGNORED
if (flags & FL_WATERJUMP)
return FMRES_IGNORED
if (waterlvl > 1)
return FMRES_IGNORED
new Float:fVelocity[3]
pev(id, pev_velocity, fVelocity)
fVelocity[2] += get_pcvar_num(cvar_jump_hammer_poison)
set_pev(id, pev_velocity, fVelocity)
set_pev(id, pev_gaitsequence, 6)
}
set_user_maxspeed(id, get_pcvar_float(cvar_speed_hammer_poison))
}
if (weapon == CSW_KNIFE && g_has_demonsword[id])
{
if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
{
new flags = pev(id, pev_flags)
new waterlvl = pev(id, pev_waterlevel)
if (!(flags & FL_ONGROUND))
return FMRES_IGNORED
if (flags & FL_WATERJUMP)
return FMRES_IGNORED
if (waterlvl > 1)
return FMRES_IGNORED
new Float:fVelocity[3]
pev(id, pev_velocity, fVelocity)
fVelocity[2] += get_pcvar_num(cvar_jump_demonsword)
set_pev(id, pev_velocity, fVelocity)
set_pev(id, pev_gaitsequence, 6)
}
set_user_maxspeed(id, get_pcvar_float(cvar_speed_demonsword))
}
return FMRES_IGNORED
}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
if(!is_user_connected(victim) || victim == attacker)
return HAM_IGNORED;
if(g_frozen[victim])
end(victim);
return HAM_IGNORED;
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if(!is_user_connected(attacker))
return HAM_IGNORED
if(zp_get_user_zombie(attacker))
return HAM_IGNORED
if (is_weapon_jetpack(attacker))
return HAM_IGNORED;
if(get_user_weapon(attacker) == CSW_KNIFE)
{
if (g_has_strong[attacker])
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_strong))
new Float:vec[3];
new Float:oldvelo[3];
pev(victim, pev_velocity, oldvelo);
create_velocity_vector(victim , attacker , vec);
vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_strong);
vec[1] += oldvelo[1] + 0;
set_pev(victim, pev_velocity, vec);
}
else if (g_has_katana[attacker])
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_katana))
new Float:vec[3];
new Float:oldvelo[3];
pev(victim, pev_velocity, oldvelo);
create_velocity_vector(victim , attacker , vec);
vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_katana);
vec[1] += oldvelo[1] + 0;
set_pev(victim, pev_velocity, vec);
}
else if (g_has_combat[attacker])
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_combat))
new Float:vec[3];
new Float:oldvelo[3];
pev(victim, pev_velocity, oldvelo);
create_velocity_vector(victim , attacker , vec);
vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_combat);
vec[1] += oldvelo[1] + 0;
set_pev(victim, pev_velocity, vec);
}
else if (g_has_hammer_fire[attacker])
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_hammer_fire))
new Float:vec[3];
new Float:oldvelo[3];
pev(victim, pev_velocity, oldvelo);
create_velocity_vector(victim , attacker , vec);
vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_hammer_fire);
vec[1] += oldvelo[1] + 0;
set_pev(victim, pev_velocity, vec);
if( !task_exists( victim + TASK_FBURN ) )
{
g_burning_duration[ victim ] += FIRE_DURATION * 5
set_task( 0.1, "CTask__BurningFlame", victim + TASK_FBURN, _, _, "b" )
}
}
else if (g_has_hammer_ice[attacker])
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_hammer_ice))
new Float:vec[3];
new Float:oldvelo[3];
pev(victim, pev_velocity, oldvelo);
create_velocity_vector(victim , attacker , vec);
vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_hammer_ice);
vec[1] += oldvelo[1] + 0;
set_pev(victim, pev_velocity, vec);
if(!g_freeze_wait[attacker] && !zp_get_user_nemesis(victim))
{
set_pdata_float(victim, m_flNextAttack, TIME_FREEZE)
set_pev(victim, pev_flags, pev(victim, pev_flags) | FL_FROZEN)
set_user_rendering(victim, kRenderFxGlowShell, 0, 206, 209, kRenderNormal, 25)
g_frozen[victim] = true
set_task(TIME_FREEZE, "end", victim)
g_freeze_wait[attacker] = true
set_task(TIME_WAIT_FREEZE, "Freeze_Wait", attacker + 1233123)
}
}
else if (g_has_hammer_poison[attacker])
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_hammer_poison))
new Float:vec[3];
new Float:oldvelo[3];
pev(victim, pev_velocity, oldvelo);
create_velocity_vector(victim , attacker , vec);
vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_hammer_poison);
vec[1] += oldvelo[1] + 0;
set_pev(victim, pev_velocity, vec);
if( !task_exists( victim + TASK_POISBURN ) )
{
g_poisoning_duration[ victim ] += POISON_DURATION * 5
set_task( 0.1, "CTask__PoisoningFlame", victim + TASK_POISBURN, _, _, "b" )
}
}
else if (g_has_demonsword[attacker])
{
SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_demonsword))
new Float:vec[3];
new Float:oldvelo[3];
pev(victim, pev_velocity, oldvelo);
create_velocity_vector(victim , attacker , vec);
vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_demonsword);
vec[1] += oldvelo[1] + 0;
set_pev(victim, pev_velocity, vec);
if (!g_antidote_wait[attacker] && !zp_get_user_nemesis(victim) && !zp_get_user_last_zombie(victim))
{
zp_disinfect_user(victim);
g_antidote_wait[attacker] = true;
set_task(20.00, "Antidote_Wait", attacker + 33188951);
}
}
more_blood(victim)
}
return HAM_IGNORED
}
public Freeze_Wait(taskid)
{
new attacker = taskid - 1233123
if (is_user_alive(attacker))
{
remove_task(attacker + 1233123)
g_freeze_wait[attacker] = false
client_print(attacker, print_center, "Ваша способность готова!")
}
else
{
remove_task(attacker + 1233123)
}
}
public Antidote_Wait(taskid)
{
new attacker = taskid - 33188951;
if (is_user_alive(attacker))
{
remove_task(attacker + 33188951);
g_antidote_wait[attacker] = false;
client_print(attacker, print_center, "Ваша способность готова!")
}
else
{
remove_task(attacker + 33188951);
}
}
public end(victim)
{
if(g_frozen[victim])
g_frozen[victim] = false
set_pev(victim, pev_flags, pev(victim, pev_flags) & ~FL_FROZEN)
set_user_rendering(victim, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25)
CreateGlass(victim)
remove_task(victim)
}
public message_DeathMsg(msg_id, msg_dest, id)
{
static szTruncatedWeapon[33], iattacker, ivictim
get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
iattacker = get_msg_arg_int(1)
ivictim = get_msg_arg_int(2)
if(!is_user_connected(iattacker) || iattacker == ivictim)
return PLUGIN_CONTINUE
if (!zp_get_user_zombie(iattacker))
{
if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
{
if(g_has_strong[iattacker])
set_msg_arg_string(4, "strong")
}
if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
{
if(g_has_katana[iattacker])
set_msg_arg_string(4, "hatchet")
}
if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
{
if(g_has_combat[iattacker])
set_msg_arg_string(4, "mastercombat")
}
if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
{
if(g_has_hammer_fire[iattacker])
set_msg_arg_string(4, "hammer_fire")
}
if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
{
if(g_has_hammer_ice[iattacker])
set_msg_arg_string(4, "hammer_ice")
}
if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
{
if(g_has_hammer_poison[iattacker])
set_msg_arg_string(4, "hammer_poison")
}
if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
{
if(g_has_demonsword[iattacker])
set_msg_arg_string(4, "demonsword")
}
if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
{
if(!g_has_strong[iattacker] && !g_has_katana[iattacker] && !g_has_combat[iattacker] && !g_has_hammer_fire[iattacker] && !g_has_hammer_ice[iattacker] && !g_has_hammer_poison[iattacker] && !g_has_demonsword[iattacker] && !zp_get_user_zombie(iattacker))
set_msg_arg_string(4, "knife")
}
}
if (zp_get_user_zombie(iattacker))
{
if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
{
if(g_has_strong[iattacker] || g_has_katana[iattacker] || g_has_combat[iattacker] || g_has_hammer_fire[iattacker] || g_has_hammer_ice[iattacker] || g_has_hammer_poison[iattacker] || g_has_demonsword[iattacker])
set_msg_arg_string(4, "Claws")
}
}
return PLUGIN_CONTINUE
}
stock create_velocity_vector(victim,attacker,Float:velocity[3])
{
if(!zp_get_user_zombie(victim) || !is_user_alive(attacker))
return 0;
new Float:vicorigin[3];
new Float:attorigin[3];
pev(victim, pev_origin , vicorigin);
pev(attacker, pev_origin , attorigin);
new Float:origin2[3]
origin2[0] = vicorigin[0] - attorigin[0];
origin2[1] = vicorigin[1] - attorigin[1];
new Float:largestnum = 0.0;
if(floatabs(origin2[0])>largestnum) largestnum = floatabs(origin2[0]);
if(floatabs(origin2[1])>largestnum) largestnum = floatabs(origin2[1]);
origin2[0] /= largestnum;
origin2[1] /= largestnum;
if (g_has_strong[attacker])
{
velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_strong) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_strong) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
}
else if (g_has_katana[attacker])
{
velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_katana) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_katana) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
}
else if (g_has_combat[attacker])
{
velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_combat) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_combat) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
}
else if (g_has_hammer_fire[attacker])
{
velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_hammer_fire) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_hammer_fire) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
}
else if (g_has_hammer_ice[attacker])
{
velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_hammer_ice) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_hammer_ice) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
}
else if (g_has_hammer_poison[attacker])
{
velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_hammer_poison) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_hammer_poison) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
}
else if (g_has_demonsword[attacker])
{
velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_demonsword) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_demonsword) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin));
}
if(velocity[0] <= 20.0 || velocity[1] <= 20.0)
velocity[2] = random_float(200.0 , 275.0);
return 1;
}
more_blood(id)
{
static iOrigin[3]
get_user_origin(id, iOrigin)
message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
write_byte(TE_BLOODSTREAM)
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2]+10)
write_coord(random_num(-360, 360))
write_coord(random_num(-360, 360))
write_coord(-10)
write_byte(70)
write_byte(random_num(50, 100))
message_end()
for (new j = 0; j < 4; j++)
{
message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
write_byte(TE_WORLDDECAL)
write_coord(iOrigin[0]+random_num(-100, 100))
write_coord(iOrigin[1]+random_num(-100, 100))
write_coord(iOrigin[2]-36)
write_byte(random_num(190, 197))
message_end()
}
}
public sprite(const player, const string_msg[], byte_1, byte_2, byte_3, byte_4, byte_5, byte_6, byte_7, byte_8)
{
message_begin( MSG_ONE, get_user_msgid("WeaponList"), .player = player );
{
write_string(string_msg);
write_byte(byte_1);
write_byte(byte_2);
write_byte(byte_3);
write_byte(byte_4);
write_byte(byte_5);
write_byte(byte_6);
write_byte(byte_7);
write_byte(byte_8);
}
message_end();
}
public set_sprite(id)
{
if(!is_user_alive(id))
{
return;
}
if(zp_get_user_zombie(id) || zp_get_user_survivor(id))
{
sprite(id, "weapon_knife", -1, -1, -1, -1, 2, 1, 29, 0)
return;
}
if(g_has_strong[id])
{
sprite(id, "zm_knife_strong", -1, -1, -1, -1, 2, 1, 29, 0)
return;
}
if(g_has_katana[id])
{
sprite(id, "zm_knife_katana", -1, -1, -1, -1, 2, 1, 29, 0)
return;
}
if(g_has_combat[id])
{
sprite(id, "zm_knife_combat", -1, -1, -1, -1, 2, 1, 29, 0)
return;
}
if(g_has_hammer_fire[id])
{
sprite(id, "zm_knife_hammer_fire", -1, -1, -1, -1, 2, 1, 29, 0)
return;
}
if(g_has_hammer_ice[id])
{
sprite(id, "zm_knife_hammer_ice", -1, -1, -1, -1, 2, 1, 29, 0)
return;
}
if(g_has_hammer_poison[id])
{
sprite(id, "zm_knife_hammer_poison", -1, -1, -1, -1, 2, 1, 29, 0)
return;
}
if(g_has_demonsword[id])
{
sprite(id, "zm_knife_demonsword", -1, -1, -1, -1, 2, 1, 29, 0)
return;
}
}
public Ham_CKnife__SendWeaponAnim_Pre( ) return HAM_SUPERCEDE;
/* -> Weapon Animation <- */
stock UTIL_SendWeaponAnim( const pReceiver, const iAnim )
{
set_pev( pReceiver, pev_weaponanim, iAnim );
message_begin( MSG_ONE, SVC_WEAPONANIM, .player = pReceiver );
write_byte( iAnim );
write_byte( 0 );
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")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!team", "^3")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
public CTask__BurningFlame( taskid )
{
// Get player origin and flags
static origin[3], flags
get_user_origin(ID_FBURN, origin)
flags = pev(ID_FBURN, pev_flags)
// Madness mode - in water - burning stopped
if ((flags & FL_INWATER) || g_burning_duration[ID_FBURN] < 1 || g_fRoundEnd || !is_user_alive(ID_FBURN))
{
// Smoke sprite
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SMOKE) // TE id
write_coord(origin[0]) // x
write_coord(origin[1]) // y
write_coord(origin[2]-50) // z
write_short(g_smokeSpr) // sprite
write_byte(random_num(15, 20)) // scale
write_byte(random_num(10, 20)) // framerate
message_end()
// Task not needed anymore
remove_task(taskid)
return
}
// Get player's health
static health
health = pev(ID_FBURN, pev_health)
// Take damage from the fire
if (health - FIRE_DAMAGE > 0)
fm_set_user_health(ID_FBURN, health - FIRE_DAMAGE)
// Flame sprite
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SPRITE) // TE id
write_coord(origin[0]+random_num(-5, 5)) // x
write_coord(origin[1]+random_num(-5, 5)) // y
write_coord(origin[2]+random_num(-10, 10)) // z
write_short(g_flameSpr) // sprite
write_byte(random_num(5, 10)) // scale
write_byte(200) // brightness
message_end()
g_burning_duration[ID_FBURN]--
}
public CTask__PoisoningFlame( taskid )
{
// Get player origin and flags
static origin[3], flags
get_user_origin(ID_POISBURN, origin)
flags = pev(ID_POISBURN, pev_flags)
// Madness mode - in water - burning stopped
if ((flags & FL_INWATER) || g_poisoning_duration[ID_POISBURN] < 1 || g_fRoundEnd || !is_user_alive(ID_POISBURN))
{
// Smoke sprite
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SMOKE) // TE id
write_coord(origin[0]) // x
write_coord(origin[1]) // y
write_coord(origin[2]-50) // z
write_short(g_smokeSpr) // sprite
write_byte(random_num(15, 20)) // scale
write_byte(random_num(10, 20)) // framerate
message_end()
// Task not needed anymore
remove_task(taskid)
return
}
// Get player's health
static health
health = pev(ID_POISBURN, pev_health)
// Take damage from the poison
if (health - POISON_DAMAGE > 0)
fm_set_user_health(ID_POISBURN, health - POISON_DAMAGE)
// Flame sprite
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SPRITE) // TE id
write_coord(origin[0]+random_num(-5, 5)) // x
write_coord(origin[1]+random_num(-5, 5)) // y
write_coord(origin[2]+random_num(-10, 10)) // z
write_short(g_poisonSpr) // sprite
write_byte(random_num(5, 10)) // scale
write_byte(150) // brightness
message_end()
g_poisoning_duration[ID_POISBURN]--
}
stock fm_set_user_health( index, health )
{
health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index)
}
stock CreateGlass(id)
{
new szOrigin[3];
get_user_origin(id, szOrigin);
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(TE_BREAKMODEL);
write_coord( szOrigin[0] );
write_coord( szOrigin[1] );
write_coord( szOrigin[2] + 24 );
write_coord(16);
write_coord(16);
write_coord(16);
write_coord( random_num(-50, 50) );
write_coord( random_num(-50, 50) );
write_coord(25);
write_byte(10);
write_short(g_SpriteGlass);
write_byte(10);
write_byte(25);
write_byte(0x01);
message_end();
}
Спасибо тебе большое) и всем остальным за наводки тоже :)Код:#include <amxmodx> #include <fakemeta> #include <hamsandwich> #include <engine> #include <zp_level_system> #define JETPACK_COST 30 #define LVL_COUNT 5 native zp_get_user_zombie(id) native zp_register_extra_item(const name[], cost, teams) new const ClassInfoTarget[] = "info_target" new const ClassBreakAble[] = "func_breakable" new const ClassnameJetPack[] = "n4d_jetpack" new const ClassnameRocket[] = "n4d_bazooka" new const ModelVJetPack[] = "models/mu/v_jp_mu.mdl" new const ModelPJetPack[] = "models/mu/p_jp_mu.mdl" new const ModelWJetPack[] = "models/mu/w_jp_mu.mdl" new const ModelRocket[] = "models/rpgrocket.mdl" new const SoundPickup[] = "items/gunpickup2.wav" new const SoundShoot[] = "mu/at4-1.wav" new const SoundTravel[] = "mu/bfuu.wav" new const SoundFly[] = "mu/fly.wav" new const SoundBlow[] = "mu/blow.wav" new bool:bHasJetPack[33] new Float:fJetpackFuel[33] new Float:fLastShoot[33] new SprExp, SprTrail, ItemJetPack, MsgSayText new CvarMaxFuel, CvarRadius, CvarDamage, CvarSpeed, CvarCooldown, CvarRegen, CvarRocketSpeed new Float:CMaxFuel, Float:CRadius, Float:CDamage, CSpeed, Float:CCooldown, Float:CRegen, CRocketSpeed #define ZP_TEAM_HUMAN (1<<1) #define ZP_PLUGIN_HANDLED 97 //Uncomment this to draw ring effect #define DrawRing //Uncomment this to draw flame effect #define DrawFlame #if defined DrawRing new SprRing #endif #if defined DrawFlame new SprFlame #endif public plugin_precache() { precache_sound(SoundPickup) precache_sound(SoundShoot) precache_sound(SoundTravel) precache_sound(SoundFly) precache_sound(SoundBlow) SprExp = precache_model("sprites/zerogxplode.spr") SprTrail = precache_model("sprites/smoke.spr") #if defined DrawFlame SprFlame = precache_model("sprites/xfireball3.spr") #endif #if defined DrawRing SprRing = precache_model("sprites/shockwave.spr") #endif precache_model(ModelVJetPack) precache_model(ModelPJetPack) precache_model(ModelWJetPack) precache_model(ModelRocket) } public plugin_init() { register_plugin("New Jetpack", "0.0.3", "Bad_Bud,ZmOutStanding,Connor,wbyokomo") register_event("HLTV", "OnNewRound", "a", "1=0", "2=0") register_logevent("OnRoundEnd", 2, "1=Round_End") RegisterHam(Ham_Killed, "player", "OnPlayerKilled") RegisterHam(Ham_Player_Jump, "player", "OnPlayerJump") RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "OnKnifeSecAtkPost", 1) RegisterHam(Ham_Item_Deploy, "weapon_knife", "OnKnifeDeployPost", 1) register_forward(FM_PlayerPreThink, "OnPlayerPreThink") register_touch(ClassnameRocket, "*", "OnTouchRocket") register_touch(ClassnameJetPack, "player", "OnTouchJetPack") register_think(ClassnameJetPack, "OnThinkJetPack") CvarMaxFuel = register_cvar("jp_maxfuel", "350.0") CvarRadius = register_cvar("jp_radius", "300.0") CvarDamage = register_cvar("jp_damage", "1200.0") CvarSpeed = register_cvar("jp_speed", "450") CvarCooldown = register_cvar("jp_cooldown", "15.0") CvarRegen = register_cvar("jp_regen", "0.5") CvarRocketSpeed = register_cvar("jp_rocket_speed", "1500") MsgSayText = get_user_msgid("SayText") ItemJetPack = zp_register_extra_item("Jetpack", JETPACK_COST, ZP_TEAM_HUMAN) register_clcmd("drop", "CmdDropJP") } public client_putinserver(id) { ResetValues(id) } public client_disconnect(id) { ResetValues(id) } public OnNewRound() { RemoveAllJetPack() CMaxFuel = get_pcvar_float(CvarMaxFuel) CRadius = get_pcvar_float(CvarRadius) CDamage = get_pcvar_float(CvarDamage) CSpeed = get_pcvar_num(CvarSpeed) CCooldown = get_pcvar_float(CvarCooldown) CRegen = get_pcvar_float(CvarRegen) CRocketSpeed = get_pcvar_num(CvarRocketSpeed) } public OnRoundEnd() { RemoveAllJetPack() } public OnPlayerKilled(id) { if(bHasJetPack[id]) DropJetPack(id); ResetValues(id) } public OnPlayerJump(id) { if(bHasJetPack[id] && fJetpackFuel[id] > 0.0 && get_user_weapon(id) == CSW_KNIFE && pev(id, pev_button) & IN_DUCK && ~pev(id, pev_flags) & FL_ONGROUND) { static Float:vVelocity[3], Float:upSpeed pev(id, pev_velocity, vVelocity) upSpeed = vVelocity[2] + 35.0 velocity_by_aim(id, CSpeed, vVelocity) vVelocity[2] = upSpeed > 300.0 ? 300.0 : upSpeed set_pev(id, pev_velocity, vVelocity) #if defined DrawFlame pev(id, pev_origin, vVelocity) engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vVelocity, 0) write_byte(TE_SPRITE) engfunc(EngFunc_WriteCoord, vVelocity[0]) engfunc(EngFunc_WriteCoord, vVelocity[1]) engfunc(EngFunc_WriteCoord, vVelocity[2]) write_short(SprFlame) write_byte(8) write_byte(128) message_end() #endif fJetpackFuel[id] > 80.0 ? emit_sound(id, CHAN_STREAM, SoundFly, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) : emit_sound(id, CHAN_STREAM, SoundBlow, VOL_NORM, ATTN_NORM, 0, PITCH_NORM); fJetpackFuel[id] -= 1.0 } } public zp_user_infected_pre(id) { if(bHasJetPack[id]) DropJetPack(id); ResetValues(id) } public zp_extra_item_selected(id, item) { if(item == ItemJetPack) { if(zp_level(id) >= LVL_COUNT) { if(bHasJetPack[id]) { zp_colored_print(id, "^x01[^x04ZP^x01] У вас уже есть Джет-Пак!") return ZP_PLUGIN_HANDLED; } bHasJetPack[id] = true zp_colored_print(id, "^x01[^x04ZP^x01] Джет-Пак:^x04 JUMP + DUCK ^x01f^x04^x01") engclient_cmd(id, "weapon_knife") } else { zp_colored_print(id, "^x01[^x04ZP^x01] Вы не достигли ^x04%d ^x01уровня!", LVL_COUNT) return ZP_PLUGIN_HANDLED } } return PLUGIN_CONTINUE; } public give_jetpack(id) { if(bHasJetPack[id]) { zp_colored_print(id, "^x01[^x04ZP^x01] У вас уже есть Джет-Пак!") return ZP_PLUGIN_HANDLED; } bHasJetPack[id] = true zp_colored_print(id, "^x01[^x04ZP^x01] Джет-Пак:^x04 JUMP + DUCK ^x01f^x04^x01") engclient_cmd(id, "weapon_knife") ReplaceModel(id) return PLUGIN_CONTINUE; } public is_jetpack(id) { if (!is_user_connected(id)) return -1; return bHasJetPack[id]; } public plugin_natives() { register_native("give_weapon_jetpack", "give_jetpack", 1); register_native("is_weapon_jetpack", "is_jetpack", 1); } public OnKnifeSecAtkPost(ent2) { if(pev_valid(ent2) == 2) { static id, Float:ctime id = get_pdata_cbase(ent2, 41, 4) ctime = get_gametime() if(is_user_alive(id) && bHasJetPack[id] && fLastShoot[id] < ctime) { new ent = create_entity(ClassInfoTarget) if(ent) { engfunc(EngFunc_SetModel, ent, ModelRocket) engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0}) new Float:fOrigin[3] pev(id, pev_origin, fOrigin) fOrigin[2] += 16.0 engfunc(EngFunc_SetOrigin, ent, fOrigin) set_pev(ent, pev_classname, ClassnameRocket) set_pev(ent, pev_dmg, 100.0) set_pev(ent, pev_owner, id) velocity_by_aim(id, CRocketSpeed, fOrigin) set_pev(ent, pev_velocity, fOrigin) new Float:vecAngles[3] engfunc(EngFunc_VecToAngles, fOrigin, vecAngles) set_pev(ent, pev_angles, vecAngles) set_pev(ent, pev_movetype, MOVETYPE_FLY) set_pev(ent, pev_solid, SOLID_BBOX) emit_sound(id, CHAN_STATIC, SoundShoot, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) emit_sound(ent, CHAN_WEAPON, SoundTravel, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) message_begin(MSG_BROADCAST, SVC_TEMPENTITY) write_byte(TE_BEAMFOLLOW) write_short(ent) write_short(SprTrail) write_byte(40) write_byte(5) write_byte(224) write_byte(224) write_byte(255) write_byte(192) message_end() fLastShoot[id] = ctime + CCooldown } else { fLastShoot[id] = ctime+1.5 } } } } public OnKnifeDeployPost(ent) { if(pev_valid(ent) == 2) { static id; id = get_pdata_cbase(ent, 41, 4) if(is_user_alive(id) && bHasJetPack[id]) ReplaceModel(id); } } public OnPlayerPreThink(id) { if(bHasJetPack[id] && fJetpackFuel[id] < CMaxFuel) { static button; button = pev(id, pev_button) if(!(button & IN_DUCK) && !(button & IN_JUMP)) fJetpackFuel[id] += CRegen; } } public OnTouchRocket(ent, id) { static Float:fOrigin[3] pev(ent, pev_origin, fOrigin) engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fOrigin, 0) write_byte(TE_EXPLOSION) engfunc(EngFunc_WriteCoord, fOrigin[0]) engfunc(EngFunc_WriteCoord, fOrigin[1]) engfunc(EngFunc_WriteCoord, fOrigin[2]) write_short(SprExp) write_byte(40) write_byte(30) write_byte(10) message_end() #if defined DrawRing engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, fOrigin, 0) write_byte(TE_BEAMCYLINDER) engfunc(EngFunc_WriteCoord, fOrigin[0]) engfunc(EngFunc_WriteCoord, fOrigin[1]) engfunc(EngFunc_WriteCoord, fOrigin[2]) engfunc(EngFunc_WriteCoord, fOrigin[0]) engfunc(EngFunc_WriteCoord, fOrigin[1]) engfunc(EngFunc_WriteCoord, fOrigin[2]+555.0) write_short(SprRing) write_byte(0) write_byte(1) write_byte(6) write_byte(8) write_byte(10) write_byte(224) write_byte(224) write_byte(255) write_byte(192) write_byte(5) message_end() #endif static attacker; attacker = pev(ent, pev_owner) if(!is_user_connected(attacker)) { engfunc(EngFunc_RemoveEntity, ent) return PLUGIN_CONTINUE; } if(pev_valid(id) && !is_user_connected(id)) { static szClassname[32] pev(id, pev_classname, szClassname, 31) if(equal(szClassname, ClassBreakAble) && (pev(id, pev_solid) != SOLID_NOT)) { dllfunc(DLLFunc_Use, id, ent) } } static victim; victim = -1 while((victim = engfunc(EngFunc_FindEntityInSphere, victim, fOrigin, CRadius)) != 0) { if(is_user_alive(victim) && zp_get_user_zombie(victim)) { static Float:originV[3], Float:dist, Float:damage pev(victim, pev_origin, originV) dist = get_distance_f(fOrigin, originV) damage = CDamage-(CDamage/CRadius)*dist if(damage > 0.0) { ExecuteHamB(Ham_TakeDamage, victim, ent, attacker, damage, DMG_BULLET) //client_print(attacker, print_chat, "[Jp] Rocket damage: %.1f", damage) } } } engfunc(EngFunc_RemoveEntity, ent) return PLUGIN_CONTINUE; } public OnTouchJetPack(ent, id) { if((pev(ent, pev_iuser4) != 11111) && is_user_alive(id) && !zp_get_user_zombie(id) && !bHasJetPack[id]) { engfunc(EngFunc_RemoveEntity, ent) bHasJetPack[id] = true emit_sound(id, CHAN_STATIC, SoundPickup, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) engclient_cmd(id,"weapon_knife") ReplaceModel(id) } } public OnThinkJetPack(ent) { if(pev_valid(ent) == 2) { switch(pev(ent, pev_flTimeStepSound)) { case 200: { set_pev(ent, pev_iuser4, 22222) set_pev(ent, pev_flTimeStepSound, 201) } case 201: { engfunc(EngFunc_RemoveEntity, ent) } } } } public CmdDropJP(id) { if(is_user_alive(id) && bHasJetPack[id] && get_user_weapon(id) == CSW_KNIFE) { DropJetPack(id) bHasJetPack[id] = false set_pev(id, pev_viewmodel2, "models/v_knife.mdl") set_pev(id, pev_weaponmodel2, "models/p_knife.mdl") return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; } ReplaceModel(id) { set_pev(id, pev_viewmodel2, ModelVJetPack) set_pev(id, pev_weaponmodel2, ModelPJetPack) } DropJetPack(id) { new ent = create_entity(ClassInfoTarget) if(!ent) return; engfunc(EngFunc_SetModel, ent, ModelWJetPack) engfunc(EngFunc_SetSize, ent, Float:{-8.0, -8.0, -8.0}, Float:{8.0, 8.0, 8.0}) new Float:fOrigin[3] pev(id, pev_origin, fOrigin) fOrigin[2] += 16.0 engfunc(EngFunc_SetOrigin, ent, fOrigin) set_pev(ent, pev_classname, ClassnameJetPack) velocity_by_aim(id, 800, fOrigin) //if it too far then reduce it set_pev(ent, pev_velocity, fOrigin) set_pev(ent, pev_movetype, MOVETYPE_TOSS) set_pev(ent, pev_iuser4, 11111) set_pev(ent, pev_solid, SOLID_TRIGGER) set_pev(ent, pev_flTimeStepSound, 200) set_pev(ent, pev_nextthink, get_gametime()+2.0) // prevent drop/pickup exploit } RemoveAllJetPack() { new ent = engfunc(EngFunc_FindEntityByString, -1, "classname", ClassnameJetPack) while(ent > 0) { engfunc(EngFunc_RemoveEntity, ent) ent = engfunc(EngFunc_FindEntityByString, -1, "classname", ClassnameJetPack) } } ResetValues(id) { bHasJetPack[id] = false fJetpackFuel[id] = CMaxFuel } zp_colored_print(target, const message[], any:...) { static buffer[512], i, argscount argscount = numargs() if (!target) { static iPlayers[32], iNum, j, player get_players(iPlayers, iNum, "ch") for (j = 0; j < iNum; j++) { player = iPlayers[j] static changed[5], changedcount changedcount = 0 for (i = 2; i < argscount; i++) { if (getarg(i) == LANG_PLAYER) { setarg(i, 0, player) changed[changedcount] = i changedcount++ } } vformat(buffer, charsmax(buffer), message, 3) message_begin(MSG_ONE_UNRELIABLE, MsgSayText, _, player) write_byte(player) write_string(buffer) message_end() for (i = 0; i < changedcount; i++) setarg(changed[i], 0, LANG_PLAYER); } } else { vformat(buffer, charsmax(buffer), message, 3) message_begin(MSG_ONE, MsgSayText, _, target) write_byte(target) write_string(buffer) message_end() } }
Код:#include <amxmodx> #include <fun> #include <fakemeta> #include <hamsandwich> #include <zombieplague> #define PLUGIN "[ZP] Addon: Knifes" #define VERSION "1.1" #define AUTHOR "Mr.TheFold, redacted by _RedGamer_" native is_weapon_jetpack(id) #define VIP ADMIN_LEVEL_H #define SUPER_VIP ADMIN_LEVEL_F #define OWNER ADMIN_LEVEL_G #define CREATOR ADMIN_MENU // Поджог #define TASK_FBURN 100 #define ID_FBURN ( taskid - TASK_FBURN ) #define FIRE_DURATION 6 #define FIRE_DAMAGE 25 // Отравление #define TASK_POISBURN 100 #define ID_POISBURN ( taskid - TASK_POISBURN ) #define POISON_DURATION 12 #define POISON_DAMAGE 50 // Максимальное количество игроков #define MAX_CLIENTS 32 const Float:TIME_FREEZE = 5.0 const Float:TIME_WAIT_FREEZE = 10.0 // OFFSETS #define m_pPlayer 41 #define m_iId 43 #define m_Weapon_flNextSecondaryAttack 47 #define m_Weapon_flTimeWeaponIdle 48 #define m_Weapon_iWeaponState 74 #define m_pActiveItem 373 #define m_flNextAttack 83 #define m_flTimeWeaponIdle 48 #define PDATA_SAFE 2 #define linux_diff_weapon 4 #define linux_diff_player 5 // Number Animation Stab const WeaponAnim_Stab = 4; // Stab animation // Value Hammers const Float: WeaponAnim_Stab_Time = 0.826; // Stab animation time const Float: WeaponSecondaryAttackDelay = 0.5; // After this time, we did secondary attack // Value DemonSword const Float: Weapon_AnimSword_Stab_Time = 1.63; // Stab Demon Sword animation time const Float: WeaponSwordSecondaryAttackDelay = 0.633; // After this time, we did secondary attack new HamHook: gl_HamHook_SendWeaponAnim_Pre; new KNIFE1_V_MODEL[] = "models/CSO_Knifes/v_strong.mdl" new KNIFE1_P_MODEL[] = "models/CSO_Knifes/p_strong.mdl" new KNIFE2_V_MODEL[] = "models/CSO_Knifes/v_katana.mdl" new KNIFE2_P_MODEL[] = "models/CSO_Knifes/p_katana.mdl" new KNIFE3_V_MODEL[] = "models/CSO_Knifes/v_combat.mdl" new KNIFE3_P_MODEL[] = "models/CSO_Knifes/p_combat.mdl" new KNIFE4_V_MODEL[] = "models/CSO_Knifes/v_hammer_fire.mdl" new KNIFE4_P_MODEL[] = "models/CSO_Knifes/p_hammer_fire.mdl" new KNIFE5_V_MODEL[] = "models/CSO_Knifes/v_hammer_ice.mdl" new KNIFE5_P_MODEL[] = "models/CSO_Knifes/p_hammer_ice.mdl" new KNIFE6_V_MODEL[] = "models/CSO_Knifes/v_hammer_poison.mdl" new KNIFE6_P_MODEL[] = "models/CSO_Knifes/p_hammer_poison.mdl" new KNIFE7_V_MODEL[] = "models/CSO_Knifes/v_demonsword.mdl" new KNIFE7_P_MODEL[] = "models/CSO_Knifes/p_demonsword.mdl" new const g_SpriteGlasses[] = "models/glassgibs.mdl" new bool:g_has_strong[33] new bool:g_has_katana[33] new bool:g_has_combat[33] new bool:g_has_hammer_fire[33] new bool:g_has_hammer_ice[33] new bool:g_has_hammer_poison[33] new bool:g_has_demonsword[33] new bool:g_fRoundEnd new g_flameSpr, g_smokeSpr, g_burning_duration[ MAX_CLIENTS + 1 ] new g_freeze_wait[33] new g_poisonSpr, g_poisoning_duration[ MAX_CLIENTS + 1 ] new g_antidote_wait[33] new g_frozen[33], g_SpriteGlass new g_knife_menu, g_vip_knife_menu, g_supervip_knife_menu, g_owner_knife_menu, g_creator_knife_menu new cvar_knock_strong, cvar_jump_strong, cvar_speed_strong, cvar_damage_strong new cvar_knock_katana, cvar_jump_katana, cvar_speed_katana, cvar_damage_katana new cvar_knock_combat, cvar_jump_combat, cvar_speed_combat, cvar_damage_combat new cvar_knock_hammer_fire, cvar_jump_hammer_fire, cvar_speed_hammer_fire, cvar_damage_hammer_fire new cvar_knock_hammer_ice, cvar_jump_hammer_ice, cvar_speed_hammer_ice, cvar_damage_hammer_ice new cvar_knock_hammer_poison, cvar_jump_hammer_poison, cvar_speed_hammer_poison, cvar_damage_hammer_poison new cvar_knock_demonsword, cvar_jump_demonsword, cvar_speed_demonsword, cvar_damage_demonsword new const g_sound_knife[] = { "items/gunpickup2.wav" } /* new const old_sounds[][] = { "weapons/knife_deploy1.wav", "weapons/knife_hit1.wav", "weapons/knife_hitwall1.wav", "weapons/knife_slash1.wav", "weapons/knife_slash2.wav", "weapons/knife_stab.wav" } */ new const strong_sounds[][] = { "CSO_Knifes/strong_draw.wav", "CSO_Knifes/strong_hit_01.wav", "CSO_Knifes/strong_hit_02.wav", "CSO_Knifes/strong_hit_wall.wav", "CSO_Knifes/strong_miss.wav", "CSO_Knifes/strong_stab.wav" } new const katana_sounds[][] = { "CSO_Knifes/katana_draw.wav", "CSO_Knifes/katana_hit_01.wav", "CSO_Knifes/katana_hit_02.wav", "CSO_Knifes/katana_hit_wall.wav", "CSO_Knifes/katana_miss.wav", "CSO_Knifes/katana_stab.wav" } new const combat_sounds[][] = { "CSO_Knifes/combat_draw.wav", "CSO_Knifes/combat_hit_01.wav", "CSO_Knifes/combat_hit_02.wav", "CSO_Knifes/combat_hit_wall.wav", "CSO_Knifes/combat_miss.wav", "CSO_Knifes/combat_stab.wav" } new const hammer_fire_sounds[][] = { "knife_zp/hammer_draw.wav", "knife_zp/hammer_hit_01.wav", "knife_zp/hammer_hit_02.wav", "knife_zp/hammer_hit_wall.wav", "knife_zp/hammer_miss.wav", "knife_zp/hammer_stab.wav" } new const hammer_ice_sounds[][] = { "knife_zp/hammer_draw.wav", "knife_zp/hammer_hit_01.wav", "knife_zp/hammer_hit_02.wav", "knife_zp/hammer_hit_wall.wav", "knife_zp/hammer_miss.wav", "knife_zp/hammer_stab.wav" } new const hammer_poison_sounds[][] = { "knife_zp/hammer_draw.wav", "knife_zp/hammer_hit_01.wav", "knife_zp/hammer_hit_02.wav", "knife_zp/hammer_hit_wall.wav", "knife_zp/hammer_miss.wav", "knife_zp/hammer_stab.wav" } new const demonsword_sounds[][] = { "Skull/knife_draw_fix.wav", "Skull/knife_hit_fix.wav", "Skull/knife_hit_02_fix.wav", "Skull/knife_wall_fix.wav", "Skull/knife_slash_fix.wav", "Skull/knife_stab_fix.wav" } public plugin_init() { register_plugin(PLUGIN , VERSION , AUTHOR); register_cvar("zp_addon_knife", VERSION, FCVAR_SERVER); g_knife_menu = menu_create("Выбор ножа","menu_handle") g_vip_knife_menu = menu_create("Выбор ножа","menu_handle_vip") g_supervip_knife_menu = menu_create("Выбор ножа", "menu_handle_supervip") g_owner_knife_menu = menu_create("Выбор ножа", "menu_handle_owner") g_creator_knife_menu = menu_create("Выбор ножа", "menu_handle_creator") register_clcmd("/knife","knifemenu",ADMIN_ALL,"knife_menu") build_menu() build_menu_vip() build_menu_supervip() build_menu_owner() build_menu_creator() register_event("CurWeapon","checkWeapon","be","1=1"); register_forward(FM_EmitSound, "CEntity__EmitSound"); register_forward(FM_PlayerPreThink, "fw_PlayerPreThink"); register_forward(FM_UpdateClientData, "FM_Hook_UpdateClientData_Post", true); RegisterHam(Ham_Item_Holster, "weapon_knife", "Ham_CKnife__Deploy_Post", true); RegisterHam(Ham_Item_PostFrame, "weapon_knife", "Ham_CKnife__PostFrame_Pre", false); RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "Ham_CKnife__SecondaryAttack_Pre", false); RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage") RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") RegisterHam(Ham_Use, "func_tank", "fw_UseStationary_Post", 1) RegisterHam(Ham_Use, "func_tankmortar", "fw_UseStationary_Post", 1) RegisterHam(Ham_Use, "func_tankrocket", "fw_UseStationary_Post", 1) RegisterHam(Ham_Use, "func_tanklaser", "fw_UseStationary_Post", 1) DisableHamForward(gl_HamHook_SendWeaponAnim_Pre = RegisterHam(Ham_CS_Weapon_SendWeaponAnim, "weapon_knife", "Ham_CKnife__SendWeaponAnim_Pre", false)) register_message(get_user_msgid("DeathMsg"), "message_DeathMsg"); register_clcmd("zm_knife_katana", "clcmd_knife") register_clcmd("zm_knife_combat", "clcmd_knife") register_clcmd("zm_knife_strong", "clcmd_knife") register_clcmd("zm_knife_hammer_fire", "clcmd_knife") register_clcmd("zm_knife_hammer_ice", "clcmd_knife") register_clcmd("zm_knife_hammer_poison", "clcmd_knife") register_clcmd("zm_knife_demonsword", "clcmd_knife") cvar_jump_strong = register_cvar("zp_strong_jump", "340.0") cvar_speed_strong = register_cvar("zp_strong_speed", "245.0") cvar_damage_strong = register_cvar("zp_strong_damage", "5.2") cvar_knock_strong = register_cvar("zp_strong_knockback", "3.2") cvar_jump_katana = register_cvar("zp_katana_jump", "380.0") cvar_speed_katana = register_cvar("zp_katana_speed", "245.0") cvar_damage_katana = register_cvar("zp_katana_damage", "3.2") cvar_knock_katana = register_cvar("zp_katana_knockback", "2.4") cvar_jump_combat = register_cvar("zp_combat_jump", "350.0") cvar_speed_combat = register_cvar("zp_combat_speed", "280.0") cvar_damage_combat = register_cvar("zp_combat_damage", "3.2") cvar_knock_combat = register_cvar("zp_combat_knockback", "2.6") cvar_jump_hammer_fire = register_cvar("zp_hammer_fire_jump", "360.0") cvar_speed_hammer_fire = register_cvar("zp_hammer_fire_speed", "280.0") cvar_damage_hammer_fire = register_cvar("zp_hammer_fire_damage", "10.0") cvar_knock_hammer_fire = register_cvar("zp_hammer_fire_knockback", "5.0") cvar_jump_hammer_ice = register_cvar("zp_hammer_ice_jump", "380.0") cvar_speed_hammer_ice = register_cvar("zp_hammer_ice_speed", "280.0") cvar_damage_hammer_ice = register_cvar("zp_hammer_ice_damage", "12.5") cvar_knock_hammer_ice = register_cvar("zp_hammer_ice_knockback", "5.0") cvar_jump_hammer_poison = register_cvar("zp_hammer_poison_jump", "400.0") cvar_speed_hammer_poison = register_cvar("zp_hammer_poison_speed", "280.0") cvar_damage_hammer_poison = register_cvar("zp_hammer_poison_damage", "15") cvar_knock_hammer_poison = register_cvar("zp_hammer_poison_knockback", "5.0") cvar_jump_demonsword = register_cvar("zp_demonsword_jump", "420.0") cvar_speed_demonsword = register_cvar("zp_demonsword_speed", "280.0") cvar_damage_demonsword = register_cvar("zp_demonsword_damage", "17.5") cvar_knock_demonsword = register_cvar("zp_demonsword_knockback", "5.0") } public client_connect(id) { g_has_strong[id] = true g_has_katana[id] = false g_has_combat[id] = false g_has_hammer_fire[id] = false g_has_hammer_ice[id] = false g_has_hammer_poison[id] = false g_has_demonsword[id] = false } public client_disconnect(id) { g_has_strong[id] = false g_has_katana[id] = false g_has_combat[id] = false g_has_hammer_fire[id] = false g_has_hammer_ice[id] = false g_has_hammer_poison[id] = false g_has_demonsword[id] = false } public plugin_precache() { // Flame Sprites g_flameSpr = precache_model( "sprites/flame.spr" ); g_smokeSpr = precache_model( "sprites/black_smoke3.spr" ); // Poison Sprites g_poisonSpr = precache_model( "sprites/flame_poison.spr" ); g_smokeSpr = precache_model( "sprites/black_smoke3.spr" ); // Freeze Glass g_SpriteGlass = precache_model(g_SpriteGlasses); // Precache Knife Models precache_model(KNIFE1_V_MODEL) precache_model(KNIFE1_P_MODEL) precache_model(KNIFE2_V_MODEL) precache_model(KNIFE2_P_MODEL) precache_model(KNIFE3_V_MODEL) precache_model(KNIFE3_P_MODEL) precache_model(KNIFE4_V_MODEL) precache_model(KNIFE4_P_MODEL) precache_model(KNIFE5_V_MODEL) precache_model(KNIFE5_P_MODEL) precache_model(KNIFE6_V_MODEL) precache_model(KNIFE6_P_MODEL) precache_model(KNIFE7_V_MODEL) precache_model(KNIFE7_P_MODEL) precache_generic("sprites/zm_knife_katana.txt") precache_generic("sprites/zm_knife_combat.txt") precache_generic("sprites/zm_knife_strong.txt") precache_generic("sprites/zm_knife_hammer_fire.txt") precache_generic("sprites/zm_knife_hammer_ice.txt") precache_generic("sprites/zm_knife_hammer_poison.txt") precache_generic("sprites/zm_knife_demonsword.txt") precache_generic("sprites/CSO_Knifes/640hud7.spr") precache_generic("sprites/CSO_Knifes/640hud53.spr") precache_generic("sprites/CSO_Knifes/640hud38.spr") precache_generic("sprites/CSO_Knifes/640hud40.spr") precache_generic("sprites/CSO_Knifes/640hud57.spr") // Precache Knife Sounds precache_sound(g_sound_knife) for(new i = 0; i < sizeof strong_sounds; i++) precache_sound(strong_sounds[i]) for(new i = 0; i < sizeof katana_sounds; i++) precache_sound(katana_sounds[i]) for(new i = 0; i < sizeof combat_sounds; i++) precache_sound(combat_sounds[i]) for(new i = 0; i < sizeof hammer_fire_sounds; i++) precache_sound(hammer_fire_sounds[i]) for(new i = 0; i < sizeof hammer_ice_sounds; i++) precache_sound(hammer_ice_sounds[i]) for(new i = 0; i < sizeof hammer_poison_sounds; i++) precache_sound(hammer_poison_sounds[i]) for(new i = 0; i < sizeof demonsword_sounds; i++) precache_sound(demonsword_sounds[i]) } public clcmd_knife(id) { if(!is_user_alive(id)) return PLUGIN_HANDLED; engclient_cmd(id, "weapon_knife") return PLUGIN_HANDLED; } build_menu() { menu_additem(g_knife_menu, "\y[Katana] \r[Прыжок]", "2") menu_additem(g_knife_menu, "\y[Combat] \r[Скорость]", "3") menu_additem(g_knife_menu, "\y[Strong] \r[Урон]", "1") menu_additem(g_knife_menu, "\y[Hammer Fire] \r[VIP]", "4") menu_additem(g_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5") menu_additem(g_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6") menu_additem(g_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7") menu_setprop(g_knife_menu, MPROP_PERPAGE, 0) } build_menu_vip() { menu_additem(g_vip_knife_menu, "\y[Katana] \r[Прыжок]", "2") menu_additem(g_vip_knife_menu, "\y[Combat] \r[Скорость]", "3") menu_additem(g_vip_knife_menu, "\y[Strong] \r[Урон]", "1") menu_additem(g_vip_knife_menu, "\y[Hammer Fire] \r[VIP]", "4") menu_additem(g_vip_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5") menu_additem(g_vip_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6") menu_additem(g_vip_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7") menu_setprop(g_vip_knife_menu, MPROP_PERPAGE, 0) } build_menu_supervip() { menu_additem(g_supervip_knife_menu, "\y[Katana] \r[Прыжок]", "2") menu_additem(g_supervip_knife_menu, "\y[Combat] \r[Скорость]", "3") menu_additem(g_supervip_knife_menu, "\y[Strong] \r[Урон]", "1") menu_additem(g_supervip_knife_menu, "\y[Hammer Fire] \r[VIP]", "4") menu_additem(g_supervip_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5") menu_additem(g_supervip_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6") menu_additem(g_supervip_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7") menu_setprop(g_supervip_knife_menu, MPROP_PERPAGE, 0) } build_menu_owner() { menu_additem(g_owner_knife_menu, "\y[Katana] \r[Прыжок]", "2") menu_additem(g_owner_knife_menu, "\y[Combat] \r[Скорость]", "3") menu_additem(g_owner_knife_menu, "\y[Strong] \r[Урон]", "1") menu_additem(g_owner_knife_menu, "\y[Hammer Fire] \r[VIP]", "4") menu_additem(g_owner_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5") menu_additem(g_owner_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6") menu_additem(g_owner_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7") menu_setprop(g_owner_knife_menu, MPROP_PERPAGE, 0) } build_menu_creator() { menu_additem(g_creator_knife_menu, "\y[Katana] \r[Прыжок]", "2") menu_additem(g_creator_knife_menu, "\y[Combat] \r[Скорость]", "3") menu_additem(g_creator_knife_menu, "\y[Strong] \r[Урон]", "1") menu_additem(g_creator_knife_menu, "\y[Hammer Fire] \r[VIP]", "4") menu_additem(g_creator_knife_menu, "\y[Hammer Ice] \r[SUPER VIP]", "5") menu_additem(g_creator_knife_menu, "\y[Hammer Poison] \r[OWNER]", "6") menu_additem(g_creator_knife_menu, "\y[Demon Sword] \r[CREATOR]", "7") menu_setprop(g_creator_knife_menu, MPROP_PERPAGE, 0) } public knifemenu(id) { menu_display(id, !(get_user_flags(id) & VIP) ? g_knife_menu : g_vip_knife_menu, 0) menu_display(id, !(get_user_flags(id) & SUPER_VIP) ? g_knife_menu : g_supervip_knife_menu, 0) menu_display(id, !(get_user_flags(id) & OWNER) ? g_knife_menu : g_owner_knife_menu, 0) menu_display(id, !(get_user_flags(id) & CREATOR) ? g_knife_menu : g_creator_knife_menu, 0) return PLUGIN_HANDLED; } public menu_handle_vip(id, menu, item) { if(item < 0) return PLUGIN_CONTINUE new cmd[2]; new access, callback; menu_item_getinfo(menu, item, access, cmd,2,_,_, callback); new choice = str_to_num(cmd) switch (choice) { case 1: buy_knife1(id) case 2: buy_knife2(id) case 3: buy_knife3(id) case 4: buy_knife4(id) case 5: buy_knife5(id) case 6: buy_knife6(id) case 7: buy_knife7(id) } return PLUGIN_HANDLED; } public menu_handle_supervip(id, menu, item) { if(item < 0) return PLUGIN_CONTINUE new cmd[2]; new access, callback; menu_item_getinfo(menu, item, access, cmd,2,_,_, callback); new choice = str_to_num(cmd) switch (choice) { case 1: buy_knife1(id) case 2: buy_knife2(id) case 3: buy_knife3(id) case 4: buy_knife4(id) case 5: buy_knife5(id) case 6: buy_knife6(id) case 7: buy_knife7(id) } return PLUGIN_HANDLED; } public menu_handle_owner(id, menu, item) { if(item < 0) return PLUGIN_CONTINUE new cmd[2]; new access, callback; menu_item_getinfo(menu, item, access, cmd,2,_,_, callback); new choice = str_to_num(cmd) switch (choice) { case 1: buy_knife1(id) case 2: buy_knife2(id) case 3: buy_knife3(id) case 4: buy_knife4(id) case 5: buy_knife5(id) case 6: buy_knife6(id) case 7: buy_knife7(id) } return PLUGIN_HANDLED; } public menu_handle_creator(id, menu, item) { if(item < 0) return PLUGIN_CONTINUE new cmd[2]; new access, callback; menu_item_getinfo(menu, item, access, cmd,2,_,_, callback); new choice = str_to_num(cmd) switch (choice) { case 1: buy_knife1(id) case 2: buy_knife2(id) case 3: buy_knife3(id) case 4: buy_knife4(id) case 5: buy_knife5(id) case 6: buy_knife6(id) case 7: buy_knife7(id) } return PLUGIN_HANDLED; } public menu_handle(id, menu, item) { if(item < 0) return PLUGIN_CONTINUE new cmd[2]; new access, callback; menu_item_getinfo(menu, item, access, cmd,2,_,_, callback); new choice = str_to_num(cmd) switch (choice) { case 1: buy_knife1(id) case 2: buy_knife2(id) case 3: buy_knife3(id) case 4: buy_knife4(id) case 5: buy_knife5(id) case 6: buy_knife6(id) case 7: buy_knife7(id) } return PLUGIN_HANDLED; } public buy_knife1(id) { g_has_strong[id] = true g_has_katana[id] = false g_has_combat[id] = false g_has_hammer_fire[id] = false g_has_hammer_ice[id] = false g_has_hammer_poison[id] = false g_has_demonsword[id] = false set_sprite(id) message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id) write_byte(29) message_end() checkWeapon(id) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM) return PLUGIN_HANDLED; } public buy_knife2(id) { g_has_strong[id] = false g_has_katana[id] = true g_has_combat[id] = false g_has_hammer_fire[id] = false g_has_hammer_ice[id] = false g_has_hammer_poison[id] = false g_has_demonsword[id] = false set_sprite(id) message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id) write_byte(29) message_end() checkWeapon(id) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM) return PLUGIN_HANDLED; } public buy_knife3(id) { g_has_strong[id] = false g_has_katana[id] = false g_has_combat[id] = true g_has_hammer_fire[id] = false g_has_hammer_ice[id] = false g_has_hammer_poison[id] = false g_has_demonsword[id] = false set_sprite(id) message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id) write_byte(29) message_end() checkWeapon(id) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM) return PLUGIN_HANDLED; } public buy_knife4(id) { if (get_user_flags(id) & VIP) { g_has_strong[id] = false g_has_katana[id] = false g_has_combat[id] = false g_has_hammer_fire[id] = true g_has_hammer_ice[id] = false g_has_hammer_poison[id] = false g_has_demonsword[id] = false set_sprite(id) message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id) write_byte(29) message_end() checkWeapon(id) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM) } else { knifemenu(id) ChatColor(id, "!y[!gZP!y] !yНож !teamHammer Fire !yдоступен только для !gВипа!") } return PLUGIN_HANDLED; } public buy_knife5(id) { if (get_user_flags(id) & SUPER_VIP) { g_has_strong[id] = false g_has_katana[id] = false g_has_combat[id] = false g_has_hammer_fire[id] = false g_has_hammer_ice[id] = true g_has_hammer_poison[id] = false g_has_demonsword[id] = false set_sprite(id) message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id) write_byte(29) message_end() checkWeapon(id) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM) } else { knifemenu(id) ChatColor(id, "!y[!gZP!y] !yНож !teamHammer Ice !yдоступен только для !gСупер Випа!") } return PLUGIN_HANDLED; } public buy_knife6(id) { if (get_user_flags(id) & OWNER) { g_has_strong[id] = false g_has_katana[id] = false g_has_combat[id] = false g_has_hammer_fire[id] = false g_has_hammer_ice[id] = false g_has_hammer_poison[id] = true g_has_demonsword[id] = false set_sprite(id) message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id) write_byte(29) message_end() checkWeapon(id) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM) } else { knifemenu(id) ChatColor(id, "!y[!gZP!y] !yНож !teamHammer Poison !yдоступен только для !gВладельца!") } return PLUGIN_HANDLED; } public buy_knife7(id) { if (get_user_flags(id) & CREATOR) { g_has_strong[id] = false g_has_katana[id] = false g_has_combat[id] = false g_has_hammer_fire[id] = false g_has_hammer_ice[id] = false g_has_hammer_poison[id] = false g_has_demonsword[id] = true set_sprite(id) message_begin(MSG_ONE, get_user_msgid("WeapPickup"), {0,0,0}, id) write_byte(29) message_end() checkWeapon(id) engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM) } else { knifemenu(id) ChatColor(id, "!y[!gZP!y] !yНож !teamDemon Sword !yдоступен только для !gСоздателя!") } return PLUGIN_HANDLED; } public fw_UseStationary_Post(entity, caller, activator, use_type) { if (use_type == 0 && is_user_connected(caller)) checkWeapon(caller) } public zp_user_infected_post(id) { set_sprite(id) } public checkWeapon(id) { if(get_user_weapon(id) != CSW_KNIFE) return; if (g_has_strong[id] || g_has_katana[id] || g_has_combat[id] || g_has_hammer_fire[id] || g_has_hammer_ice[id] || g_has_hammer_poison[id] || g_has_demonsword[id]) { checkModel(id) } return; } public checkModel(id) { if (zp_get_user_zombie(id)) { set_sprite(id) return; } if(get_user_weapon(id) != CSW_KNIFE) return; if (g_has_strong[id]) { set_pev(id, pev_viewmodel2, KNIFE1_V_MODEL) set_pev(id, pev_weaponmodel2, KNIFE1_P_MODEL) } else if (g_has_katana[id]) { set_pev(id, pev_viewmodel2, KNIFE2_V_MODEL) set_pev(id, pev_weaponmodel2, KNIFE2_P_MODEL) } else if (g_has_combat[id]) { set_pev(id, pev_viewmodel2, KNIFE3_V_MODEL) set_pev(id, pev_weaponmodel2, KNIFE3_P_MODEL) } else if (g_has_hammer_fire[id]) { set_pev(id, pev_viewmodel2, KNIFE4_V_MODEL) set_pev(id, pev_weaponmodel2, KNIFE4_P_MODEL) } else if (g_has_hammer_ice[id]) { set_pev(id, pev_viewmodel2, KNIFE5_V_MODEL) set_pev(id, pev_weaponmodel2, KNIFE5_P_MODEL) } else if (g_has_hammer_poison[id]) { set_pev(id, pev_viewmodel2, KNIFE6_V_MODEL) set_pev(id, pev_weaponmodel2, KNIFE6_P_MODEL) } else if (g_has_demonsword[id]) { set_pev(id, pev_viewmodel2, KNIFE7_V_MODEL) set_pev(id, pev_weaponmodel2, KNIFE7_P_MODEL) } set_sprite(id) } public CEntity__EmitSound(id, channel, const sample[], Float:volume, Float:attn, flags, pitch) { if (!is_user_connected(id)) return HAM_IGNORED if (zp_get_user_zombie(id)) return HAM_IGNORED if (sample[8] == 'k' && sample[9] == 'n' && sample[10] == 'i') { if (sample[14] == 'd') { if(g_has_strong[id]) emit_sound(id, channel, strong_sounds[0], volume, attn, flags, pitch) if(g_has_katana[id]) emit_sound(id, channel, katana_sounds[0], volume, attn, flags, pitch) if(g_has_combat[id]) emit_sound(id, channel, combat_sounds[0], volume, attn, flags, pitch) if(g_has_hammer_fire[id]) emit_sound(id, channel, hammer_fire_sounds[0], volume, attn, flags, pitch) if(g_has_hammer_ice[id]) emit_sound(id, channel, hammer_ice_sounds[0], volume, attn, flags, pitch) if(g_has_hammer_poison[id]) emit_sound(id, channel, hammer_poison_sounds[0], volume, attn, flags, pitch) if(g_has_demonsword[id]) emit_sound(id, channel, demonsword_sounds[0], volume, attn, flags, pitch) } else if (sample[14] == 'h') { if (sample[17] == 'w') { if(g_has_strong[id]) emit_sound(id, channel, strong_sounds[3], volume, attn, flags, pitch) if(g_has_katana[id]) emit_sound(id, channel, katana_sounds[3], volume, attn, flags, pitch) if(g_has_combat[id]) emit_sound(id, channel, combat_sounds[3], volume, attn, flags, pitch) if(g_has_hammer_fire[id]) emit_sound(id, channel, hammer_fire_sounds[3], volume, attn, flags, pitch) if(g_has_hammer_ice[id]) emit_sound(id, channel, hammer_ice_sounds[3], volume, attn, flags, pitch) if(g_has_hammer_poison[id]) emit_sound(id, channel, hammer_poison_sounds[3], volume, attn, flags, pitch) if(g_has_demonsword[id]) emit_sound(id, channel, demonsword_sounds[3], volume, attn, flags, pitch) } else { if(g_has_strong[id]) emit_sound(id, channel, strong_sounds[random_num(1,2)], volume, attn, flags, pitch) if(g_has_katana[id]) emit_sound(id, channel, katana_sounds[random_num(1,2)], volume, attn, flags, pitch) if(g_has_combat[id]) emit_sound(id, channel, combat_sounds[random_num(1,2)], volume, attn, flags, pitch) if(g_has_hammer_fire[id]) emit_sound(id, channel, hammer_fire_sounds[random_num(1,2)], volume, attn, flags, pitch) if(g_has_hammer_ice[id]) emit_sound(id, channel, hammer_ice_sounds[random_num(1,2)], volume, attn, flags, pitch) if(g_has_hammer_poison[id]) emit_sound(id, channel, hammer_poison_sounds[random_num(1,2)], volume, attn, flags, pitch) if(g_has_demonsword[id]) emit_sound(id, channel, demonsword_sounds[random_num(1,2)], volume, attn, flags, pitch) } } else { if (sample[15] == 'l') { if(g_has_strong[id]) emit_sound(id, channel, strong_sounds[4], volume, attn, flags, pitch) if(g_has_katana[id]) emit_sound(id, channel, katana_sounds[4], volume, attn, flags, pitch) if(g_has_combat[id]) emit_sound(id, channel, combat_sounds[4], volume, attn, flags, pitch) if(g_has_hammer_fire[id]) emit_sound(id, channel, hammer_fire_sounds[4], volume, attn, flags, pitch) if(g_has_hammer_ice[id]) emit_sound(id, channel, hammer_ice_sounds[4], volume, attn, flags, pitch) if(g_has_hammer_poison[id]) emit_sound(id, channel, hammer_poison_sounds[4], volume, attn, flags, pitch) if(g_has_demonsword[id]) emit_sound(id, channel, demonsword_sounds[4], volume, attn, flags, pitch) } else { if(g_has_strong[id]) emit_sound(id, channel, strong_sounds[5], volume, attn, flags, pitch) if(g_has_katana[id] ) emit_sound(id, channel, katana_sounds[5], volume, attn, flags, pitch) if(g_has_combat[id] ) emit_sound(id, channel, combat_sounds[5], volume, attn, flags, pitch) if(g_has_hammer_fire[id]) emit_sound(id, channel, hammer_fire_sounds[5], volume, attn, flags, pitch) if(g_has_hammer_ice[id]) emit_sound(id, channel, hammer_ice_sounds[5], volume, attn, flags, pitch) if(g_has_hammer_poison[id]) emit_sound(id, channel, hammer_poison_sounds[5], volume, attn, flags, pitch) if(g_has_demonsword[id]) emit_sound(id, channel, demonsword_sounds[5], volume, attn, flags, pitch) } } return HAM_SUPERCEDE } return HAM_IGNORED } public FM_Hook_UpdateClientData_Post( const pPlayer, const iSendWeapons, const CD_Handle ) { if ( !is_user_alive( pPlayer ) ) return; if ( zp_get_user_zombie( pPlayer ) ) return; static pActiveItem; pActiveItem = get_pdata_cbase( pPlayer, m_pActiveItem, linux_diff_player ); if ( pev_valid( pActiveItem ) != PDATA_SAFE || get_pdata_int( pActiveItem, m_iId, linux_diff_weapon ) != CSW_KNIFE ) return; // свой нож чекай if(!(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer] || g_has_demonsword[pPlayer])) return; set_cd( CD_Handle, CD_flNextAttack, 2.0 ); } public Ham_CKnife__Deploy_Post( const pItem ) { if ( pev_valid( pItem ) != PDATA_SAFE ) return; new pPlayer = get_pdata_cbase( pItem, m_pPlayer, linux_diff_weapon ); if ( !is_user_alive( pPlayer ) ) return; // check player on zombie, if has zombie => return HAM_IGNORED; if(zp_get_user_zombie(pPlayer)) return; // check knife, if not valid => return HAM_IGNORED; if(!(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer] || g_has_demonsword[pPlayer])) return; set_pdata_int( pItem, m_Weapon_iWeaponState, false, linux_diff_weapon ); return; } public Ham_CKnife__PostFrame_Pre( const pItem ) { if ( pev_valid( pItem ) != PDATA_SAFE ) return HAM_IGNORED; static pPlayer; pPlayer = get_pdata_cbase( pItem, m_pPlayer, linux_diff_weapon ); // check player on zombie, if has zombie => return HAM_IGNORED; if(zp_get_user_zombie(pPlayer)) return HAM_IGNORED // check knife, if not valid => return HAM_IGNORED; if(!(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer] || g_has_demonsword[pPlayer])) return HAM_IGNORED if ( get_pdata_int( pItem, m_Weapon_iWeaponState, linux_diff_weapon ) && get_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, linux_diff_weapon ) <= 0.0 ) { // Call EmitSound forward only for block or change sound to custom EnableHamForward( gl_HamHook_SendWeaponAnim_Pre ); ExecuteHam( Ham_Weapon_SecondaryAttack, pItem ); DisableHamForward( gl_HamHook_SendWeaponAnim_Pre ); if(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer]) { set_pdata_int( pItem, m_Weapon_iWeaponState, false, linux_diff_weapon ); set_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, WeaponAnim_Stab_Time - WeaponSecondaryAttackDelay, linux_diff_weapon ); } else if(g_has_demonsword[pPlayer]) { set_pdata_int( pItem, m_Weapon_iWeaponState, false, linux_diff_weapon ); set_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, Weapon_AnimSword_Stab_Time - WeaponSwordSecondaryAttackDelay, linux_diff_weapon ); } } return HAM_IGNORED; } public Ham_CKnife__SecondaryAttack_Pre( const pItem ) { if ( pev_valid( pItem ) != PDATA_SAFE ) return HAM_IGNORED; new pPlayer = get_pdata_cbase( pItem, m_pPlayer, linux_diff_weapon ); if ( !is_user_alive( pPlayer ) ) return HAM_IGNORED; //check player on zombie, if has zombie => return HAM_IGNORED; if(zp_get_user_zombie(pPlayer)) return HAM_IGNORED //check knife, if not valid => return HAM_IGNORED; if(!(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer] || g_has_demonsword[pPlayer])) return HAM_IGNORED //We already in secondary attack delay if ( get_pdata_int( pItem, m_Weapon_iWeaponState, linux_diff_weapon ) ) return HAM_SUPERCEDE; UTIL_SendWeaponAnim( pPlayer, WeaponAnim_Stab ); if(g_has_hammer_fire[pPlayer] || g_has_hammer_ice[pPlayer] || g_has_hammer_poison[pPlayer]) { set_pdata_int( pItem, m_Weapon_iWeaponState, true, linux_diff_weapon ); set_pdata_float( pItem, m_Weapon_flTimeWeaponIdle, WeaponAnim_Stab_Time, linux_diff_weapon ); set_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, WeaponSecondaryAttackDelay, linux_diff_weapon ); } else if(g_has_demonsword[pPlayer]) { set_pdata_int( pItem, m_Weapon_iWeaponState, true, linux_diff_weapon ); set_pdata_float( pItem, m_Weapon_flTimeWeaponIdle, Weapon_AnimSword_Stab_Time, linux_diff_weapon ); set_pdata_float( pItem, m_Weapon_flNextSecondaryAttack, WeaponSwordSecondaryAttackDelay, linux_diff_weapon ); } else return HAM_IGNORED; return HAM_SUPERCEDE } public fw_PlayerPreThink(id) { if(!is_user_alive(id) || zp_get_user_zombie(id)) return FMRES_IGNORED new temp[2], weapon = get_user_weapon(id, temp[0], temp[1]) if (weapon == CSW_KNIFE && g_has_strong[id]) { set_user_maxspeed(id,get_pcvar_float(cvar_speed_strong)) if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP)) { new flags = pev(id, pev_flags) new waterlvl = pev(id, pev_waterlevel) if (!(flags & FL_ONGROUND)) return FMRES_IGNORED if (flags & FL_WATERJUMP) return FMRES_IGNORED if (waterlvl > 1) return FMRES_IGNORED new Float:fVelocity[3] pev(id, pev_velocity, fVelocity) fVelocity[2] += get_pcvar_num(cvar_jump_strong) set_pev(id, pev_velocity, fVelocity) set_pev(id, pev_gaitsequence, 6) } } if(weapon == CSW_KNIFE && g_has_katana[id]) { set_user_maxspeed(id,get_pcvar_float(cvar_speed_katana)) if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP)) { new flags = pev(id, pev_flags) new waterlvl = pev(id, pev_waterlevel) if (!(flags & FL_ONGROUND)) return FMRES_IGNORED if (flags & FL_WATERJUMP) return FMRES_IGNORED if (waterlvl > 1) return FMRES_IGNORED new Float:fVelocity[3] pev(id, pev_velocity, fVelocity) fVelocity[2] += get_pcvar_num(cvar_jump_katana) set_pev(id, pev_velocity, fVelocity) set_pev(id, pev_gaitsequence, 6) } } if(weapon == CSW_KNIFE && g_has_combat[id]) { if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP)) { new flags = pev(id, pev_flags) new waterlvl = pev(id, pev_waterlevel) if (!(flags & FL_ONGROUND)) return FMRES_IGNORED if (flags & FL_WATERJUMP) return FMRES_IGNORED if (waterlvl > 1) return FMRES_IGNORED new Float:fVelocity[3] pev(id, pev_velocity, fVelocity) fVelocity[2] += get_pcvar_num(cvar_jump_combat) set_pev(id, pev_velocity, fVelocity) set_pev(id, pev_gaitsequence, 6) } set_user_maxspeed(id,get_pcvar_float(cvar_speed_combat)) } if (weapon == CSW_KNIFE && g_has_hammer_fire[id]) { if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP)) { new flags = pev(id, pev_flags) new waterlvl = pev(id, pev_waterlevel) if (!(flags & FL_ONGROUND)) return FMRES_IGNORED if (flags & FL_WATERJUMP) return FMRES_IGNORED if (waterlvl > 1) return FMRES_IGNORED new Float:fVelocity[3] pev(id, pev_velocity, fVelocity) fVelocity[2] += get_pcvar_num(cvar_jump_hammer_fire) set_pev(id, pev_velocity, fVelocity) set_pev(id, pev_gaitsequence, 6) } set_user_maxspeed(id, get_pcvar_float(cvar_speed_hammer_fire)) } if (weapon == CSW_KNIFE && g_has_hammer_ice[id]) { if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP)) { new flags = pev(id, pev_flags) new waterlvl = pev(id, pev_waterlevel) if (!(flags & FL_ONGROUND)) return FMRES_IGNORED if (flags & FL_WATERJUMP) return FMRES_IGNORED if (waterlvl > 1) return FMRES_IGNORED new Float:fVelocity[3] pev(id, pev_velocity, fVelocity) fVelocity[2] += get_pcvar_num(cvar_jump_hammer_ice) set_pev(id, pev_velocity, fVelocity) set_pev(id, pev_gaitsequence, 6) } set_user_maxspeed(id, get_pcvar_float(cvar_speed_hammer_ice)) } if (weapon == CSW_KNIFE && g_has_hammer_poison[id]) { if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP)) { new flags = pev(id, pev_flags) new waterlvl = pev(id, pev_waterlevel) if (!(flags & FL_ONGROUND)) return FMRES_IGNORED if (flags & FL_WATERJUMP) return FMRES_IGNORED if (waterlvl > 1) return FMRES_IGNORED new Float:fVelocity[3] pev(id, pev_velocity, fVelocity) fVelocity[2] += get_pcvar_num(cvar_jump_hammer_poison) set_pev(id, pev_velocity, fVelocity) set_pev(id, pev_gaitsequence, 6) } set_user_maxspeed(id, get_pcvar_float(cvar_speed_hammer_poison)) } if (weapon == CSW_KNIFE && g_has_demonsword[id]) { if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP)) { new flags = pev(id, pev_flags) new waterlvl = pev(id, pev_waterlevel) if (!(flags & FL_ONGROUND)) return FMRES_IGNORED if (flags & FL_WATERJUMP) return FMRES_IGNORED if (waterlvl > 1) return FMRES_IGNORED new Float:fVelocity[3] pev(id, pev_velocity, fVelocity) fVelocity[2] += get_pcvar_num(cvar_jump_demonsword) set_pev(id, pev_velocity, fVelocity) set_pev(id, pev_gaitsequence, 6) } set_user_maxspeed(id, get_pcvar_float(cvar_speed_demonsword)) } return FMRES_IGNORED } public fw_PlayerKilled(victim, attacker, shouldgib) { if(!is_user_connected(victim) || victim == attacker) return HAM_IGNORED; if(g_frozen[victim]) end(victim); return HAM_IGNORED; } public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) { if(!is_user_connected(attacker)) return HAM_IGNORED if(zp_get_user_zombie(attacker)) return HAM_IGNORED if (is_weapon_jetpack(attacker)) return HAM_IGNORED; if(get_user_weapon(attacker) == CSW_KNIFE) { if (g_has_strong[attacker]) { SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_strong)) new Float:vec[3]; new Float:oldvelo[3]; pev(victim, pev_velocity, oldvelo); create_velocity_vector(victim , attacker , vec); vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_strong); vec[1] += oldvelo[1] + 0; set_pev(victim, pev_velocity, vec); } else if (g_has_katana[attacker]) { SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_katana)) new Float:vec[3]; new Float:oldvelo[3]; pev(victim, pev_velocity, oldvelo); create_velocity_vector(victim , attacker , vec); vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_katana); vec[1] += oldvelo[1] + 0; set_pev(victim, pev_velocity, vec); } else if (g_has_combat[attacker]) { SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_combat)) new Float:vec[3]; new Float:oldvelo[3]; pev(victim, pev_velocity, oldvelo); create_velocity_vector(victim , attacker , vec); vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_combat); vec[1] += oldvelo[1] + 0; set_pev(victim, pev_velocity, vec); } else if (g_has_hammer_fire[attacker]) { SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_hammer_fire)) new Float:vec[3]; new Float:oldvelo[3]; pev(victim, pev_velocity, oldvelo); create_velocity_vector(victim , attacker , vec); vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_hammer_fire); vec[1] += oldvelo[1] + 0; set_pev(victim, pev_velocity, vec); if( !task_exists( victim + TASK_FBURN ) ) { g_burning_duration[ victim ] += FIRE_DURATION * 5 set_task( 0.1, "CTask__BurningFlame", victim + TASK_FBURN, _, _, "b" ) } } else if (g_has_hammer_ice[attacker]) { SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_hammer_ice)) new Float:vec[3]; new Float:oldvelo[3]; pev(victim, pev_velocity, oldvelo); create_velocity_vector(victim , attacker , vec); vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_hammer_ice); vec[1] += oldvelo[1] + 0; set_pev(victim, pev_velocity, vec); if(!g_freeze_wait[attacker] && !zp_get_user_nemesis(victim)) { set_pdata_float(victim, m_flNextAttack, TIME_FREEZE) set_pev(victim, pev_flags, pev(victim, pev_flags) | FL_FROZEN) set_user_rendering(victim, kRenderFxGlowShell, 0, 206, 209, kRenderNormal, 25) g_frozen[victim] = true set_task(TIME_FREEZE, "end", victim) g_freeze_wait[attacker] = true set_task(TIME_WAIT_FREEZE, "Freeze_Wait", attacker + 1233123) } } else if (g_has_hammer_poison[attacker]) { SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_hammer_poison)) new Float:vec[3]; new Float:oldvelo[3]; pev(victim, pev_velocity, oldvelo); create_velocity_vector(victim , attacker , vec); vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_hammer_poison); vec[1] += oldvelo[1] + 0; set_pev(victim, pev_velocity, vec); if( !task_exists( victim + TASK_POISBURN ) ) { g_poisoning_duration[ victim ] += POISON_DURATION * 5 set_task( 0.1, "CTask__PoisoningFlame", victim + TASK_POISBURN, _, _, "b" ) } } else if (g_has_demonsword[attacker]) { SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_demonsword)) new Float:vec[3]; new Float:oldvelo[3]; pev(victim, pev_velocity, oldvelo); create_velocity_vector(victim , attacker , vec); vec[0] += oldvelo[0] + get_pcvar_float(cvar_knock_demonsword); vec[1] += oldvelo[1] + 0; set_pev(victim, pev_velocity, vec); if (!g_antidote_wait[attacker] && !zp_get_user_nemesis(victim) && !zp_get_user_last_zombie(victim)) { zp_disinfect_user(victim); g_antidote_wait[attacker] = true; set_task(20.00, "Antidote_Wait", attacker + 33188951); } } more_blood(victim) } return HAM_IGNORED } public Freeze_Wait(taskid) { new attacker = taskid - 1233123 if (is_user_alive(attacker)) { remove_task(attacker + 1233123) g_freeze_wait[attacker] = false client_print(attacker, print_center, "Ваша способность готова!") } else { remove_task(attacker + 1233123) } } public Antidote_Wait(taskid) { new attacker = taskid - 33188951; if (is_user_alive(attacker)) { remove_task(attacker + 33188951); g_antidote_wait[attacker] = false; client_print(attacker, print_center, "Ваша способность готова!") } else { remove_task(attacker + 33188951); } } public end(victim) { if(g_frozen[victim]) g_frozen[victim] = false set_pev(victim, pev_flags, pev(victim, pev_flags) & ~FL_FROZEN) set_user_rendering(victim, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 25) CreateGlass(victim) remove_task(victim) } public message_DeathMsg(msg_id, msg_dest, id) { static szTruncatedWeapon[33], iattacker, ivictim get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon)) iattacker = get_msg_arg_int(1) ivictim = get_msg_arg_int(2) if(!is_user_connected(iattacker) || iattacker == ivictim) return PLUGIN_CONTINUE if (!zp_get_user_zombie(iattacker)) { if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE) { if(g_has_strong[iattacker]) set_msg_arg_string(4, "strong") } if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE) { if(g_has_katana[iattacker]) set_msg_arg_string(4, "hatchet") } if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE) { if(g_has_combat[iattacker]) set_msg_arg_string(4, "mastercombat") } if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE) { if(g_has_hammer_fire[iattacker]) set_msg_arg_string(4, "hammer_fire") } if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE) { if(g_has_hammer_ice[iattacker]) set_msg_arg_string(4, "hammer_ice") } if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE) { if(g_has_hammer_poison[iattacker]) set_msg_arg_string(4, "hammer_poison") } if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE) { if(g_has_demonsword[iattacker]) set_msg_arg_string(4, "demonsword") } if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE) { if(!g_has_strong[iattacker] && !g_has_katana[iattacker] && !g_has_combat[iattacker] && !g_has_hammer_fire[iattacker] && !g_has_hammer_ice[iattacker] && !g_has_hammer_poison[iattacker] && !g_has_demonsword[iattacker] && !zp_get_user_zombie(iattacker)) set_msg_arg_string(4, "knife") } } if (zp_get_user_zombie(iattacker)) { if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE) { if(g_has_strong[iattacker] || g_has_katana[iattacker] || g_has_combat[iattacker] || g_has_hammer_fire[iattacker] || g_has_hammer_ice[iattacker] || g_has_hammer_poison[iattacker] || g_has_demonsword[iattacker]) set_msg_arg_string(4, "Claws") } } return PLUGIN_CONTINUE } stock create_velocity_vector(victim,attacker,Float:velocity[3]) { if(!zp_get_user_zombie(victim) || !is_user_alive(attacker)) return 0; new Float:vicorigin[3]; new Float:attorigin[3]; pev(victim, pev_origin , vicorigin); pev(attacker, pev_origin , attorigin); new Float:origin2[3] origin2[0] = vicorigin[0] - attorigin[0]; origin2[1] = vicorigin[1] - attorigin[1]; new Float:largestnum = 0.0; if(floatabs(origin2[0])>largestnum) largestnum = floatabs(origin2[0]); if(floatabs(origin2[1])>largestnum) largestnum = floatabs(origin2[1]); origin2[0] /= largestnum; origin2[1] /= largestnum; if (g_has_strong[attacker]) { velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_strong) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_strong) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); } else if (g_has_katana[attacker]) { velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_katana) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_katana) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); } else if (g_has_combat[attacker]) { velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_combat) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_combat) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); } else if (g_has_hammer_fire[attacker]) { velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_hammer_fire) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_hammer_fire) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); } else if (g_has_hammer_ice[attacker]) { velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_hammer_ice) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_hammer_ice) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); } else if (g_has_hammer_poison[attacker]) { velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_hammer_poison) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_hammer_poison) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); } else if (g_has_demonsword[attacker]) { velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_demonsword) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_demonsword) * 3000 ) / floatround(get_distance_f(vicorigin, attorigin)); } if(velocity[0] <= 20.0 || velocity[1] <= 20.0) velocity[2] = random_float(200.0 , 275.0); return 1; } more_blood(id) { static iOrigin[3] get_user_origin(id, iOrigin) message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin) write_byte(TE_BLOODSTREAM) write_coord(iOrigin[0]) write_coord(iOrigin[1]) write_coord(iOrigin[2]+10) write_coord(random_num(-360, 360)) write_coord(random_num(-360, 360)) write_coord(-10) write_byte(70) write_byte(random_num(50, 100)) message_end() for (new j = 0; j < 4; j++) { message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin) write_byte(TE_WORLDDECAL) write_coord(iOrigin[0]+random_num(-100, 100)) write_coord(iOrigin[1]+random_num(-100, 100)) write_coord(iOrigin[2]-36) write_byte(random_num(190, 197)) message_end() } } public sprite(const player, const string_msg[], byte_1, byte_2, byte_3, byte_4, byte_5, byte_6, byte_7, byte_8) { message_begin( MSG_ONE, get_user_msgid("WeaponList"), .player = player ); { write_string(string_msg); write_byte(byte_1); write_byte(byte_2); write_byte(byte_3); write_byte(byte_4); write_byte(byte_5); write_byte(byte_6); write_byte(byte_7); write_byte(byte_8); } message_end(); } public set_sprite(id) { if(!is_user_alive(id)) { return; } if(zp_get_user_zombie(id) || zp_get_user_survivor(id)) { sprite(id, "weapon_knife", -1, -1, -1, -1, 2, 1, 29, 0) return; } if(g_has_strong[id]) { sprite(id, "zm_knife_strong", -1, -1, -1, -1, 2, 1, 29, 0) return; } if(g_has_katana[id]) { sprite(id, "zm_knife_katana", -1, -1, -1, -1, 2, 1, 29, 0) return; } if(g_has_combat[id]) { sprite(id, "zm_knife_combat", -1, -1, -1, -1, 2, 1, 29, 0) return; } if(g_has_hammer_fire[id]) { sprite(id, "zm_knife_hammer_fire", -1, -1, -1, -1, 2, 1, 29, 0) return; } if(g_has_hammer_ice[id]) { sprite(id, "zm_knife_hammer_ice", -1, -1, -1, -1, 2, 1, 29, 0) return; } if(g_has_hammer_poison[id]) { sprite(id, "zm_knife_hammer_poison", -1, -1, -1, -1, 2, 1, 29, 0) return; } if(g_has_demonsword[id]) { sprite(id, "zm_knife_demonsword", -1, -1, -1, -1, 2, 1, 29, 0) return; } } public Ham_CKnife__SendWeaponAnim_Pre( ) return HAM_SUPERCEDE; /* -> Weapon Animation <- */ stock UTIL_SendWeaponAnim( const pReceiver, const iAnim ) { set_pev( pReceiver, pev_weaponanim, iAnim ); message_begin( MSG_ONE, SVC_WEAPONANIM, .player = pReceiver ); write_byte( iAnim ); write_byte( 0 ); 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") replace_all(msg, 190, "!y", "^1") replace_all(msg, 190, "!team", "^3") if (id) players[0] = id; else get_players(players, count, "ch") { for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); write_byte(players[i]); write_string(msg); message_end(); } } } } public CTask__BurningFlame( taskid ) { // Get player origin and flags static origin[3], flags get_user_origin(ID_FBURN, origin) flags = pev(ID_FBURN, pev_flags) // Madness mode - in water - burning stopped if ((flags & FL_INWATER) || g_burning_duration[ID_FBURN] < 1 || g_fRoundEnd || !is_user_alive(ID_FBURN)) { // Smoke sprite message_begin(MSG_PVS, SVC_TEMPENTITY, origin) write_byte(TE_SMOKE) // TE id write_coord(origin[0]) // x write_coord(origin[1]) // y write_coord(origin[2]-50) // z write_short(g_smokeSpr) // sprite write_byte(random_num(15, 20)) // scale write_byte(random_num(10, 20)) // framerate message_end() // Task not needed anymore remove_task(taskid) return } // Get player's health static health health = pev(ID_FBURN, pev_health) // Take damage from the fire if (health - FIRE_DAMAGE > 0) fm_set_user_health(ID_FBURN, health - FIRE_DAMAGE) // Flame sprite message_begin(MSG_PVS, SVC_TEMPENTITY, origin) write_byte(TE_SPRITE) // TE id write_coord(origin[0]+random_num(-5, 5)) // x write_coord(origin[1]+random_num(-5, 5)) // y write_coord(origin[2]+random_num(-10, 10)) // z write_short(g_flameSpr) // sprite write_byte(random_num(5, 10)) // scale write_byte(200) // brightness message_end() g_burning_duration[ID_FBURN]-- } public CTask__PoisoningFlame( taskid ) { // Get player origin and flags static origin[3], flags get_user_origin(ID_POISBURN, origin) flags = pev(ID_POISBURN, pev_flags) // Madness mode - in water - burning stopped if ((flags & FL_INWATER) || g_poisoning_duration[ID_POISBURN] < 1 || g_fRoundEnd || !is_user_alive(ID_POISBURN)) { // Smoke sprite message_begin(MSG_PVS, SVC_TEMPENTITY, origin) write_byte(TE_SMOKE) // TE id write_coord(origin[0]) // x write_coord(origin[1]) // y write_coord(origin[2]-50) // z write_short(g_smokeSpr) // sprite write_byte(random_num(15, 20)) // scale write_byte(random_num(10, 20)) // framerate message_end() // Task not needed anymore remove_task(taskid) return } // Get player's health static health health = pev(ID_POISBURN, pev_health) // Take damage from the poison if (health - POISON_DAMAGE > 0) fm_set_user_health(ID_POISBURN, health - POISON_DAMAGE) // Flame sprite message_begin(MSG_PVS, SVC_TEMPENTITY, origin) write_byte(TE_SPRITE) // TE id write_coord(origin[0]+random_num(-5, 5)) // x write_coord(origin[1]+random_num(-5, 5)) // y write_coord(origin[2]+random_num(-10, 10)) // z write_short(g_poisonSpr) // sprite write_byte(random_num(5, 10)) // scale write_byte(150) // brightness message_end() g_poisoning_duration[ID_POISBURN]-- } stock fm_set_user_health( index, health ) { health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index) } stock CreateGlass(id) { new szOrigin[3]; get_user_origin(id, szOrigin); message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_BREAKMODEL); write_coord( szOrigin[0] ); write_coord( szOrigin[1] ); write_coord( szOrigin[2] + 24 ); write_coord(16); write_coord(16); write_coord(16); write_coord( random_num(-50, 50) ); write_coord( random_num(-50, 50) ); write_coord(25); write_byte(10); write_short(g_SpriteGlass); write_byte(10); write_byte(25); write_byte(0x01); message_end(); }