#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
 
#define PLUGIN  "[ZP] Addon: Knifes"
#define VERSION "NEW"
#define AUTHOR  "Mr.TheFold"
 
#define VIP ADMIN_CHAT
 
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.mdl"
new KNIFE4_P_MODEL[] = "models/CSO_Knifes/p_hammer.mdl"
 
new bool:g_has_strong[33]
new bool:g_has_katana[33]
new bool:g_has_combat[33]
new bool:g_has_hammer[33]
 
new g_knife_menu, g_vip_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, cvar_jump_hammer, cvar_speed_hammer, cvar_damage_hammer
 
new const g_sound_knife[] = { "items/gunpickup2.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_sounds[][] =
{
        "CSO_Knifes/hammer_draw.wav",
        "CSO_Knifes/hammer_hit_01.wav",
        "CSO_Knifes/hammer_hit_02.wav",
        "CSO_Knifes/hammer_hit_wall.wav",
        "CSO_Knifes/hammer_miss.wav",
        "CSO_Knifes/hammer_stab.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")
       
        register_clcmd("/knife","knifemenu",ADMIN_ALL,"knife_menu")
       
        build_menu()
        build_menu_vip()
       
        register_event("CurWeapon","checkWeapon","be","1=1");
       
        register_forward(FM_EmitSound, "CEntity__EmitSound");
        register_forward(FM_PlayerPreThink, "fw_PlayerPreThink");
       
        RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
        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)
       
        register_message(get_user_msgid("DeathMsg"), "message_DeathMsg");
       
        register_clcmd("zm_knife_katana", "clcmd_knife")
        register_clcmd("zm_knife_hammer", "clcmd_knife")
        register_clcmd("zm_knife_combat", "clcmd_knife")
        register_clcmd("zm_knife_strong", "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 = register_cvar("zp_hammer_jump", "400.0")
        cvar_speed_hammer = register_cvar("zp_hammer_speed", "300.0")
        cvar_damage_hammer = register_cvar("zp_hammer_damage", "8.4")
        cvar_knock_hammer = register_cvar("zp_hammer_knockback", "3.0")
}
 
public client_connect(id)
{
        g_has_strong[id] = true
        g_has_katana[id] = false
        g_has_combat[id] = false
        g_has_hammer[id] = false
}
 
public client_disconnect(id)
{
        g_has_strong[id] = false
        g_has_katana[id] = false
        g_has_combat[id] = false
        g_has_hammer[id] = false
}
 
public plugin_precache()
{
        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_generic("sprites/zm_knife_katana.txt")
        precache_generic("sprites/zm_knife_hammer.txt")
        precache_generic("sprites/zm_knife_combat.txt")
        precache_generic("sprites/zm_knife_strong.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_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_sounds; i++)
        precache_sound(hammer_sounds[i])
}
 
public clcmd_knife(id)
{
        if(!is_user_alive(id))
        return;
       
        engclient_cmd(id, "weapon_knife")
}
 
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] \r[VIP]", "4")
        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] \r[VIP]", "4")
        menu_setprop(g_vip_knife_menu, MPROP_PERPAGE, 0)
}
 
public knifemenu(id)
{
        if (zp_has_round_started())
        return;
       
        if (!zp_has_round_started())
        {
                menu_display(id, !(get_user_flags(id) & VIP) ? g_knife_menu : g_vip_knife_menu, 0)
        }
}
 
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)
        }
        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)
        }
        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[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)
}
 
public buy_knife2(id)
{
        g_has_strong[id] = false
        g_has_katana[id] = true
        g_has_combat[id] = false
        g_has_hammer[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)
}
 
public buy_knife3(id)
{
        g_has_strong[id] = false
        g_has_katana[id] = false
        g_has_combat[id] = true
        g_has_hammer[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)
}
 
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[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, "!g[Knife] !yНож !teamHammer !yдоступен только для !gVIP!")
        }
       
}
 
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[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[id])
        {
                set_pev(id, pev_viewmodel2, KNIFE4_V_MODEL)
                set_pev(id, pev_weaponmodel2, KNIFE4_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[id])
                        emit_sound(id, channel, hammer_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[id] )
                                emit_sound(id, channel, hammer_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[id])
                                emit_sound(id, channel, hammer_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[id])
                                emit_sound(id, channel, hammer_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[id])
                                emit_sound(id, channel, hammer_sounds[5], volume, attn, flags, pitch)
                        }
                }
                return HAM_SUPERCEDE
        }
        return HAM_IGNORED
}
 
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[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)
                       
                        set_pev(id, pev_velocity, fVelocity)
                        set_pev(id, pev_gaitsequence, 6)
                }
               
                set_user_maxspeed(id, get_pcvar_float(cvar_speed_hammer))
        }
        return FMRES_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(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[attacker])
                {
                        SetHamParamFloat(4, damage * get_pcvar_float(cvar_damage_hammer))
                       
                        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);
                        vec[1] += oldvelo[1] + 0;
                        set_pev(victim, pev_velocity, vec);
                }
                more_blood(victim)
        }
        return HAM_IGNORED
}
 
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[iattacker])
                        set_msg_arg_string(4, "hammer")
                }
               
                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[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[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) * 10000 ) / floatround(get_distance_f(vicorigin, attorigin));
                velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_strong) * 10000 ) / floatround(get_distance_f(vicorigin, attorigin));
        }
        else if (g_has_katana[attacker])
        {
                velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_katana) * 10000 ) / floatround(get_distance_f(vicorigin, attorigin));
                velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_katana) * 10000 ) / floatround(get_distance_f(vicorigin, attorigin));
        }
        else if (g_has_combat[attacker])
        {
                velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_combat) * 10000 ) / floatround(get_distance_f(vicorigin, attorigin));
                velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_combat) * 10000 ) / floatround(get_distance_f(vicorigin, attorigin));
        }
        else if (g_has_hammer[attacker])
        {
                velocity[0] = ( origin2[0] * get_pcvar_float(cvar_knock_hammer) * 10000 ) / floatround(get_distance_f(vicorigin, attorigin));
                velocity[1] = ( origin2[1] * get_pcvar_float(cvar_knock_hammer) * 10000 ) / 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))
        {
                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[id])
        {
                sprite(id, "zm_knife_hammer", -1, -1, -1, -1, 2, 1, 29, 0)
                return;
        }
}
 
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();
                        }
                }
        }
}