Raised This Month: $2 Target: $400
 0% 

Help on Plugin plz


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mohanad
Junior Member
Join Date: Jun 2020
Old 06-24-2020 , 17:00   Help on Plugin plz
Reply With Quote #1

Hello Guys (^^) .. I am New Here >
i have Extra Item Plugin with name "Dual Sword Phantom" ... its extra item plugin .. for Zombie Mod >> i want it as admin knife ... when the admin join the server he will get it automaticly ... please guys if one can help me ---- > Plugin Code <----
----------------------------------------------------------------------------------------------------------------
PHP Code:
#pragma compress 1

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <xs>
#include <zombieplague>

#define PLUGIN "CSO Dual Sword Phantom Slayer"
#define VERSION "1.0"
#define AUTHOR "Natasha aka Asdian"

#define CSW_DPS CSW_KNIFE
#define weapon_dps "weapon_knife"

#define v_model "models/v_dualsword.mdl"
#define p_model "models/p_dualsword_a.mdl"
#define p_model2 "models/p_dualsword_b.mdl"
#define spr_wpn    "knife_dualsword"

new const weapon_sound[][] =
{
    
"weapons/dualsword_stab1.wav",                // 0
    
"weapons/dualsword_stab2.wav",                // 1
    
"weapons/dualsword_stab1_hit.wav",            // 2
    
"weapons/dualsword_stab2_hit.wav",            // 3
    
"weapons/katanad_hitwall.wav",                // 4
    
    
"weapons/dualsword_slash_1.wav",            // 5
    
"weapons/dualsword_slash_2.wav",            // 6
    
"weapons/dualsword_slash_3.wav",            // 7
    
"weapons/dualsword_slash_4.wav",            // 8
    
"weapons/dualsword_hit1.wav",                // 9
    
"weapons/dualsword_hit2.wav",                // 10
    
"weapons/dualsword_hit3.wav",                // 11
    
"weapons/dualsword_slash_4_1.wav",            // 12
    
"weapons/dualsword_slash_4_2.wav",            // 13
    
"weapons/dualsword_skill_end.wav",            // 14
    
    
"weapons/dualsword_fly1.wav",                // 15
    
"weapons/dualsword_fly2.wav",                // 16
    
"weapons/dualsword_fly3.wav",                // 17
    
"weapons/dualsword_fly4.wav",                // 18
    
"weapons/dualsword_fly5.wav",                // 19
    
"weapons/dualsword_skill_start.wav"
}

//Hit
#define    RESULT_HIT_NONE             0
#define    RESULT_HIT_PLAYER            1
#define    RESULT_HIT_WORLD            2

enum _:WpnAnim
{
    
ANIM_IDLEA 0,
    
ANIM_SLASH1,
    
ANIM_SLASH2,
    
ANIM_SLASH3,
    
ANIM_SLASH4,
    
ANIM_SLASHEND,
    
ANIM_DRAWA,
    
ANIM_IDLEB,
    
ANIM_STAB1,
    
ANIM_STAB2,
    
ANIM_STABEND,
    
ANIM_DRAWB
}

new 
g_had_dps[33], g_mode[33], g_slashend[33], g_check[33], g_dpsg_soundmode[33]
new 
ef_sakura[4]
new 
Float:g_Sound[33]

new 
cvar_damage_slash[4], cvar_slash_radiuscvar_slash_range
new cvar_damage_stab[2], cvar_stab_radiuscvar_stab_range
new cvar_damage_specialcvar_special_range
new cvar_knockback[3], cvar_fast_attackcvar_removecvar_spr

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
    
register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
    
register_event("HLTV""Event_NewRound""a""1=0""2=0")
    
register_forward(FM_AddToFullPack"Fw_AddToFullPack_Post"1);

    
register_think("dps_entytyd""Fw_DPSEnt_Think")
    
    
RegisterHam(Ham_Item_PostFrameweapon_dps"fw_Item_PostFrame")
    
    
g_dps zp_register_extra_item("Dual Sword Phantom Slayer"0ZP_TEAM_HUMAN)
    
register_clcmd(spr_wpn"hook_rb")
    
    
cvar_damage_slash[0] = register_cvar("dps_slashdamage_4","486.0")
    
cvar_damage_slash[1] = register_cvar("dps_slashdamage_1","120.0")
    
cvar_damage_slash[2] = register_cvar("dps_slashdamage_2","140.0")
    
cvar_damage_slash[3] = register_cvar("dps_slashdamage_3","360.0")
    
cvar_slash_radius register_cvar("dps_slashradius","120.0")
    
cvar_slash_range register_cvar("dps_slashrange","95.0")
    
    
cvar_damage_stab[0] = register_cvar("dps_stabdamage_2","1200.0")
    
cvar_damage_stab[1] = register_cvar("dps_stabdamage_1","350.0")
    
cvar_stab_radius register_cvar("dps_stabradius","90.0")
    
cvar_stab_range register_cvar("dps_stabrange","150.0")
    
    
cvar_damage_special register_cvar("dps_specialdamage","95.0")
    
cvar_special_range register_cvar("dps_specialrange","120.0")
    
    
cvar_knockback[0] = register_cvar("dps_slashknockback","0.0")
    
cvar_knockback[1] = register_cvar("dps_stabknockback","0.0")
    
cvar_knockback[2] = register_cvar("dps_specialknockback","0.0")
    
    
cvar_fast_attack register_cvar("dps_fast_attack_enabled""0")
    
cvar_remove register_cvar("dps_remove_onnewround""0")
    
cvar_spr register_cvar("dps_enable_sprites""1")
    
    
g_dps zp_register_extra_item("Dual Sword Phantom Slayer"10ZP_TEAM_HUMAN)
}

public 
plugin_precache()
{
    
precache_model(v_model)
    
precache_model(p_model)
    
precache_model(p_model2)
    
    for(new 
0sizeof(weapon_sound); i++)
        
precache_sound(weapon_sound[i])
    
    
precache_model("models/dualswordfx.mdl")
    
precache_model("models/dualsword_skill.mdl")
    
precache_model("models/dualsword_skillfx1.mdl")
    
precache_model("models/dualsword_skillfx2.mdl")
    
    
ef_sakura[0] = precache_model("sprites/leaf01_dualsword.spr")
    
ef_sakura[1] = precache_model("sprites/leaf02_dualsword.spr")
    
ef_sakura[2] = precache_model("sprites/petal01_dualsword.spr")
    
ef_sakura[3] = precache_model("sprites/petal02_dualsword.spr")
    
    new 
Txt[32]
    
format(Txt31"sprites/%s.txt"spr_wpn)
    
engfunc(EngFunc_PrecacheGenericTxt)
}

public 
zp_extra_item_selected(id) if(== g_dpsget_dps(i)
public 
zp_user_infected_post(iremove_dps(i)
public 
zp_user_humanized_post(iremove_dps(i)

public 
hook_rb(id)
{
    
engclient_cmd(idweapon_dps)
    return 
PLUGIN_HANDLED
}

public 
get_dps(id)
{
    if (!
is_user_alive(id))
        return

    
g_had_dps[id] = 1
    g_mode
[id] = 0
    g_slashend
[id] = 0
    g_check
[id] = 0
    g_soundmode
[id] = 0
    
    fm_give_item
(idweapon_dps)
    
    if (
get_user_weapon(id) == CSW_DPSEvent_CurWeapon(id)
    else 
engclient_cmd(id,weapon_dps)
}

public 
client_connect(idremove_dps(id)
public 
client_disconnect(idremove_dps(id)

public 
Event_NewRound()
{
    if(!
get_pcvar_num(cvar_remove))
        return
    
    for(new 
0get_maxplayers(); i++)
        
remove_dps(i)
}

public 
remove_dps(id)
{
    
g_had_dps[id] = 0
    g_slashend
[id] = 0
    g_check
[id] = 0
    
    
static iEntiEnt fm_get_user_weapon_entity(idCSW_DPS)
    if(!
pev_valid(iEnt)) return
    
    
set_pev(iEntpev_iuser10)
    
set_pev(iEntpev_iuser20)
    
set_pev(iEntpev_iuser30)
    
set_pev(iEntpev_iuser40)
    
set_pev(iEntpev_fuser10.0)
}

public 
Event_CurWeapon(id)
{
    if(!
is_user_alive(id))
        return 
1
    
if(get_user_weapon(id) != CSW_DPS)
        return 
1
    
if(!g_had_dps[id])
        return 
1
    
if(zp_get_user_zombie(id))
        return 
1
        
    set_pev
(idpev_viewmodel2v_model)
    
set_pev(idpev_weaponmodel2g_mode[id] ? p_model2:p_model)
    
    
Set_WeaponAnim(idg_mode[id]?ANIM_DRAWA:ANIM_DRAWB)
    
    static 
iEntiEnt fm_get_user_weapon_entity(idCSW_DPS)
    if(!
pev_valid(iEnt)) return 1
    
    set_pev
(iEntpev_iuser10)
    
set_pev(iEntpev_iuser20)
    
set_pev(iEntpev_iuser30)
    
set_pev(iEntpev_iuser40)
    
set_pev(iEntpev_fuser10.0)
        
    
g_slashend[id] = 0
    g_check
[id] = 0
    
    set_pdata_float
(id830.23)
    
set_pdata_float(iEnt460.25);
    
set_pdata_float(iEnt470.25);
    
set_pdata_float(iEnt480.25);
    
    if(
get_pcvar_num(cvar_spr))
    {
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("WeaponList"), _id)
        
write_string(g_had_dps[id] == spr_wpn weapon_dps)
        
write_byte(-1)
        
write_byte(-1)
        
write_byte(-1)
        
write_byte(-1)
        
write_byte(2)
        
write_byte(1)
        
write_byte(CSW_DPS)
        
write_byte(0)
        
message_end()
    }
    return 
0
}

public 
message_DeathMsg(msg_idmsg_destmsg_ent)
{
    new 
szWeapon[64]
    
get_msg_arg_string(4szWeaponcharsmax(szWeapon))
    
    if (
strcmp(szWeapon"knife"))
        return 
PLUGIN_CONTINUE

    
new iEntity get_pdata_cbase(get_msg_arg_int(1), 373)
    if (!
pev_valid(iEntity) || get_pdata_int(iEntity434) != CSW_DPS || !g_had_dps[get_msg_arg_int(1)])
        return 
PLUGIN_CONTINUE

    set_msg_arg_string
(4"dualsword")
    return 
PLUGIN_CONTINUE
}

public 
Fw_AddToFullPack_Post(esStateiEiEntiHostiHostFlagsiPlayerpSet)
{
    if (!
pev_valid(iEnt))
        return;
    if (
pev(iEntpev_flags) & FL_KILLME
        return;

    new 
classname[32];
    
pev(iEntpev_classnameclassname31);

    if (
equal(classname,"dps_entytyd") && pev(iEntpev_iuser4))
    {
        if (
iHost != pev(iEntpev_owner))
            
set_es(esStateES_Effects, (get_es(esStateES_Effects) | EF_NODRAW));
    }
}

public 
Fw_DPSEnt_Think(iEnt)
{
    if(!
pev_valid(iEnt)) 
        return
    
    new 
iOwner
    iOwner 
pev(iEntpev_owner)
    
    if(!
is_user_alive(iOwner) || !is_user_connected(iOwner) || zp_get_user_zombie(iOwner))
    {
        
remove_entity(iEnt)
        
g_soundmode[iOwner] = 0
        
return
    }
    
    if(!
Get_Entity_Mode(iEnt))
    {
        new 
iWpn,iState,Float:vecOrigin[3], Float:vecAngle[3];
        
iWpn pev(iEntpev_iuser1)
        
iState pev(iWpnpev_iuser4)
        
Stock_Get_Postion(iOwner0.00.00.0vecOrigin);
        
        
pev(iOwnerpev_v_anglevecAngle);
        
vecAngle[0] = -vecAngle[0];
        
        
set_pev(iEntpev_originvecOrigin);
        
set_pev(iEntpev_anglesvecAngle);
        
        if(!
iState || get_user_weapon(iOwner) != CSW_DPS)
        {
            new 
Float:fRenderAmount;
            
pev(iEntpev_renderamtfRenderAmount);

            
fRenderAmount -= 4.5;

            if (
fRenderAmount <= 5.0)
            {
                
remove_entity(iEnt);
                return;
            }
            
set_pev(iEntpev_renderamtfRenderAmount);
        }
    }
    
    if(
Get_Entity_Mode(iEnt) == 1)
    {
        
set_pev(iEntpev_movetypeMOVETYPE_FLY)
    
        static 
Float:Origin[3]; pev(iOwnerpev_originOrigin)
        
Origin[2] -= 25.0
        
        Stock_Hook_Ent
(iEntOrigin0.01)
        
        if(
pev(iEntpev_fuser1) < get_gametime() || !IsAlive(iOwner))
        {
            
set_pev(iEntpev_flagspev(iEntpev_flags) | FL_KILLME)
            return
        }
            
        
set_pev(iEntpev_velocityFloat:{1.0,1.0,1.0});
        
set_pev(iEntpev_originOrigin);
    }
    
    if(
Get_Entity_Mode(iEnt) == 2)
    {
        new 
Float:vecOrigin[3]
        
GetGunPosition(iOwnervecOrigin);
        
        new 
Float:fOldOrigin[3];
        
pev(iEntpev_oldoriginfOldOrigin);
        
        new 
Float:vecNewOrigin[3];
        
pev(iEntpev_originvecNewOrigin);
        
        new 
Float:vecfff[3];
        
xs_vec_sub(vecOriginfOldOriginvecfff);
        
xs_vec_add(vecNewOriginvecfffvecNewOrigin);
        
        
set_pev(iEntpev_originvecNewOrigin);
        
set_pev(iEntpev_oldoriginvecOrigin);
        
        if (
pev(iEntpev_iuser1) == 2)
        {
            new 
Float:fDist get_distance_f(vecOriginvecNewOrigin);
            if (
fDist 175.0 0.5)
            {
                
remove_entity(iEnt);
                return;
            }
        }
        
        if(
g_Sound[iOwner] < get_gametime())
        {
            if(!
g_soundmode[iOwner]) emit_sound(iOwnerCHAN_ITEMweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            if(
g_soundmode[iOwner] == 1emit_sound(iOwnerCHAN_BODYweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            if(
g_soundmode[iOwner] == 2emit_sound(iOwnerCHAN_VOICEweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            if(
g_soundmode[iOwner] == 3emit_sound(iOwnerCHAN_WEAPONweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            
            
g_soundmode[iOwner]++
            if(
g_soundmode[iOwner] > 3g_soundmode[iOwner] = 0
            
            g_Sound
[iOwner] = get_gametime()+0.088;
        }
    }
    
set_pev(iEntpev_nextthinkget_gametime() + 0.01)
    
    if(
Get_Entity_Mode(iEnt) == 2)
    {
        new 
Float:fTimeLast;
        
pev(iEntpev_fuser1fTimeLast);
        
        if (
fTimeLast get_gametime() || pev(pev(iEntpev_iuser2), pev_fuser1) < get_gametime())
        {
            if (
pev(iEntpev_iuser1) == 1)
            {
                new 
Float:fRenderAmount;
                
pev(iEntpev_renderamtfRenderAmount);
                
fRenderAmount -= 7.5;
                
                if (
fRenderAmount <= 5.0)
                {
                    
remove_entity(iEnt);
                    return;
                }
                
set_pev(iEntpev_renderamtfRenderAmount);
            } else 
remove_entity(iEnt);
            
            
g_soundmode[iOwner] = 0
        
}
    }
}

public 
fw_Item_PostFrame(ent)
{
    new 
id pev(entpev_owner)
    
    if(!
is_user_connected(id))
        return 
HAM_IGNORED
    
if(get_user_weapon(id) != CSW_DPS || !g_had_dps[id])
        return 
HAM_IGNORED

    
if(get_pdata_float(ent484) <= 0.01 && (!pev(entpev_iuser2) || !g_slashend[id]))
    {
        if(
g_check[id] < 6g_check[id] = 0
        set_pev
(entpev_iuser30)
        
Set_WeaponAnim(idg_mode[id]?ANIM_IDLEA:ANIM_IDLEB)
        
set_pdata_float(ent484.034)
    }
    
    new 
iButton pev(id,pev_button)
    return 
AurezBotac(identiButton)
}

public 
AurezBotac(idiEntiButton)
{
    new 
iState pev(iEntpev_iuser3)
    new 
iState2 pev(iEntpev_iuser2)
    new 
iSlash pev(iEntpev_iuser4)
    new 
Float:fSoundpev(iEntpev_fuser1fSound)
    new 
Float:fRange get_pcvar_float(g_mode[id] ? cvar_slash_range cvar_stab_range)
    
    if(!(
iButton IN_ATTACK) && get_pdata_float(iEnt46,4) <= 0.0 && iState2)
    {
        if(!
iState || iState == 1)
        {
            
Set_WeaponAnim(idANIM_STABEND)
            
set_pev(iEntpev_iuser20)
            
set_pdata_float(iEnt481.45,4)
        }
    }
    
    if(!(
iButton IN_ATTACK2) && get_pdata_float(iEnt47,4) <= 0.0 && g_slashend[id])
    {
        
Set_WeaponAnim(idANIM_SLASHEND)
        
set_pdata_float(iEnt482.03,4)
        
g_slashend[id] = 0
    
}
    
    if (
get_pdata_float(id83) <= 0.0 && pev(iEntpev_iuser1))
    {
        new 
Float:fAngle get_pcvar_float(g_mode[id] ? cvar_slash_radius cvar_stab_radius)
        new 
Float:fDamage get_pcvar_float(g_mode[id] ? cvar_damage_slash[iSlash] : cvar_damage_stab[iState])
        
        new 
iHitResult KnifeAttack_Global(idtruefRangefAnglefDamageget_pcvar_float(cvar_knockback[1+g_mode[id]]))
        switch (
iHitResult)
        {
            case 
RESULT_HIT_PLAYER client_cmd(id"spk %s"weapon_sound[g_mode[id]?random_num(9,11):iState+2]) 
            case 
RESULT_HIT_WORLD client_cmd(id"spk %s"weapon_sound[4])
        }
        
set_pev(iEntpev_iuser10);
    }
    
    if(
get_pdata_float(iEnt47,4) <= 0.0 && iSlash && iSlash <= 4)
    {
        
set_pev(iEntpev_iuser4iSlash)
        
Set_WeaponAnim(idiSlash)
        
        
set_pdata_float(id830.06)
        
        if(!
get_pcvar_num(cvar_fast_attack)) 
            
set_pdata_float(iEnt46iSlash == ? (g_check[id] == 0.43 0.7) : 0.13,4);
        
        
set_pdata_float(iEnt47iSlash == ? (g_check[id] == 0.43 0.7) : 0.13,4);
        
set_pdata_float(iEnt48iSlash == 1.4 1.0,4);
          
        
set_pev(iEntpev_iuser11)
        
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
        
SendSound(idCHAN_WEAPONweapon_sound[iSlash])
        
Create_Slash(id,iEnt,iSlash)
        
        if(
iSlash == 3
        {
            
g_slashend[id] = 1
            
            set_pev
(iEntpev_fuser1get_gametime() + (g_check[id] == 0.43 0.5))
            
set_pev(iEntpev_iuser40)
        }
    }
    
    if(
fSound && fSound get_gametime())
    {
        
SendSound(id,CHAN_VOICE,weapon_sound[g_check[id] == 13 12])
        
set_pev(iEntpev_fuser10.0)
        
        if(
g_check[id] == 5
        {
            
Set_WeaponAnim(id14)
            
SendSound(id,CHAN_ITEM,weapon_sound[20])
            
g_check[id] = 6
            
            set_pdata_float
(iEnt461.03,4)
            
set_pdata_float(iEnt471.03,4)
            
set_pdata_float(iEnt481.03,4)
            
            
set_pev(iEntpev_fuser4get_gametime()+1.7);
            
DPS_Special(id02.0)
        }
    }
    
    if(
g_check[id] == && get_pdata_float(iEnt46,4) <= 0.0)
    {
        
set_pdata_float(iEnt4611.36,4)
        
set_pdata_float(iEnt4711.36,4)
        
set_pdata_float(iEnt4811.36,4)
        
        
g_check[id] = 7
        set_pev
(iEntpev_fuser1get_gametime() + 10.6)
        
Set_WeaponAnim(id15)
    }
    
    
// NANI?!
    
if(g_check[id] == && fSound && fSound get_gametime())
    {
        
SendSound(id,CHAN_VOICE,weapon_sound[14])
        
set_pev(iEntpev_fuser10.0)
        
g_check[id] = 0
        
        DPS_Special
(id11.46)
    }
    
    
DPS_RealSpecial(idiEntfRange)
    
    if(
iButton IN_ATTACK && get_pdata_float(iEnt46,4) <= 0.0)
    {
        
g_mode[id] = 0
        g_slashend
[id] = 0
        
        set_pev
(iEntpev_iuser21)
        
set_pev(iEntpev_iuser40)
        
        switch(
iState)
        {
            case 
0:
            {
                
set_pdata_float(id830.16)
                
set_pdata_float(iEnt460.4,4);
                
                if(!
get_pcvar_num(cvar_fast_attack)) 
                    
set_pdata_float(iEnt470.4,4);
                    
                
set_pdata_float(iEnt481.0,4);
                
                
set_pev(iEntpev_iuser11)
                
set_pev(iEntpev_iuser31)
                
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
                
                
Set_WeaponAnim(idANIM_STAB1)
                
SendSound(idCHAN_WEAPONweapon_sound[0])
                
                if(!
g_check[id]) g_check[id] = 1
                
else if(g_check[id] == 2g_check[id] = 3
                
else g_check[id] = 0
            
}
            case 
1:
            {
                
set_pdata_float(id830.16)
                
set_pdata_float(iEnt460.83,4);
                
                if(!
get_pcvar_num(cvar_fast_attack)) 
                    
set_pdata_float(iEnt470.83,4);
                
                
set_pdata_float(iEnt481.5,4);
                
                
set_pev(iEntpev_iuser11)
                
set_pev(iEntpev_iuser30)
                
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
                
                
Set_WeaponAnim(idANIM_STAB2)
                
SendSound(idCHAN_WEAPONweapon_sound[1])
                
                if(
g_check[id] == 3g_check[id] = 4
                
else g_check[id] = 0
            
}
        }
    }
    
    if(
iButton IN_ATTACK2 && get_pdata_float(iEnt47) <= 0.0 && !iSlash)
    {
        
g_mode[id] = 1
        
        set_pdata_float
(id830.04)
        
        if(!
get_pcvar_num(cvar_fast_attack)) 
            
set_pdata_float(iEnt460.13,4);
        
        
set_pdata_float(iEnt470.13,4);
        
set_pdata_float(iEnt480.5,4);
        
        
set_pev(iEntpev_iuser11)
        
set_pev(iEntpev_iuser20)
        
set_pev(iEntpev_iuser30)
        
set_pev(iEntpev_iuser41)
        
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
        
        
Set_WeaponAnim(idANIM_SLASH1)
        
SendSound(idCHAN_WEAPONweapon_sound[5])
        
        
Create_Slash(id,iEnt,0)
        
        if(
g_check[id] == 1g_check[id] = 2
        
else if(g_check[id] == 4g_check[id] = 5
        
else g_check[id] = 0
    
}
    
    
iButton &= ~IN_ATTACK;
    
iButton &= ~IN_ATTACK2;
    
set_pev(idpev_buttoniButton);
    return 
HAM_IGNORED
}

stock Create_Slash(id,iEnt,seq)
{
    new 
Float:vecOrigin[3], Float:vecAngle[3];
    
GetGunPosition(idvecOrigin);
    
pev(idpev_v_anglevecAngle);
    
vecAngle[0] = -vecAngle[0];
    
    new 
pEntity DPS_Entites(id,"models/dualswordfx.mdl",vecOrigin,vecOrigin,0.01,SOLID_NOT,seq)
        
    
// Set info for ent    
    
Set_Entity_Mode(pEntity0)
    
set_pev(pEntitypev_scale0.1);
    
set_pev(pEntitypev_iuser1iEnt);
    
set_pev(pEntitypev_velocityFloat:{0.01,0.01,0.01});
    
set_pev(pEntitypev_anglesvecAngle);
    
set_pev(pEntitypev_nextthinkget_gametime()+0.01);
}

stock DPS_Special(idseqFloat:fTime)
{
    new 
Float:VecOrig[3], Float:VecAng[3]
    
pev(idpev_originVecOrig)
    
pev(idpev_anglesVecAng)
    
    new 
iEfx engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
set_pev(iEfxpev_classname"dps_entytyd");
    
set_pev(iEfxpev_originVecOrig)
    
set_pev(iEfxpev_frame0.0)
    
set_pev(iEfxpev_animtimeget_gametime())
    
set_pev(iEfxpev_framerate1.0)
    
set_pev(iEfxpev_sequenceseq)
    
engfunc(EngFunc_SetModeliEfx"models/dualsword_skill.mdl")
    
dllfunc(DLLFunc_SpawniEfx)
    
Set_Entity_Mode(iEfx1)
    
set_pev(iEfxpev_anglesVecAng)
    
set_pev(iEfxpev_solidSOLID_NOT)
    
set_pev(iEfxpev_ownerid)
    
set_pev(iEfxpev_velocityFloat:{0.01,0.01,0.01});
    
set_pev(iEfxpev_fuser1get_gametime() + fTime)
    
set_pev(iEfxpev_nextthinkget_gametime() + 0.01)
}

stock DPS_RealSpecial(idiEntFloat:fRange)
{
    new 
Float:fTimeEffect;
    
pev(iEntpev_fuser4fTimeEffect);
    
    if (
g_check[id] == && fTimeEffect && fTimeEffect <= get_gametime())
    {
        
KnifeAttack_Global(idfalseget_pcvar_float(cvar_special_range)*2.0180.0get_pcvar_float(cvar_damage_special), get_pcvar_float(cvar_knockback[2]))
            
        new 
Float:vecOrigin3[2][3], Float:vecOrigin[3];
        
pev(idpev_originvecOrigin3[0]);
        
pev(idpev_originvecOrigin);
        
xs_vec_copy(vecOrigin3[0], vecOrigin3[1]);
        
        new 
Float:fFloat random_float(fRange * -0.85fRange 0.85);
        
vecOrigin3[0][2] = vecOrigin3[1][2] = vecOrigin3[0][2] + random_float(-5.065.0);
        
        switch (
random(3))
        {
            case 
0:
            {
                
vecOrigin3[0][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] += fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] -= fFloat*random_float(-1.01.0);
            }
            case 
1:
            {
                
vecOrigin3[0][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] -= fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] += fFloat*random_float(-1.01.0);
            }
            case 
2:
            {
                
vecOrigin3[0][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] += fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] -= fFloat*random_float(-1.01.0);
            }
            case 
3:
            {
                
vecOrigin3[0][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] -= fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] += fFloat*random_float(-1.01.0);
            }
        }
        
        if (
random_num(0,9) > 8)
        {
            new 
Float:vecAngle2[3];
            
vecAngle2[0] = random_num(0,1) ? random_float(-30.0, -15.0) : random_float(15.030.0);
            
vecAngle2[1] = random_num(0,1) ? random_float(-180.00.0) : random_float(0.0180.0);
            
            new 
pEntity DPS_Entites(id,"models/dualsword_skillfx1.mdl",vecOrigin3[0],vecOrigin3[0],0.01,SOLID_NOT,0)    
            
set_pev(pEntitypev_anglesvecAngle2);
            
set_pev(pEntitypev_velocityFloat:{0.01,0.01,0.01});
            
set_pev(pEntitypev_iuser11);
            
set_pev(pEntitypev_iuser2iEnt);
            
set_pev(pEntitypev_frame0.0);
            
Set_Entity_Mode(pEntity2)
            
set_pev(pEntitypev_fuser1get_gametime()+0.53);
            
set_pev(pEntitypev_fuser2get_gametime()+0.5);
            
set_pev(pEntitypev_fuser3get_gametime()+0.31);
            
set_pev(pEntitypev_oldoriginvecOrigin);
            
set_pev(pEntitypev_nextthinkget_gametime()+0.01);
        }
        
        new 
pEntity DPS_Entites(id,"models/dualsword_skillfx2.mdl",vecOrigin3[0],vecOrigin3[1],500.0,SOLID_TRIGGER,0)    
        
set_pev(pEntitypev_iuser12);
        
set_pev(pEntitypev_iuser2iEnt);
        
Set_Entity_Mode(pEntity2)
        
set_pev(pEntitypev_frame0.0);
        
set_pev(pEntitypev_oldoriginvecOrigin);
        
set_pev(pEntitypev_fuser1get_gametime()+0.2);
        
set_pev(pEntitypev_fuser2get_gametime()+0.5);
        
set_pev(pEntitypev_fuser3get_gametime()+0.3);
        
set_pev(pEntitypev_nextthinkget_gametime()+0.01);
        
        
set_pev(iEntpev_fuser4get_gametime()+0.05);
    }
}

stock DPS_Entites(idmodels[], Float:Start[3], Float:End[3], Float:speedsolidseqmove=MOVETYPE_FLY)
{
    new 
pEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
        
    
// Set info for ent    
    
set_pev(pEntitypev_movetypemove);
    
set_pev(pEntitypev_ownerid);
    
engfunc(EngFunc_SetModelpEntitymodels);
    
set_pev(pEntitypev_classname"dps_entytyd");
    
set_pev(pEntitypev_minsFloat:{-1.0, -1.0, -1.0});
    
set_pev(pEntitypev_maxsFloat:{1.01.01.0});
    
set_pev(pEntitypev_originStart);
    
set_pev(pEntitypev_gravity0.01);
    
set_pev(pEntitypev_solidsolid);
    
    static 
Float:Velocity[3];
    
Stock_Get_Speed_Vector(StartEndspeedVelocity);
    
set_pev(pEntitypev_velocityVelocity);

    new 
Float:vecVAngle[3]; pev(idpev_v_anglevecVAngle);
    
vector_to_angle(VelocityvecVAngle)
    
    if(
vecVAngle[0] > 90.0vecVAngle[0] = -(360.0 vecVAngle[0]);
    
set_pev(pEntitypev_anglesvecVAngle);
    
    
set_pev(pEntitypev_rendermodekRenderTransAdd);
    
set_pev(pEntitypev_renderamt255.0);
    
set_pev(pEntitypev_sequenceseq)
    
set_pev(pEntitypev_animtimeget_gametime());
    
set_pev(pEntitypev_framerate1.0)
    return 
pEntity;
}

stock Set_Entity_Mode(iEntmodeset_pev(iEntpev_iuser3mode)
stock Get_Entity_Mode(iEnt) return pev(iEnt,pev_iuser3)

stock SendSound(idchansample[]) emit_sound(idchansampleVOL_NORMATTN_NORM0PITCH_NORM)

stock Stock_Get_Speed_Vector(const Float:origin1[3],const Float:origin2[3],Float:speedFloat:new_velocity[3])
{
    
xs_vec_sub(origin2origin1new_velocity)
    new 
Float:num floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
    
xs_vec_mul_scalar(new_velocitynumnew_velocity)
}
stock GetGunPosition(idFloat:vecSrc[3])
{
    new 
Float:vecViewOfs[3];
    
pev(idpev_originvecSrc);
    
pev(idpev_view_ofsvecViewOfs);
    
xs_vec_add(vecSrcvecViewOfsvecSrc);
}
stock KnifeAttack_Global(idbStabFloat:flRangeFloat:fAngleFloat:flDamageFloat:flKnockBack)
{
    new 
iHitResult
    
if(fAngle 0.0iHitResult KnifeAttack2(idbStabFloat:flRangeFloat:fAngleFloat:flDamageFloat:flKnockBack)
    else 
iHitResult KnifeAttack(idbStabFloat:flRangeFloat:flDamageFloat:flKnockBack)

    return 
iHitResult
}

stock KnifeAttack(idbStabFloat:flRangeFloat:flDamageFloat:flKnockBackiHitgroup = -1bitsDamageType DMG_NEVERGIB DMG_CLUB)
{
    new 
Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
    
GetGunPosition(idvecSrc);

    
pev(idpev_v_anglev_angle);
    
engfunc(EngFunc_MakeVectorsv_angle);

    
global_get(glb_v_forwardvecForward);
    
xs_vec_mul_scalar(vecForwardflRangevecForward);
    
xs_vec_add(vecSrcvecForwardvecEnd);

    new 
tr create_tr2();
    
engfunc(EngFunc_TraceLinevecSrcvecEnd0idtr);

    new 
Float:flFractionget_tr2(trTR_flFractionflFraction);
    if (
flFraction >= 1.0engfunc(EngFunc_TraceHullvecSrcvecEnd03idtr);
    
    
get_tr2(trTR_flFractionflFraction);

    new 
iHitResult RESULT_HIT_NONE;
    
    if (
flFraction 1.0)
    {
        new 
pEntity get_tr2(trTR_pHit);
        
iHitResult RESULT_HIT_WORLD;
        
        if (
pev_valid(pEntity) && (IsPlayer(pEntity) || IsHostage(pEntity)))
        {
            if (
CheckBack(idpEntity) && bStab && iHitgroup == -1)
                
flDamage *= 1.0;

            
iHitResult RESULT_HIT_PLAYER;
        }

        if (
pev_valid(pEntity))
        {
            
engfunc(EngFunc_MakeVectorsv_angle);
            
global_get(glb_v_forwardvecForward);

            if (
iHitgroup != -1)
                
set_tr2(trTR_iHitgroupiHitgroup);

            
ExecuteHamB(Ham_TraceAttackpEntityidflDamagevecForwardtrbitsDamageType);
            
ExecuteHamB(Ham_TakeDamagepEntityididflDamagebitsDamageType)
            
Stock_Fake_KnockBack(idpEntityflKnockBack)
            
            if (
IsAlive(pEntity))
            {
                
free_tr2(tr);
                return 
iHitResult;
            }
        }
    }
    
free_tr2(tr);
    return 
iHitResult;
}

stock KnifeAttack2(idbStabFloat:flRangeFloat:fAngleFloat:flDamageFloat:flKnockBackiHitgroup = -1bNoTraceCheck 0)
{
    new 
Float:vecOrigin[3], Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
    
pev(idpev_originvecOrigin);

    new 
iHitResult RESULT_HIT_NONE;
    
GetGunPosition(idvecSrc);

    
pev(idpev_v_anglev_angle);
    
engfunc(EngFunc_MakeVectorsv_angle);

    
global_get(glb_v_forwardvecForward);
    
xs_vec_mul_scalar(vecForwardflRangevecForward);
    
xs_vec_add(vecSrcvecForwardvecEnd);

    new 
tr create_tr2();
    
engfunc(EngFunc_TraceLinevecSrcvecEnd0idtr);
    
    new 
Float:EndPos2[3]
    
get_tr2(trTR_vecEndPosEndPos2)
    
    new 
Float:flFractionget_tr2(trTR_flFractionflFraction);
    if (
flFraction 1.0
    {
        
iHitResult RESULT_HIT_WORLD;
        if(
bStabStock_SakuraEffect(idEndPos2)
    }
    
    new 
Float:vecEndZ vecEnd[2];
    
    new 
pEntity = -1;
    while ((
pEntity engfunc(EngFunc_FindEntityInSpherepEntityvecOriginflRange)) != 0)
    {
        if (!
pev_valid(pEntity))
            continue;
        if (
id == pEntity)
            continue;
        if (!
IsAlive(pEntity))
            continue;
        if (!
CheckAngle(idpEntityfAngle))
            continue;

        
GetGunPosition(idvecSrc);
        
Stock_Get_Origin(pEntityvecEnd);

        
vecEnd[2] = vecSrc[2] + (vecEndZ vecSrc[2]) * (get_distance_f(vecSrcvecEnd) / flRange);

        
xs_vec_sub(vecEndvecSrcvecForward);
        
xs_vec_normalize(vecForwardvecForward);
        
xs_vec_mul_scalar(vecForwardflRangevecForward);
        
xs_vec_add(vecSrcvecForwardvecEnd);

        
engfunc(EngFunc_TraceLinevecSrcvecEnd0idtr);
        
get_tr2(trTR_flFractionflFraction);

        if (
flFraction >= 1.0engfunc(EngFunc_TraceHullvecSrcvecEnd03idtr);
        
get_tr2(trTR_flFractionflFraction);

        if (
flFraction 1.0)
        {
            if (
IsPlayer(pEntity) || IsHostage(pEntity))
            {
                
iHitResult RESULT_HIT_PLAYER;
                if(
bStabStock_SakuraEffect(idvecEnd)
                
                if (
CheckBack(idpEntity) && bStab && iHitgroup == -1)
                    
flDamage *= 1.0;
            }

            if (
get_tr2(trTR_pHit) == pEntity || bNoTraceCheck)
            {
                
engfunc(EngFunc_MakeVectorsv_angle);
                
global_get(glb_v_forwardvecForward);

                if (
iHitgroup != -1set_tr2(trTR_iHitgroupiHitgroup);

                
ExecuteHamB(Ham_TraceAttackpEntityidflDamagevecForwardtrDMG_NEVERGIB DMG_CLUB);
                
ExecuteHamB(Ham_TakeDamagepEntityididflDamageDMG_NEVERGIB DMG_CLUB)
                
                
Stock_Fake_KnockBack(idpEntityflKnockBack)
            }
        }
        
free_tr2(tr);
    }
    return 
iHitResult;
}

stock Set_WeaponAnim(idanim)
{
    
set_pev(idpev_weaponanimanim)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, {000}, id)
    
write_byte(anim)
    
write_byte(pev(idpev_body))
    
message_end()
}

stock Stock_Set_Vis(iEntiVis 1)
    
set_pev(iEntpev_effectsiVis == pev(iEntpev_effects) & ~EF_NODRAW pev(iEntpev_effects) | EF_NODRAW)

stock Stock_Hook_Ent(entFloat:TargetOrigin[3], Float:Speedmode=0)
{
    static 
Float:fl_Velocity[3],Float:EntOrigin[3],Float:distance_f,Float:fl_Time
    pev
(entpev_originEntOrigin)
    
    if(!
mode)
    {
        
distance_f get_distance_f(EntOriginTargetOrigin)
        
fl_Time distance_f Speed
            
        pev
(entpev_velocityfl_Velocity)
            
        
fl_Velocity[0] = (TargetOrigin[0] - EntOrigin[0]) / fl_Time
        fl_Velocity
[1] = (TargetOrigin[1] - EntOrigin[1]) / fl_Time
        fl_Velocity
[2] = (TargetOrigin[2] - EntOrigin[2]) / fl_Time

        
if(vector_length(fl_Velocity) > 1.0set_pev(entpev_velocityfl_Velocity)
        else 
set_pev(entpev_velocityFloat:{0.010.010.01})
    } else {
        static 
Float:fl_EntVelocity[3], Float:fl_Acc[3]
        
Stock_Directed_Vector(TargetOriginEntOriginfl_Velocity)
        
xs_vec_mul_scalar(fl_VelocitySpeedfl_Velocity)
        
        for(new 
=0i<3i++)
        {
            if(
fl_Velocity[i] > fl_EntVelocity[i]) 
            {
                
fl_Acc[i] = fl_Velocity[i]-fl_EntVelocity[i]
                
fl_Acc[i] = floatmin(70.0fl_Acc[i])
                
fl_EntVelocity[i] += fl_Acc[i]
            }
            else if(
fl_Velocity[i] < fl_EntVelocity[i])
            {
                
fl_Acc[i] = fl_EntVelocity[i]-fl_Velocity[i]
                
fl_Acc[i] = floatmin(70.0fl_Acc[i])
                
fl_EntVelocity[i] -= fl_Acc[i]
            }
        }
        
set_pev(entpev_velocityfl_EntVelocity)
    }
}

stock Stock_Directed_Vector(Float:start[3],Float:end[3],Float:reOri[3])
{    
    new 
Float:v3[3],i
    
for(i=0;i<3;i++) v3[i]=start[i]-end[i]

    new 
Float:vl vector_length(v3)
    for(
i=0;i<3;i++) reOri[i] = v3[i] / vl
}

stock Stock_Get_Postion(id,Float:forw,Float:right,Float:up,Float:vStart[])
{
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
pev(idpev_originvOrigin)
    
pev(idpev_view_ofs,vUp)
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(idpev_v_anglevAngle)
    
    
engfunc(EngFunc_AngleVectorsvAnglevForwardvRightvUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up
}

stock IsPlayer(pEntity) return is_user_connected(pEntity)

stock IsHostage(pEntity)
{
    new 
classname[32]; pev(pEntitypev_classnameclassnamecharsmax(classname))
    return 
equal(classname"hostage_entity")
}

stock IsAlive(pEntity)
{
    if (
pEntity 1) return 0
    
return (pev(pEntitypev_deadflag) == DEAD_NO && pev(pEntitypev_health) > 0)
}

stock CheckBack(iEnemy,id)
{
    new 
Float:anglea[3], Float:anglev[3]
    
pev(iEnemypev_v_angleanglea)
    
pev(idpev_v_angleanglev)
    new 
Float:angle anglea[1] - anglev[1
    if (
angle < -180.0angle += 360.0
    
if (angle <= 45.0 && angle >= -45.0) return 1
    
return 0
}

stock CheckAngle(iAttackeriVictimFloat:fAngle)  return(Stock_CheckAngle(iAttackeriVictim) > floatcos(fAngle,degrees))

stock Float:Stock_CheckAngle(id,iTarget)
{
    new 
Float:vOricross[2],Float:fRad,Float:vId_ori[3],Float:vTar_ori[3],Float:vId_ang[3],Float:fLength,Float:vForward[3]
    
Stock_Get_Origin(idvId_ori)
    
Stock_Get_Origin(iTargetvTar_ori)
    
    
pev(id,pev_angles,vId_ang)
    for(new 
i=0;i<2;i++) vOricross[i] = vTar_ori[i] - vId_ori[i]
    
    
fLength floatsqroot(vOricross[0]*vOricross[0] + vOricross[1]*vOricross[1])
    
    if (
fLength<=0.0)
    {
        
vOricross[0]=0.0
        vOricross
[1]=0.0
    
} else {
        
vOricross[0]=vOricross[0]*(1.0/fLength)
        
vOricross[1]=vOricross[1]*(1.0/fLength)
    }
    
    
engfunc(EngFunc_MakeVectors,vId_ang)
    
global_get(glb_v_forward,vForward)
    
    
fRad vOricross[0]*vForward[0]+vOricross[1]*vForward[1]
    return 
fRad   //->   RAD 90' = 0.5rad
}

stock Stock_Get_Origin(idFloat:origin[3])
{
    new 
Float:maxs[3],Float:mins[3]
    if (
pev(idpev_solid) == SOLID_BSP)
    {
        
pev(id,pev_maxs,maxs)
        
pev(id,pev_mins,mins)
        
origin[0] = (maxs[0] - mins[0]) / mins[0]
        
origin[1] = (maxs[1] - mins[1]) / mins[1]
        
origin[2] = (maxs[2] - mins[2]) / mins[2]
    } else 
pev(idpev_originorigin)
}

public 
Stock_Fake_KnockBack(idiVicFloat:iKb)
{
    if(
iVic 32) return
    
    new 
Float:vAttacker[3], Float:vVictim[3], Float:vVelocity[3], flags
    pev
(idpev_originvAttacker)
    
pev(iVicpev_originvVictim)
    
vAttacker[2] = vVictim[2] = 0.0
    flags 
pev(idpev_flags)
    
    
xs_vec_sub(vVictimvAttackervVictim)
    new 
Float:fDistance
    fDistance 
xs_vec_len(vVictim)
    
xs_vec_mul_scalar(vVictimfDistancevVictim)
    
    
pev(iVicpev_velocityvVelocity)
    
xs_vec_mul_scalar(vVictimiKbvVictim)
    
xs_vec_mul_scalar(vVictim50.0vVictim)
    
vVictim[2] = xs_vec_len(vVictim) * 0.15
    
    
if(flags &~ FL_ONGROUND)
    {
        
xs_vec_mul_scalar(vVictim1.2vVictim)
        
vVictim[2] *= 0.4
    
}
    if(
xs_vec_len(vVictim) > xs_vec_len(vVelocity)) set_pev(iVicpev_velocityvVictim)
}    

stock Float:Stock_Get_Body_Dmg(iBody)
{
    switch (
iBody)
    {
        case 
HIT_GENERIC: return 0.75
        
case 1: return 4.0
        
case 2: return 1.0
        
case 3: return 1.25
        
case 4,5,6,7: return 0.75
        
default: return 0.75
    
}
    return 
1.0
}

stock Stock_SakuraEffect(idFloat:vecOri[3])
{
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYvecOri)
    
write_byte(TE_BLOODSPRITE)
    
engfunc(EngFunc_WriteCoord,vecOri[0])
    
engfunc(EngFunc_WriteCoord,vecOri[1])
    
engfunc(EngFunc_WriteCoord,vecOri[2])
    
write_short(ef_sakura[g_mode[id]?2:0])
    
write_short(ef_sakura[g_mode[id]?3:1])
    
write_byte(g_mode[id]?178:128)
    
write_byte(random_num(2,3))
    
message_end()
}

stock can_damage(id1id2)
{
    if(
id1 <= || id1 >= 33 || id2 <= || id2 >= 33)
        return 
1
        
    
// Check team
    
return(get_pdata_int(id1114) != get_pdata_int(id2114))
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
----------------------------------------------------------------------------------------------------------------

Last edited by mohanad; 06-24-2020 at 17:21.
mohanad is offline
Mankled
Member
Join Date: Oct 2019
Old 06-25-2020 , 04:59   Re: Help on Plugin plz
Reply With Quote #2

i didnt test, so try it

PHP Code:
#pragma compress 1

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <xs>
#include <zombieplague>

#define PLUGIN "CSO Dual Sword Phantom Slayer"
#define VERSION "1.0"
#define AUTHOR "Natasha aka Asdian"

#define CSW_DPS CSW_KNIFE
#define weapon_dps "weapon_knife"

#define v_model "models/v_dualsword.mdl"
#define p_model "models/p_dualsword_a.mdl"
#define p_model2 "models/p_dualsword_b.mdl"
#define spr_wpn    "knife_dualsword"

new const weapon_sound[][] =
{
    
"weapons/dualsword_stab1.wav",                // 0
    
"weapons/dualsword_stab2.wav",                // 1
    
"weapons/dualsword_stab1_hit.wav",            // 2
    
"weapons/dualsword_stab2_hit.wav",            // 3
    
"weapons/katanad_hitwall.wav",                // 4
    
    
"weapons/dualsword_slash_1.wav",            // 5
    
"weapons/dualsword_slash_2.wav",            // 6
    
"weapons/dualsword_slash_3.wav",            // 7
    
"weapons/dualsword_slash_4.wav",            // 8
    
"weapons/dualsword_hit1.wav",                // 9
    
"weapons/dualsword_hit2.wav",                // 10
    
"weapons/dualsword_hit3.wav",                // 11
    
"weapons/dualsword_slash_4_1.wav",            // 12
    
"weapons/dualsword_slash_4_2.wav",            // 13
    
"weapons/dualsword_skill_end.wav",            // 14
    
    
"weapons/dualsword_fly1.wav",                // 15
    
"weapons/dualsword_fly2.wav",                // 16
    
"weapons/dualsword_fly3.wav",                // 17
    
"weapons/dualsword_fly4.wav",                // 18
    
"weapons/dualsword_fly5.wav",                // 19
    
"weapons/dualsword_skill_start.wav"
}

//Hit
#define    RESULT_HIT_NONE             0
#define    RESULT_HIT_PLAYER            1
#define    RESULT_HIT_WORLD            2

enum _:WpnAnim
{
    
ANIM_IDLEA 0,
    
ANIM_SLASH1,
    
ANIM_SLASH2,
    
ANIM_SLASH3,
    
ANIM_SLASH4,
    
ANIM_SLASHEND,
    
ANIM_DRAWA,
    
ANIM_IDLEB,
    
ANIM_STAB1,
    
ANIM_STAB2,
    
ANIM_STABEND,
    
ANIM_DRAWB
}

new 
g_had_dps[33], g_mode[33], g_slashend[33], g_check[33], g_dpsg_soundmode[33]
new 
ef_sakura[4]
new 
Float:g_Sound[33]

new 
cvar_damage_slash[4], cvar_slash_radiuscvar_slash_range
new cvar_damage_stab[2], cvar_stab_radiuscvar_stab_range
new cvar_damage_specialcvar_special_range
new cvar_knockback[3], cvar_fast_attackcvar_removecvar_spr

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
    
register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
    
register_event("HLTV""Event_NewRound""a""1=0""2=0")
    
register_forward(FM_AddToFullPack"Fw_AddToFullPack_Post"1);

    
register_think("dps_entytyd""Fw_DPSEnt_Think")
    
    
RegisterHam(Ham_Item_PostFrameweapon_dps"fw_Item_PostFrame")
    
    
g_dps zp_register_extra_item("Dual Sword Phantom Slayer"0ZP_TEAM_HUMAN)
    
register_clcmd(spr_wpn"hook_rb")
    
    
cvar_damage_slash[0] = register_cvar("dps_slashdamage_4","486.0")
    
cvar_damage_slash[1] = register_cvar("dps_slashdamage_1","120.0")
    
cvar_damage_slash[2] = register_cvar("dps_slashdamage_2","140.0")
    
cvar_damage_slash[3] = register_cvar("dps_slashdamage_3","360.0")
    
cvar_slash_radius register_cvar("dps_slashradius","120.0")
    
cvar_slash_range register_cvar("dps_slashrange","95.0")
    
    
cvar_damage_stab[0] = register_cvar("dps_stabdamage_2","1200.0")
    
cvar_damage_stab[1] = register_cvar("dps_stabdamage_1","350.0")
    
cvar_stab_radius register_cvar("dps_stabradius","90.0")
    
cvar_stab_range register_cvar("dps_stabrange","150.0")
    
    
cvar_damage_special register_cvar("dps_specialdamage","95.0")
    
cvar_special_range register_cvar("dps_specialrange","120.0")
    
    
cvar_knockback[0] = register_cvar("dps_slashknockback","0.0")
    
cvar_knockback[1] = register_cvar("dps_stabknockback","0.0")
    
cvar_knockback[2] = register_cvar("dps_specialknockback","0.0")
    
    
cvar_fast_attack register_cvar("dps_fast_attack_enabled""0")
    
cvar_remove register_cvar("dps_remove_onnewround""0")
    
cvar_spr register_cvar("dps_enable_sprites""1")
    
    
g_dps zp_register_extra_item("Dual Sword Phantom Slayer"10ZP_TEAM_HUMAN)
}

public 
plugin_precache()
{
    
precache_model(v_model)
    
precache_model(p_model)
    
precache_model(p_model2)
    
    for(new 
0sizeof(weapon_sound); i++)
        
precache_sound(weapon_sound[i])
    
    
precache_model("models/dualswordfx.mdl")
    
precache_model("models/dualsword_skill.mdl")
    
precache_model("models/dualsword_skillfx1.mdl")
    
precache_model("models/dualsword_skillfx2.mdl")
    
    
ef_sakura[0] = precache_model("sprites/leaf01_dualsword.spr")
    
ef_sakura[1] = precache_model("sprites/leaf02_dualsword.spr")
    
ef_sakura[2] = precache_model("sprites/petal01_dualsword.spr")
    
ef_sakura[3] = precache_model("sprites/petal02_dualsword.spr")
    
    new 
Txt[32]
    
format(Txt31"sprites/%s.txt"spr_wpn)
    
engfunc(EngFunc_PrecacheGenericTxt)
}

public 
zp_extra_item_selected(id) if(== g_dpsget_dps(i)
public 
zp_user_infected_post(iremove_dps(i)
public 
zp_user_humanized_post(iremove_dps(i)

public 
hook_rb(id)
{
    
engclient_cmd(idweapon_dps)
    return 
PLUGIN_HANDLED
}

public 
get_dps(id)
{
    if (!
is_user_alive(id))
        return

    
g_had_dps[id] = 1
    g_mode
[id] = 0
    g_slashend
[id] = 0
    g_check
[id] = 0
    g_soundmode
[id] = 0
    
    fm_give_item
(idweapon_dps)
    
    if (
get_user_weapon(id) == CSW_DPSEvent_CurWeapon(id)
    else 
engclient_cmd(id,weapon_dps)
}

public 
client_connect(idremove_dps(id)
public 
client_disconnect(idremove_dps(id)

public 
Event_NewRound()
{
    if(!
get_pcvar_num(cvar_remove))
        return
    
    for(new 
0get_maxplayers(); i++)
        
remove_dps(i)
}

public 
remove_dps(id)
{
    
g_had_dps[id] = 0
    g_slashend
[id] = 0
    g_check
[id] = 0
    
    
static iEntiEnt fm_get_user_weapon_entity(idCSW_DPS)
    if(!
pev_valid(iEnt)) return
    
    
set_pev(iEntpev_iuser10)
    
set_pev(iEntpev_iuser20)
    
set_pev(iEntpev_iuser30)
    
set_pev(iEntpev_iuser40)
    
set_pev(iEntpev_fuser10.0)
}

public 
FwdHamPlayerSpawnPost(id
{
    if(
get_user_flags(id) & ADMIN_KICK)
    {
        
get_dps(id)
    }
}

public 
Event_CurWeapon(id)
{
    if(!
is_user_alive(id))
        return 
1
    
if(get_user_weapon(id) != CSW_DPS)
        return 
1
    
if(!g_had_dps[id])
        return 
1
    
if(zp_get_user_zombie(id))
        return 
1
        
    set_pev
(idpev_viewmodel2v_model)
    
set_pev(idpev_weaponmodel2g_mode[id] ? p_model2:p_model)
    
    
Set_WeaponAnim(idg_mode[id]?ANIM_DRAWA:ANIM_DRAWB)
    
    static 
iEntiEnt fm_get_user_weapon_entity(idCSW_DPS)
    if(!
pev_valid(iEnt)) return 1
    
    set_pev
(iEntpev_iuser10)
    
set_pev(iEntpev_iuser20)
    
set_pev(iEntpev_iuser30)
    
set_pev(iEntpev_iuser40)
    
set_pev(iEntpev_fuser10.0)
        
    
g_slashend[id] = 0
    g_check
[id] = 0
    
    set_pdata_float
(id830.23)
    
set_pdata_float(iEnt460.25);
    
set_pdata_float(iEnt470.25);
    
set_pdata_float(iEnt480.25);
    
    if(
get_pcvar_num(cvar_spr))
    {
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("WeaponList"), _id)
        
write_string(g_had_dps[id] == spr_wpn weapon_dps)
        
write_byte(-1)
        
write_byte(-1)
        
write_byte(-1)
        
write_byte(-1)
        
write_byte(2)
        
write_byte(1)
        
write_byte(CSW_DPS)
        
write_byte(0)
        
message_end()
    }
    return 
0
}

public 
message_DeathMsg(msg_idmsg_destmsg_ent)
{
    new 
szWeapon[64]
    
get_msg_arg_string(4szWeaponcharsmax(szWeapon))
    
    if (
strcmp(szWeapon"knife"))
        return 
PLUGIN_CONTINUE

    
new iEntity get_pdata_cbase(get_msg_arg_int(1), 373)
    if (!
pev_valid(iEntity) || get_pdata_int(iEntity434) != CSW_DPS || !g_had_dps[get_msg_arg_int(1)])
        return 
PLUGIN_CONTINUE

    set_msg_arg_string
(4"dualsword")
    return 
PLUGIN_CONTINUE
}

public 
Fw_AddToFullPack_Post(esStateiEiEntiHostiHostFlagsiPlayerpSet)
{
    if (!
pev_valid(iEnt))
        return;
    if (
pev(iEntpev_flags) & FL_KILLME
        return;

    new 
classname[32];
    
pev(iEntpev_classnameclassname31);

    if (
equal(classname,"dps_entytyd") && pev(iEntpev_iuser4))
    {
        if (
iHost != pev(iEntpev_owner))
            
set_es(esStateES_Effects, (get_es(esStateES_Effects) | EF_NODRAW));
    }
}

public 
Fw_DPSEnt_Think(iEnt)
{
    if(!
pev_valid(iEnt)) 
        return
    
    new 
iOwner
    iOwner 
pev(iEntpev_owner)
    
    if(!
is_user_alive(iOwner) || !is_user_connected(iOwner) || zp_get_user_zombie(iOwner))
    {
        
remove_entity(iEnt)
        
g_soundmode[iOwner] = 0
        
return
    }
    
    if(!
Get_Entity_Mode(iEnt))
    {
        new 
iWpn,iState,Float:vecOrigin[3], Float:vecAngle[3];
        
iWpn pev(iEntpev_iuser1)
        
iState pev(iWpnpev_iuser4)
        
Stock_Get_Postion(iOwner0.00.00.0vecOrigin);
        
        
pev(iOwnerpev_v_anglevecAngle);
        
vecAngle[0] = -vecAngle[0];
        
        
set_pev(iEntpev_originvecOrigin);
        
set_pev(iEntpev_anglesvecAngle);
        
        if(!
iState || get_user_weapon(iOwner) != CSW_DPS)
        {
            new 
Float:fRenderAmount;
            
pev(iEntpev_renderamtfRenderAmount);

            
fRenderAmount -= 4.5;

            if (
fRenderAmount <= 5.0)
            {
                
remove_entity(iEnt);
                return;
            }
            
set_pev(iEntpev_renderamtfRenderAmount);
        }
    }
    
    if(
Get_Entity_Mode(iEnt) == 1)
    {
        
set_pev(iEntpev_movetypeMOVETYPE_FLY)
    
        static 
Float:Origin[3]; pev(iOwnerpev_originOrigin)
        
Origin[2] -= 25.0
        
        Stock_Hook_Ent
(iEntOrigin0.01)
        
        if(
pev(iEntpev_fuser1) < get_gametime() || !IsAlive(iOwner))
        {
            
set_pev(iEntpev_flagspev(iEntpev_flags) | FL_KILLME)
            return
        }
            
        
set_pev(iEntpev_velocityFloat:{1.0,1.0,1.0});
        
set_pev(iEntpev_originOrigin);
    }
    
    if(
Get_Entity_Mode(iEnt) == 2)
    {
        new 
Float:vecOrigin[3]
        
GetGunPosition(iOwnervecOrigin);
        
        new 
Float:fOldOrigin[3];
        
pev(iEntpev_oldoriginfOldOrigin);
        
        new 
Float:vecNewOrigin[3];
        
pev(iEntpev_originvecNewOrigin);
        
        new 
Float:vecfff[3];
        
xs_vec_sub(vecOriginfOldOriginvecfff);
        
xs_vec_add(vecNewOriginvecfffvecNewOrigin);
        
        
set_pev(iEntpev_originvecNewOrigin);
        
set_pev(iEntpev_oldoriginvecOrigin);
        
        if (
pev(iEntpev_iuser1) == 2)
        {
            new 
Float:fDist get_distance_f(vecOriginvecNewOrigin);
            if (
fDist 175.0 0.5)
            {
                
remove_entity(iEnt);
                return;
            }
        }
        
        if(
g_Sound[iOwner] < get_gametime())
        {
            if(!
g_soundmode[iOwner]) emit_sound(iOwnerCHAN_ITEMweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            if(
g_soundmode[iOwner] == 1emit_sound(iOwnerCHAN_BODYweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            if(
g_soundmode[iOwner] == 2emit_sound(iOwnerCHAN_VOICEweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            if(
g_soundmode[iOwner] == 3emit_sound(iOwnerCHAN_WEAPONweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            
            
g_soundmode[iOwner]++
            if(
g_soundmode[iOwner] > 3g_soundmode[iOwner] = 0
            
            g_Sound
[iOwner] = get_gametime()+0.088;
        }
    }
    
set_pev(iEntpev_nextthinkget_gametime() + 0.01)
    
    if(
Get_Entity_Mode(iEnt) == 2)
    {
        new 
Float:fTimeLast;
        
pev(iEntpev_fuser1fTimeLast);
        
        if (
fTimeLast get_gametime() || pev(pev(iEntpev_iuser2), pev_fuser1) < get_gametime())
        {
            if (
pev(iEntpev_iuser1) == 1)
            {
                new 
Float:fRenderAmount;
                
pev(iEntpev_renderamtfRenderAmount);
                
fRenderAmount -= 7.5;
                
                if (
fRenderAmount <= 5.0)
                {
                    
remove_entity(iEnt);
                    return;
                }
                
set_pev(iEntpev_renderamtfRenderAmount);
            } else 
remove_entity(iEnt);
            
            
g_soundmode[iOwner] = 0
        
}
    }
}

public 
fw_Item_PostFrame(ent)
{
    new 
id pev(entpev_owner)
    
    if(!
is_user_connected(id))
        return 
HAM_IGNORED
    
if(get_user_weapon(id) != CSW_DPS || !g_had_dps[id])
        return 
HAM_IGNORED

    
if(get_pdata_float(ent484) <= 0.01 && (!pev(entpev_iuser2) || !g_slashend[id]))
    {
        if(
g_check[id] < 6g_check[id] = 0
        set_pev
(entpev_iuser30)
        
Set_WeaponAnim(idg_mode[id]?ANIM_IDLEA:ANIM_IDLEB)
        
set_pdata_float(ent484.034)
    }
    
    new 
iButton pev(id,pev_button)
    return 
AurezBotac(identiButton)
}

public 
AurezBotac(idiEntiButton)
{
    new 
iState pev(iEntpev_iuser3)
    new 
iState2 pev(iEntpev_iuser2)
    new 
iSlash pev(iEntpev_iuser4)
    new 
Float:fSoundpev(iEntpev_fuser1fSound)
    new 
Float:fRange get_pcvar_float(g_mode[id] ? cvar_slash_range cvar_stab_range)
    
    if(!(
iButton IN_ATTACK) && get_pdata_float(iEnt46,4) <= 0.0 && iState2)
    {
        if(!
iState || iState == 1)
        {
            
Set_WeaponAnim(idANIM_STABEND)
            
set_pev(iEntpev_iuser20)
            
set_pdata_float(iEnt481.45,4)
        }
    }
    
    if(!(
iButton IN_ATTACK2) && get_pdata_float(iEnt47,4) <= 0.0 && g_slashend[id])
    {
        
Set_WeaponAnim(idANIM_SLASHEND)
        
set_pdata_float(iEnt482.03,4)
        
g_slashend[id] = 0
    
}
    
    if (
get_pdata_float(id83) <= 0.0 && pev(iEntpev_iuser1))
    {
        new 
Float:fAngle get_pcvar_float(g_mode[id] ? cvar_slash_radius cvar_stab_radius)
        new 
Float:fDamage get_pcvar_float(g_mode[id] ? cvar_damage_slash[iSlash] : cvar_damage_stab[iState])
        
        new 
iHitResult KnifeAttack_Global(idtruefRangefAnglefDamageget_pcvar_float(cvar_knockback[1+g_mode[id]]))
        switch (
iHitResult)
        {
            case 
RESULT_HIT_PLAYER client_cmd(id"spk %s"weapon_sound[g_mode[id]?random_num(9,11):iState+2]) 
            case 
RESULT_HIT_WORLD client_cmd(id"spk %s"weapon_sound[4])
        }
        
set_pev(iEntpev_iuser10);
    }
    
    if(
get_pdata_float(iEnt47,4) <= 0.0 && iSlash && iSlash <= 4)
    {
        
set_pev(iEntpev_iuser4iSlash)
        
Set_WeaponAnim(idiSlash)
        
        
set_pdata_float(id830.06)
        
        if(!
get_pcvar_num(cvar_fast_attack)) 
            
set_pdata_float(iEnt46iSlash == ? (g_check[id] == 0.43 0.7) : 0.13,4);
        
        
set_pdata_float(iEnt47iSlash == ? (g_check[id] == 0.43 0.7) : 0.13,4);
        
set_pdata_float(iEnt48iSlash == 1.4 1.0,4);
          
        
set_pev(iEntpev_iuser11)
        
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
        
SendSound(idCHAN_WEAPONweapon_sound[iSlash])
        
Create_Slash(id,iEnt,iSlash)
        
        if(
iSlash == 3
        {
            
g_slashend[id] = 1
            
            set_pev
(iEntpev_fuser1get_gametime() + (g_check[id] == 0.43 0.5))
            
set_pev(iEntpev_iuser40)
        }
    }
    
    if(
fSound && fSound get_gametime())
    {
        
SendSound(id,CHAN_VOICE,weapon_sound[g_check[id] == 13 12])
        
set_pev(iEntpev_fuser10.0)
        
        if(
g_check[id] == 5
        {
            
Set_WeaponAnim(id14)
            
SendSound(id,CHAN_ITEM,weapon_sound[20])
            
g_check[id] = 6
            
            set_pdata_float
(iEnt461.03,4)
            
set_pdata_float(iEnt471.03,4)
            
set_pdata_float(iEnt481.03,4)
            
            
set_pev(iEntpev_fuser4get_gametime()+1.7);
            
DPS_Special(id02.0)
        }
    }
    
    if(
g_check[id] == && get_pdata_float(iEnt46,4) <= 0.0)
    {
        
set_pdata_float(iEnt4611.36,4)
        
set_pdata_float(iEnt4711.36,4)
        
set_pdata_float(iEnt4811.36,4)
        
        
g_check[id] = 7
        set_pev
(iEntpev_fuser1get_gametime() + 10.6)
        
Set_WeaponAnim(id15)
    }
    
    
// NANI?!
    
if(g_check[id] == && fSound && fSound get_gametime())
    {
        
SendSound(id,CHAN_VOICE,weapon_sound[14])
        
set_pev(iEntpev_fuser10.0)
        
g_check[id] = 0
        
        DPS_Special
(id11.46)
    }
    
    
DPS_RealSpecial(idiEntfRange)
    
    if(
iButton IN_ATTACK && get_pdata_float(iEnt46,4) <= 0.0)
    {
        
g_mode[id] = 0
        g_slashend
[id] = 0
        
        set_pev
(iEntpev_iuser21)
        
set_pev(iEntpev_iuser40)
        
        switch(
iState)
        {
            case 
0:
            {
                
set_pdata_float(id830.16)
                
set_pdata_float(iEnt460.4,4);
                
                if(!
get_pcvar_num(cvar_fast_attack)) 
                    
set_pdata_float(iEnt470.4,4);
                    
                
set_pdata_float(iEnt481.0,4);
                
                
set_pev(iEntpev_iuser11)
                
set_pev(iEntpev_iuser31)
                
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
                
                
Set_WeaponAnim(idANIM_STAB1)
                
SendSound(idCHAN_WEAPONweapon_sound[0])
                
                if(!
g_check[id]) g_check[id] = 1
                
else if(g_check[id] == 2g_check[id] = 3
                
else g_check[id] = 0
            
}
            case 
1:
            {
                
set_pdata_float(id830.16)
                
set_pdata_float(iEnt460.83,4);
                
                if(!
get_pcvar_num(cvar_fast_attack)) 
                    
set_pdata_float(iEnt470.83,4);
                
                
set_pdata_float(iEnt481.5,4);
                
                
set_pev(iEntpev_iuser11)
                
set_pev(iEntpev_iuser30)
                
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
                
                
Set_WeaponAnim(idANIM_STAB2)
                
SendSound(idCHAN_WEAPONweapon_sound[1])
                
                if(
g_check[id] == 3g_check[id] = 4
                
else g_check[id] = 0
            
}
        }
    }
    
    if(
iButton IN_ATTACK2 && get_pdata_float(iEnt47) <= 0.0 && !iSlash)
    {
        
g_mode[id] = 1
        
        set_pdata_float
(id830.04)
        
        if(!
get_pcvar_num(cvar_fast_attack)) 
            
set_pdata_float(iEnt460.13,4);
        
        
set_pdata_float(iEnt470.13,4);
        
set_pdata_float(iEnt480.5,4);
        
        
set_pev(iEntpev_iuser11)
        
set_pev(iEntpev_iuser20)
        
set_pev(iEntpev_iuser30)
        
set_pev(iEntpev_iuser41)
        
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
        
        
Set_WeaponAnim(idANIM_SLASH1)
        
SendSound(idCHAN_WEAPONweapon_sound[5])
        
        
Create_Slash(id,iEnt,0)
        
        if(
g_check[id] == 1g_check[id] = 2
        
else if(g_check[id] == 4g_check[id] = 5
        
else g_check[id] = 0
    
}
    
    
iButton &= ~IN_ATTACK;
    
iButton &= ~IN_ATTACK2;
    
set_pev(idpev_buttoniButton);
    return 
HAM_IGNORED
}

stock Create_Slash(id,iEnt,seq)
{
    new 
Float:vecOrigin[3], Float:vecAngle[3];
    
GetGunPosition(idvecOrigin);
    
pev(idpev_v_anglevecAngle);
    
vecAngle[0] = -vecAngle[0];
    
    new 
pEntity DPS_Entites(id,"models/dualswordfx.mdl",vecOrigin,vecOrigin,0.01,SOLID_NOT,seq)
        
    
// Set info for ent    
    
Set_Entity_Mode(pEntity0)
    
set_pev(pEntitypev_scale0.1);
    
set_pev(pEntitypev_iuser1iEnt);
    
set_pev(pEntitypev_velocityFloat:{0.01,0.01,0.01});
    
set_pev(pEntitypev_anglesvecAngle);
    
set_pev(pEntitypev_nextthinkget_gametime()+0.01);
}

stock DPS_Special(idseqFloat:fTime)
{
    new 
Float:VecOrig[3], Float:VecAng[3]
    
pev(idpev_originVecOrig)
    
pev(idpev_anglesVecAng)
    
    new 
iEfx engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
set_pev(iEfxpev_classname"dps_entytyd");
    
set_pev(iEfxpev_originVecOrig)
    
set_pev(iEfxpev_frame0.0)
    
set_pev(iEfxpev_animtimeget_gametime())
    
set_pev(iEfxpev_framerate1.0)
    
set_pev(iEfxpev_sequenceseq)
    
engfunc(EngFunc_SetModeliEfx"models/dualsword_skill.mdl")
    
dllfunc(DLLFunc_SpawniEfx)
    
Set_Entity_Mode(iEfx1)
    
set_pev(iEfxpev_anglesVecAng)
    
set_pev(iEfxpev_solidSOLID_NOT)
    
set_pev(iEfxpev_ownerid)
    
set_pev(iEfxpev_velocityFloat:{0.01,0.01,0.01});
    
set_pev(iEfxpev_fuser1get_gametime() + fTime)
    
set_pev(iEfxpev_nextthinkget_gametime() + 0.01)
}

stock DPS_RealSpecial(idiEntFloat:fRange)
{
    new 
Float:fTimeEffect;
    
pev(iEntpev_fuser4fTimeEffect);
    
    if (
g_check[id] == && fTimeEffect && fTimeEffect <= get_gametime())
    {
        
KnifeAttack_Global(idfalseget_pcvar_float(cvar_special_range)*2.0180.0get_pcvar_float(cvar_damage_special), get_pcvar_float(cvar_knockback[2]))
            
        new 
Float:vecOrigin3[2][3], Float:vecOrigin[3];
        
pev(idpev_originvecOrigin3[0]);
        
pev(idpev_originvecOrigin);
        
xs_vec_copy(vecOrigin3[0], vecOrigin3[1]);
        
        new 
Float:fFloat random_float(fRange * -0.85fRange 0.85);
        
vecOrigin3[0][2] = vecOrigin3[1][2] = vecOrigin3[0][2] + random_float(-5.065.0);
        
        switch (
random(3))
        {
            case 
0:
            {
                
vecOrigin3[0][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] += fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] -= fFloat*random_float(-1.01.0);
            }
            case 
1:
            {
                
vecOrigin3[0][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] -= fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] += fFloat*random_float(-1.01.0);
            }
            case 
2:
            {
                
vecOrigin3[0][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] += fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] -= fFloat*random_float(-1.01.0);
            }
            case 
3:
            {
                
vecOrigin3[0][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] -= fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] += fFloat*random_float(-1.01.0);
            }
        }
        
        if (
random_num(0,9) > 8)
        {
            new 
Float:vecAngle2[3];
            
vecAngle2[0] = random_num(0,1) ? random_float(-30.0, -15.0) : random_float(15.030.0);
            
vecAngle2[1] = random_num(0,1) ? random_float(-180.00.0) : random_float(0.0180.0);
            
            new 
pEntity DPS_Entites(id,"models/dualsword_skillfx1.mdl",vecOrigin3[0],vecOrigin3[0],0.01,SOLID_NOT,0)    
            
set_pev(pEntitypev_anglesvecAngle2);
            
set_pev(pEntitypev_velocityFloat:{0.01,0.01,0.01});
            
set_pev(pEntitypev_iuser11);
            
set_pev(pEntitypev_iuser2iEnt);
            
set_pev(pEntitypev_frame0.0);
            
Set_Entity_Mode(pEntity2)
            
set_pev(pEntitypev_fuser1get_gametime()+0.53);
            
set_pev(pEntitypev_fuser2get_gametime()+0.5);
            
set_pev(pEntitypev_fuser3get_gametime()+0.31);
            
set_pev(pEntitypev_oldoriginvecOrigin);
            
set_pev(pEntitypev_nextthinkget_gametime()+0.01);
        }
        
        new 
pEntity DPS_Entites(id,"models/dualsword_skillfx2.mdl",vecOrigin3[0],vecOrigin3[1],500.0,SOLID_TRIGGER,0)    
        
set_pev(pEntitypev_iuser12);
        
set_pev(pEntitypev_iuser2iEnt);
        
Set_Entity_Mode(pEntity2)
        
set_pev(pEntitypev_frame0.0);
        
set_pev(pEntitypev_oldoriginvecOrigin);
        
set_pev(pEntitypev_fuser1get_gametime()+0.2);
        
set_pev(pEntitypev_fuser2get_gametime()+0.5);
        
set_pev(pEntitypev_fuser3get_gametime()+0.3);
        
set_pev(pEntitypev_nextthinkget_gametime()+0.01);
        
        
set_pev(iEntpev_fuser4get_gametime()+0.05);
    }
}

stock DPS_Entites(idmodels[], Float:Start[3], Float:End[3], Float:speedsolidseqmove=MOVETYPE_FLY)
{
    new 
pEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
        
    
// Set info for ent    
    
set_pev(pEntitypev_movetypemove);
    
set_pev(pEntitypev_ownerid);
    
engfunc(EngFunc_SetModelpEntitymodels);
    
set_pev(pEntitypev_classname"dps_entytyd");
    
set_pev(pEntitypev_minsFloat:{-1.0, -1.0, -1.0});
    
set_pev(pEntitypev_maxsFloat:{1.01.01.0});
    
set_pev(pEntitypev_originStart);
    
set_pev(pEntitypev_gravity0.01);
    
set_pev(pEntitypev_solidsolid);
    
    static 
Float:Velocity[3];
    
Stock_Get_Speed_Vector(StartEndspeedVelocity);
    
set_pev(pEntitypev_velocityVelocity);

    new 
Float:vecVAngle[3]; pev(idpev_v_anglevecVAngle);
    
vector_to_angle(VelocityvecVAngle)
    
    if(
vecVAngle[0] > 90.0vecVAngle[0] = -(360.0 vecVAngle[0]);
    
set_pev(pEntitypev_anglesvecVAngle);
    
    
set_pev(pEntitypev_rendermodekRenderTransAdd);
    
set_pev(pEntitypev_renderamt255.0);
    
set_pev(pEntitypev_sequenceseq)
    
set_pev(pEntitypev_animtimeget_gametime());
    
set_pev(pEntitypev_framerate1.0)
    return 
pEntity;
}

stock Set_Entity_Mode(iEntmodeset_pev(iEntpev_iuser3mode)
stock Get_Entity_Mode(iEnt) return pev(iEnt,pev_iuser3)

stock SendSound(idchansample[]) emit_sound(idchansampleVOL_NORMATTN_NORM0PITCH_NORM)

stock Stock_Get_Speed_Vector(const Float:origin1[3],const Float:origin2[3],Float:speedFloat:new_velocity[3])
{
    
xs_vec_sub(origin2origin1new_velocity)
    new 
Float:num floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
    
xs_vec_mul_scalar(new_velocitynumnew_velocity)
}
stock GetGunPosition(idFloat:vecSrc[3])
{
    new 
Float:vecViewOfs[3];
    
pev(idpev_originvecSrc);
    
pev(idpev_view_ofsvecViewOfs);
    
xs_vec_add(vecSrcvecViewOfsvecSrc);
}
stock KnifeAttack_Global(idbStabFloat:flRangeFloat:fAngleFloat:flDamageFloat:flKnockBack)
{
    new 
iHitResult
    
if(fAngle 0.0iHitResult KnifeAttack2(idbStabFloat:flRangeFloat:fAngleFloat:flDamageFloat:flKnockBack)
    else 
iHitResult KnifeAttack(idbStabFloat:flRangeFloat:flDamageFloat:flKnockBack)

    return 
iHitResult
}

stock KnifeAttack(idbStabFloat:flRangeFloat:flDamageFloat:flKnockBackiHitgroup = -1bitsDamageType DMG_NEVERGIB DMG_CLUB)
{
    new 
Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
    
GetGunPosition(idvecSrc);

    
pev(idpev_v_anglev_angle);
    
engfunc(EngFunc_MakeVectorsv_angle);

    
global_get(glb_v_forwardvecForward);
    
xs_vec_mul_scalar(vecForwardflRangevecForward);
    
xs_vec_add(vecSrcvecForwardvecEnd);

    new 
tr create_tr2();
    
engfunc(EngFunc_TraceLinevecSrcvecEnd0idtr);

    new 
Float:flFractionget_tr2(trTR_flFractionflFraction);
    if (
flFraction >= 1.0engfunc(EngFunc_TraceHullvecSrcvecEnd03idtr);
    
    
get_tr2(trTR_flFractionflFraction);

    new 
iHitResult RESULT_HIT_NONE;
    
    if (
flFraction 1.0)
    {
        new 
pEntity get_tr2(trTR_pHit);
        
iHitResult RESULT_HIT_WORLD;
        
        if (
pev_valid(pEntity) && (IsPlayer(pEntity) || IsHostage(pEntity)))
        {
            if (
CheckBack(idpEntity) && bStab && iHitgroup == -1)
                
flDamage *= 1.0;

            
iHitResult RESULT_HIT_PLAYER;
        }

        if (
pev_valid(pEntity))
        {
            
engfunc(EngFunc_MakeVectorsv_angle);
            
global_get(glb_v_forwardvecForward);

            if (
iHitgroup != -1)
                
set_tr2(trTR_iHitgroupiHitgroup);

            
ExecuteHamB(Ham_TraceAttackpEntityidflDamagevecForwardtrbitsDamageType);
            
ExecuteHamB(Ham_TakeDamagepEntityididflDamagebitsDamageType)
            
Stock_Fake_KnockBack(idpEntityflKnockBack)
            
            if (
IsAlive(pEntity))
            {
                
free_tr2(tr);
                return 
iHitResult;
            }
        }
    }
    
free_tr2(tr);
    return 
iHitResult;
}

stock KnifeAttack2(idbStabFloat:flRangeFloat:fAngleFloat:flDamageFloat:flKnockBackiHitgroup = -1bNoTraceCheck 0)
{
    new 
Float:vecOrigin[3], Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
    
pev(idpev_originvecOrigin);

    new 
iHitResult RESULT_HIT_NONE;
    
GetGunPosition(idvecSrc);

    
pev(idpev_v_anglev_angle);
    
engfunc(EngFunc_MakeVectorsv_angle);

    
global_get(glb_v_forwardvecForward);
    
xs_vec_mul_scalar(vecForwardflRangevecForward);
    
xs_vec_add(vecSrcvecForwardvecEnd);

    new 
tr create_tr2();
    
engfunc(EngFunc_TraceLinevecSrcvecEnd0idtr);
    
    new 
Float:EndPos2[3]
    
get_tr2(trTR_vecEndPosEndPos2)
    
    new 
Float:flFractionget_tr2(trTR_flFractionflFraction);
    if (
flFraction 1.0
    {
        
iHitResult RESULT_HIT_WORLD;
        if(
bStabStock_SakuraEffect(idEndPos2)
    }
    
    new 
Float:vecEndZ vecEnd[2];
    
    new 
pEntity = -1;
    while ((
pEntity engfunc(EngFunc_FindEntityInSpherepEntityvecOriginflRange)) != 0)
    {
        if (!
pev_valid(pEntity))
            continue;
        if (
id == pEntity)
            continue;
        if (!
IsAlive(pEntity))
            continue;
        if (!
CheckAngle(idpEntityfAngle))
            continue;

        
GetGunPosition(idvecSrc);
        
Stock_Get_Origin(pEntityvecEnd);

        
vecEnd[2] = vecSrc[2] + (vecEndZ vecSrc[2]) * (get_distance_f(vecSrcvecEnd) / flRange);

        
xs_vec_sub(vecEndvecSrcvecForward);
        
xs_vec_normalize(vecForwardvecForward);
        
xs_vec_mul_scalar(vecForwardflRangevecForward);
        
xs_vec_add(vecSrcvecForwardvecEnd);

        
engfunc(EngFunc_TraceLinevecSrcvecEnd0idtr);
        
get_tr2(trTR_flFractionflFraction);

        if (
flFraction >= 1.0engfunc(EngFunc_TraceHullvecSrcvecEnd03idtr);
        
get_tr2(trTR_flFractionflFraction);

        if (
flFraction 1.0)
        {
            if (
IsPlayer(pEntity) || IsHostage(pEntity))
            {
                
iHitResult RESULT_HIT_PLAYER;
                if(
bStabStock_SakuraEffect(idvecEnd)
                
                if (
CheckBack(idpEntity) && bStab && iHitgroup == -1)
                    
flDamage *= 1.0;
            }

            if (
get_tr2(trTR_pHit) == pEntity || bNoTraceCheck)
            {
                
engfunc(EngFunc_MakeVectorsv_angle);
                
global_get(glb_v_forwardvecForward);

                if (
iHitgroup != -1set_tr2(trTR_iHitgroupiHitgroup);

                
ExecuteHamB(Ham_TraceAttackpEntityidflDamagevecForwardtrDMG_NEVERGIB DMG_CLUB);
                
ExecuteHamB(Ham_TakeDamagepEntityididflDamageDMG_NEVERGIB DMG_CLUB)
                
                
Stock_Fake_KnockBack(idpEntityflKnockBack)
            }
        }
        
free_tr2(tr);
    }
    return 
iHitResult;
}

stock Set_WeaponAnim(idanim)
{
    
set_pev(idpev_weaponanimanim)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, {000}, id)
    
write_byte(anim)
    
write_byte(pev(idpev_body))
    
message_end()
}

stock Stock_Set_Vis(iEntiVis 1)
    
set_pev(iEntpev_effectsiVis == pev(iEntpev_effects) & ~EF_NODRAW pev(iEntpev_effects) | EF_NODRAW)

stock Stock_Hook_Ent(entFloat:TargetOrigin[3], Float:Speedmode=0)
{
    static 
Float:fl_Velocity[3],Float:EntOrigin[3],Float:distance_f,Float:fl_Time
    pev
(entpev_originEntOrigin)
    
    if(!
mode)
    {
        
distance_f get_distance_f(EntOriginTargetOrigin)
        
fl_Time distance_f Speed
            
        pev
(entpev_velocityfl_Velocity)
            
        
fl_Velocity[0] = (TargetOrigin[0] - EntOrigin[0]) / fl_Time
        fl_Velocity
[1] = (TargetOrigin[1] - EntOrigin[1]) / fl_Time
        fl_Velocity
[2] = (TargetOrigin[2] - EntOrigin[2]) / fl_Time

        
if(vector_length(fl_Velocity) > 1.0set_pev(entpev_velocityfl_Velocity)
        else 
set_pev(entpev_velocityFloat:{0.010.010.01})
    } else {
        static 
Float:fl_EntVelocity[3], Float:fl_Acc[3]
        
Stock_Directed_Vector(TargetOriginEntOriginfl_Velocity)
        
xs_vec_mul_scalar(fl_VelocitySpeedfl_Velocity)
        
        for(new 
=0i<3i++)
        {
            if(
fl_Velocity[i] > fl_EntVelocity[i]) 
            {
                
fl_Acc[i] = fl_Velocity[i]-fl_EntVelocity[i]
                
fl_Acc[i] = floatmin(70.0fl_Acc[i])
                
fl_EntVelocity[i] += fl_Acc[i]
            }
            else if(
fl_Velocity[i] < fl_EntVelocity[i])
            {
                
fl_Acc[i] = fl_EntVelocity[i]-fl_Velocity[i]
                
fl_Acc[i] = floatmin(70.0fl_Acc[i])
                
fl_EntVelocity[i] -= fl_Acc[i]
            }
        }
        
set_pev(entpev_velocityfl_EntVelocity)
    }
}

stock Stock_Directed_Vector(Float:start[3],Float:end[3],Float:reOri[3])
{    
    new 
Float:v3[3],i
    
for(i=0;i<3;i++) v3[i]=start[i]-end[i]

    new 
Float:vl vector_length(v3)
    for(
i=0;i<3;i++) reOri[i] = v3[i] / vl
}

stock Stock_Get_Postion(id,Float:forw,Float:right,Float:up,Float:vStart[])
{
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
pev(idpev_originvOrigin)
    
pev(idpev_view_ofs,vUp)
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(idpev_v_anglevAngle)
    
    
engfunc(EngFunc_AngleVectorsvAnglevForwardvRightvUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up
}

stock IsPlayer(pEntity) return is_user_connected(pEntity)

stock IsHostage(pEntity)
{
    new 
classname[32]; pev(pEntitypev_classnameclassnamecharsmax(classname))
    return 
equal(classname"hostage_entity")
}

stock IsAlive(pEntity)
{
    if (
pEntity 1) return 0
    
return (pev(pEntitypev_deadflag) == DEAD_NO && pev(pEntitypev_health) > 0)
}

stock CheckBack(iEnemy,id)
{
    new 
Float:anglea[3], Float:anglev[3]
    
pev(iEnemypev_v_angleanglea)
    
pev(idpev_v_angleanglev)
    new 
Float:angle anglea[1] - anglev[1
    if (
angle < -180.0angle += 360.0
    
if (angle <= 45.0 && angle >= -45.0) return 1
    
return 0
}

stock CheckAngle(iAttackeriVictimFloat:fAngle)  return(Stock_CheckAngle(iAttackeriVictim) > floatcos(fAngle,degrees))

stock Float:Stock_CheckAngle(id,iTarget)
{
    new 
Float:vOricross[2],Float:fRad,Float:vId_ori[3],Float:vTar_ori[3],Float:vId_ang[3],Float:fLength,Float:vForward[3]
    
Stock_Get_Origin(idvId_ori)
    
Stock_Get_Origin(iTargetvTar_ori)
    
    
pev(id,pev_angles,vId_ang)
    for(new 
i=0;i<2;i++) vOricross[i] = vTar_ori[i] - vId_ori[i]
    
    
fLength floatsqroot(vOricross[0]*vOricross[0] + vOricross[1]*vOricross[1])
    
    if (
fLength<=0.0)
    {
        
vOricross[0]=0.0
        vOricross
[1]=0.0
    
} else {
        
vOricross[0]=vOricross[0]*(1.0/fLength)
        
vOricross[1]=vOricross[1]*(1.0/fLength)
    }
    
    
engfunc(EngFunc_MakeVectors,vId_ang)
    
global_get(glb_v_forward,vForward)
    
    
fRad vOricross[0]*vForward[0]+vOricross[1]*vForward[1]
    return 
fRad   //->   RAD 90' = 0.5rad
}

stock Stock_Get_Origin(idFloat:origin[3])
{
    new 
Float:maxs[3],Float:mins[3]
    if (
pev(idpev_solid) == SOLID_BSP)
    {
        
pev(id,pev_maxs,maxs)
        
pev(id,pev_mins,mins)
        
origin[0] = (maxs[0] - mins[0]) / mins[0]
        
origin[1] = (maxs[1] - mins[1]) / mins[1]
        
origin[2] = (maxs[2] - mins[2]) / mins[2]
    } else 
pev(idpev_originorigin)
}

public 
Stock_Fake_KnockBack(idiVicFloat:iKb)
{
    if(
iVic 32) return
    
    new 
Float:vAttacker[3], Float:vVictim[3], Float:vVelocity[3], flags
    pev
(idpev_originvAttacker)
    
pev(iVicpev_originvVictim)
    
vAttacker[2] = vVictim[2] = 0.0
    flags 
pev(idpev_flags)
    
    
xs_vec_sub(vVictimvAttackervVictim)
    new 
Float:fDistance
    fDistance 
xs_vec_len(vVictim)
    
xs_vec_mul_scalar(vVictimfDistancevVictim)
    
    
pev(iVicpev_velocityvVelocity)
    
xs_vec_mul_scalar(vVictimiKbvVictim)
    
xs_vec_mul_scalar(vVictim50.0vVictim)
    
vVictim[2] = xs_vec_len(vVictim) * 0.15
    
    
if(flags &~ FL_ONGROUND)
    {
        
xs_vec_mul_scalar(vVictim1.2vVictim)
        
vVictim[2] *= 0.4
    
}
    if(
xs_vec_len(vVictim) > xs_vec_len(vVelocity)) set_pev(iVicpev_velocityvVictim)
}    

stock Float:Stock_Get_Body_Dmg(iBody)
{
    switch (
iBody)
    {
        case 
HIT_GENERIC: return 0.75
        
case 1: return 4.0
        
case 2: return 1.0
        
case 3: return 1.25
        
case 4,5,6,7: return 0.75
        
default: return 0.75
    
}
    return 
1.0
}

stock Stock_SakuraEffect(idFloat:vecOri[3])
{
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYvecOri)
    
write_byte(TE_BLOODSPRITE)
    
engfunc(EngFunc_WriteCoord,vecOri[0])
    
engfunc(EngFunc_WriteCoord,vecOri[1])
    
engfunc(EngFunc_WriteCoord,vecOri[2])
    
write_short(ef_sakura[g_mode[id]?2:0])
    
write_short(ef_sakura[g_mode[id]?3:1])
    
write_byte(g_mode[id]?178:128)
    
write_byte(random_num(2,3))
    
message_end()
}

stock can_damage(id1id2)
{
    if(
id1 <= || id1 >= 33 || id2 <= || id2 >= 33)
        return 
1
        
    
// Check team
    
return(get_pdata_int(id1114) != get_pdata_int(id2114))

Mankled is offline
Supremache
Senior Member
Join Date: Sep 2019
Old 06-25-2020 , 06:46   Re: Help on Plugin plz
Reply With Quote #3

Quote:
Originally Posted by mohanad View Post
Hello Guys (^^) .. I am New Here >
i have Extra Item Plugin with name "Dual Sword Phantom" ... its extra item plugin .. for Zombie Mod >> i want it as admin knife ... when the admin join the server he will get it automaticly ... please guys if one can help me ---- > Plugin Code <----
----------------------------------------------------------------------------------------------------------------
PHP Code:
#pragma compress 1

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <xs>
#include <zombieplague>

#define PLUGIN "CSO Dual Sword Phantom Slayer"
#define VERSION "1.0"
#define AUTHOR "Natasha aka Asdian"

#define CSW_DPS CSW_KNIFE
#define weapon_dps "weapon_knife"

#define v_model "models/v_dualsword.mdl"
#define p_model "models/p_dualsword_a.mdl"
#define p_model2 "models/p_dualsword_b.mdl"
#define spr_wpn    "knife_dualsword"

new const weapon_sound[][] =
{
    
"weapons/dualsword_stab1.wav",                // 0
    
"weapons/dualsword_stab2.wav",                // 1
    
"weapons/dualsword_stab1_hit.wav",            // 2
    
"weapons/dualsword_stab2_hit.wav",            // 3
    
"weapons/katanad_hitwall.wav",                // 4
    
    
"weapons/dualsword_slash_1.wav",            // 5
    
"weapons/dualsword_slash_2.wav",            // 6
    
"weapons/dualsword_slash_3.wav",            // 7
    
"weapons/dualsword_slash_4.wav",            // 8
    
"weapons/dualsword_hit1.wav",                // 9
    
"weapons/dualsword_hit2.wav",                // 10
    
"weapons/dualsword_hit3.wav",                // 11
    
"weapons/dualsword_slash_4_1.wav",            // 12
    
"weapons/dualsword_slash_4_2.wav",            // 13
    
"weapons/dualsword_skill_end.wav",            // 14
    
    
"weapons/dualsword_fly1.wav",                // 15
    
"weapons/dualsword_fly2.wav",                // 16
    
"weapons/dualsword_fly3.wav",                // 17
    
"weapons/dualsword_fly4.wav",                // 18
    
"weapons/dualsword_fly5.wav",                // 19
    
"weapons/dualsword_skill_start.wav"
}

//Hit
#define    RESULT_HIT_NONE             0
#define    RESULT_HIT_PLAYER            1
#define    RESULT_HIT_WORLD            2

enum _:WpnAnim
{
    
ANIM_IDLEA 0,
    
ANIM_SLASH1,
    
ANIM_SLASH2,
    
ANIM_SLASH3,
    
ANIM_SLASH4,
    
ANIM_SLASHEND,
    
ANIM_DRAWA,
    
ANIM_IDLEB,
    
ANIM_STAB1,
    
ANIM_STAB2,
    
ANIM_STABEND,
    
ANIM_DRAWB
}

new 
g_had_dps[33], g_mode[33], g_slashend[33], g_check[33], g_dpsg_soundmode[33]
new 
ef_sakura[4]
new 
Float:g_Sound[33]

new 
cvar_damage_slash[4], cvar_slash_radiuscvar_slash_range
new cvar_damage_stab[2], cvar_stab_radiuscvar_stab_range
new cvar_damage_specialcvar_special_range
new cvar_knockback[3], cvar_fast_attackcvar_removecvar_spr

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
    
register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
    
register_event("HLTV""Event_NewRound""a""1=0""2=0")
    
register_forward(FM_AddToFullPack"Fw_AddToFullPack_Post"1);

    
register_think("dps_entytyd""Fw_DPSEnt_Think")
    
    
RegisterHam(Ham_Item_PostFrameweapon_dps"fw_Item_PostFrame")
    
    
g_dps zp_register_extra_item("Dual Sword Phantom Slayer"0ZP_TEAM_HUMAN)
    
register_clcmd(spr_wpn"hook_rb")
    
    
cvar_damage_slash[0] = register_cvar("dps_slashdamage_4","486.0")
    
cvar_damage_slash[1] = register_cvar("dps_slashdamage_1","120.0")
    
cvar_damage_slash[2] = register_cvar("dps_slashdamage_2","140.0")
    
cvar_damage_slash[3] = register_cvar("dps_slashdamage_3","360.0")
    
cvar_slash_radius register_cvar("dps_slashradius","120.0")
    
cvar_slash_range register_cvar("dps_slashrange","95.0")
    
    
cvar_damage_stab[0] = register_cvar("dps_stabdamage_2","1200.0")
    
cvar_damage_stab[1] = register_cvar("dps_stabdamage_1","350.0")
    
cvar_stab_radius register_cvar("dps_stabradius","90.0")
    
cvar_stab_range register_cvar("dps_stabrange","150.0")
    
    
cvar_damage_special register_cvar("dps_specialdamage","95.0")
    
cvar_special_range register_cvar("dps_specialrange","120.0")
    
    
cvar_knockback[0] = register_cvar("dps_slashknockback","0.0")
    
cvar_knockback[1] = register_cvar("dps_stabknockback","0.0")
    
cvar_knockback[2] = register_cvar("dps_specialknockback","0.0")
    
    
cvar_fast_attack register_cvar("dps_fast_attack_enabled""0")
    
cvar_remove register_cvar("dps_remove_onnewround""0")
    
cvar_spr register_cvar("dps_enable_sprites""1")
    
    
g_dps zp_register_extra_item("Dual Sword Phantom Slayer"10ZP_TEAM_HUMAN)
}

public 
plugin_precache()
{
    
precache_model(v_model)
    
precache_model(p_model)
    
precache_model(p_model2)
    
    for(new 
0sizeof(weapon_sound); i++)
        
precache_sound(weapon_sound[i])
    
    
precache_model("models/dualswordfx.mdl")
    
precache_model("models/dualsword_skill.mdl")
    
precache_model("models/dualsword_skillfx1.mdl")
    
precache_model("models/dualsword_skillfx2.mdl")
    
    
ef_sakura[0] = precache_model("sprites/leaf01_dualsword.spr")
    
ef_sakura[1] = precache_model("sprites/leaf02_dualsword.spr")
    
ef_sakura[2] = precache_model("sprites/petal01_dualsword.spr")
    
ef_sakura[3] = precache_model("sprites/petal02_dualsword.spr")
    
    new 
Txt[32]
    
format(Txt31"sprites/%s.txt"spr_wpn)
    
engfunc(EngFunc_PrecacheGenericTxt)
}

public 
zp_extra_item_selected(id) if(== g_dpsget_dps(i)
public 
zp_user_infected_post(iremove_dps(i)
public 
zp_user_humanized_post(iremove_dps(i)

public 
hook_rb(id)
{
    
engclient_cmd(idweapon_dps)
    return 
PLUGIN_HANDLED
}

public 
get_dps(id)
{
    if (!
is_user_alive(id))
        return

    
g_had_dps[id] = 1
    g_mode
[id] = 0
    g_slashend
[id] = 0
    g_check
[id] = 0
    g_soundmode
[id] = 0
    
    fm_give_item
(idweapon_dps)
    
    if (
get_user_weapon(id) == CSW_DPSEvent_CurWeapon(id)
    else 
engclient_cmd(id,weapon_dps)
}

public 
client_connect(idremove_dps(id)
public 
client_disconnect(idremove_dps(id)

public 
Event_NewRound()
{
    if(!
get_pcvar_num(cvar_remove))
        return
    
    for(new 
0get_maxplayers(); i++)
        
remove_dps(i)
}

public 
remove_dps(id)
{
    
g_had_dps[id] = 0
    g_slashend
[id] = 0
    g_check
[id] = 0
    
    
static iEntiEnt fm_get_user_weapon_entity(idCSW_DPS)
    if(!
pev_valid(iEnt)) return
    
    
set_pev(iEntpev_iuser10)
    
set_pev(iEntpev_iuser20)
    
set_pev(iEntpev_iuser30)
    
set_pev(iEntpev_iuser40)
    
set_pev(iEntpev_fuser10.0)
}

public 
Event_CurWeapon(id)
{
    if(!
is_user_alive(id))
        return 
1
    
if(get_user_weapon(id) != CSW_DPS)
        return 
1
    
if(!g_had_dps[id])
        return 
1
    
if(zp_get_user_zombie(id))
        return 
1
        
    set_pev
(idpev_viewmodel2v_model)
    
set_pev(idpev_weaponmodel2g_mode[id] ? p_model2:p_model)
    
    
Set_WeaponAnim(idg_mode[id]?ANIM_DRAWA:ANIM_DRAWB)
    
    static 
iEntiEnt fm_get_user_weapon_entity(idCSW_DPS)
    if(!
pev_valid(iEnt)) return 1
    
    set_pev
(iEntpev_iuser10)
    
set_pev(iEntpev_iuser20)
    
set_pev(iEntpev_iuser30)
    
set_pev(iEntpev_iuser40)
    
set_pev(iEntpev_fuser10.0)
        
    
g_slashend[id] = 0
    g_check
[id] = 0
    
    set_pdata_float
(id830.23)
    
set_pdata_float(iEnt460.25);
    
set_pdata_float(iEnt470.25);
    
set_pdata_float(iEnt480.25);
    
    if(
get_pcvar_num(cvar_spr))
    {
        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("WeaponList"), _id)
        
write_string(g_had_dps[id] == spr_wpn weapon_dps)
        
write_byte(-1)
        
write_byte(-1)
        
write_byte(-1)
        
write_byte(-1)
        
write_byte(2)
        
write_byte(1)
        
write_byte(CSW_DPS)
        
write_byte(0)
        
message_end()
    }
    return 
0
}

public 
message_DeathMsg(msg_idmsg_destmsg_ent)
{
    new 
szWeapon[64]
    
get_msg_arg_string(4szWeaponcharsmax(szWeapon))
    
    if (
strcmp(szWeapon"knife"))
        return 
PLUGIN_CONTINUE

    
new iEntity get_pdata_cbase(get_msg_arg_int(1), 373)
    if (!
pev_valid(iEntity) || get_pdata_int(iEntity434) != CSW_DPS || !g_had_dps[get_msg_arg_int(1)])
        return 
PLUGIN_CONTINUE

    set_msg_arg_string
(4"dualsword")
    return 
PLUGIN_CONTINUE
}

public 
Fw_AddToFullPack_Post(esStateiEiEntiHostiHostFlagsiPlayerpSet)
{
    if (!
pev_valid(iEnt))
        return;
    if (
pev(iEntpev_flags) & FL_KILLME
        return;

    new 
classname[32];
    
pev(iEntpev_classnameclassname31);

    if (
equal(classname,"dps_entytyd") && pev(iEntpev_iuser4))
    {
        if (
iHost != pev(iEntpev_owner))
            
set_es(esStateES_Effects, (get_es(esStateES_Effects) | EF_NODRAW));
    }
}

public 
Fw_DPSEnt_Think(iEnt)
{
    if(!
pev_valid(iEnt)) 
        return
    
    new 
iOwner
    iOwner 
pev(iEntpev_owner)
    
    if(!
is_user_alive(iOwner) || !is_user_connected(iOwner) || zp_get_user_zombie(iOwner))
    {
        
remove_entity(iEnt)
        
g_soundmode[iOwner] = 0
        
return
    }
    
    if(!
Get_Entity_Mode(iEnt))
    {
        new 
iWpn,iState,Float:vecOrigin[3], Float:vecAngle[3];
        
iWpn pev(iEntpev_iuser1)
        
iState pev(iWpnpev_iuser4)
        
Stock_Get_Postion(iOwner0.00.00.0vecOrigin);
        
        
pev(iOwnerpev_v_anglevecAngle);
        
vecAngle[0] = -vecAngle[0];
        
        
set_pev(iEntpev_originvecOrigin);
        
set_pev(iEntpev_anglesvecAngle);
        
        if(!
iState || get_user_weapon(iOwner) != CSW_DPS)
        {
            new 
Float:fRenderAmount;
            
pev(iEntpev_renderamtfRenderAmount);

            
fRenderAmount -= 4.5;

            if (
fRenderAmount <= 5.0)
            {
                
remove_entity(iEnt);
                return;
            }
            
set_pev(iEntpev_renderamtfRenderAmount);
        }
    }
    
    if(
Get_Entity_Mode(iEnt) == 1)
    {
        
set_pev(iEntpev_movetypeMOVETYPE_FLY)
    
        static 
Float:Origin[3]; pev(iOwnerpev_originOrigin)
        
Origin[2] -= 25.0
        
        Stock_Hook_Ent
(iEntOrigin0.01)
        
        if(
pev(iEntpev_fuser1) < get_gametime() || !IsAlive(iOwner))
        {
            
set_pev(iEntpev_flagspev(iEntpev_flags) | FL_KILLME)
            return
        }
            
        
set_pev(iEntpev_velocityFloat:{1.0,1.0,1.0});
        
set_pev(iEntpev_originOrigin);
    }
    
    if(
Get_Entity_Mode(iEnt) == 2)
    {
        new 
Float:vecOrigin[3]
        
GetGunPosition(iOwnervecOrigin);
        
        new 
Float:fOldOrigin[3];
        
pev(iEntpev_oldoriginfOldOrigin);
        
        new 
Float:vecNewOrigin[3];
        
pev(iEntpev_originvecNewOrigin);
        
        new 
Float:vecfff[3];
        
xs_vec_sub(vecOriginfOldOriginvecfff);
        
xs_vec_add(vecNewOriginvecfffvecNewOrigin);
        
        
set_pev(iEntpev_originvecNewOrigin);
        
set_pev(iEntpev_oldoriginvecOrigin);
        
        if (
pev(iEntpev_iuser1) == 2)
        {
            new 
Float:fDist get_distance_f(vecOriginvecNewOrigin);
            if (
fDist 175.0 0.5)
            {
                
remove_entity(iEnt);
                return;
            }
        }
        
        if(
g_Sound[iOwner] < get_gametime())
        {
            if(!
g_soundmode[iOwner]) emit_sound(iOwnerCHAN_ITEMweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            if(
g_soundmode[iOwner] == 1emit_sound(iOwnerCHAN_BODYweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            if(
g_soundmode[iOwner] == 2emit_sound(iOwnerCHAN_VOICEweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            if(
g_soundmode[iOwner] == 3emit_sound(iOwnerCHAN_WEAPONweapon_sound[random_num(15,19)], VOL_NORMATTN_NORM0PITCH_NORM)
            
            
g_soundmode[iOwner]++
            if(
g_soundmode[iOwner] > 3g_soundmode[iOwner] = 0
            
            g_Sound
[iOwner] = get_gametime()+0.088;
        }
    }
    
set_pev(iEntpev_nextthinkget_gametime() + 0.01)
    
    if(
Get_Entity_Mode(iEnt) == 2)
    {
        new 
Float:fTimeLast;
        
pev(iEntpev_fuser1fTimeLast);
        
        if (
fTimeLast get_gametime() || pev(pev(iEntpev_iuser2), pev_fuser1) < get_gametime())
        {
            if (
pev(iEntpev_iuser1) == 1)
            {
                new 
Float:fRenderAmount;
                
pev(iEntpev_renderamtfRenderAmount);
                
fRenderAmount -= 7.5;
                
                if (
fRenderAmount <= 5.0)
                {
                    
remove_entity(iEnt);
                    return;
                }
                
set_pev(iEntpev_renderamtfRenderAmount);
            } else 
remove_entity(iEnt);
            
            
g_soundmode[iOwner] = 0
        
}
    }
}

public 
fw_Item_PostFrame(ent)
{
    new 
id pev(entpev_owner)
    
    if(!
is_user_connected(id))
        return 
HAM_IGNORED
    
if(get_user_weapon(id) != CSW_DPS || !g_had_dps[id])
        return 
HAM_IGNORED

    
if(get_pdata_float(ent484) <= 0.01 && (!pev(entpev_iuser2) || !g_slashend[id]))
    {
        if(
g_check[id] < 6g_check[id] = 0
        set_pev
(entpev_iuser30)
        
Set_WeaponAnim(idg_mode[id]?ANIM_IDLEA:ANIM_IDLEB)
        
set_pdata_float(ent484.034)
    }
    
    new 
iButton pev(id,pev_button)
    return 
AurezBotac(identiButton)
}

public 
AurezBotac(idiEntiButton)
{
    new 
iState pev(iEntpev_iuser3)
    new 
iState2 pev(iEntpev_iuser2)
    new 
iSlash pev(iEntpev_iuser4)
    new 
Float:fSoundpev(iEntpev_fuser1fSound)
    new 
Float:fRange get_pcvar_float(g_mode[id] ? cvar_slash_range cvar_stab_range)
    
    if(!(
iButton IN_ATTACK) && get_pdata_float(iEnt46,4) <= 0.0 && iState2)
    {
        if(!
iState || iState == 1)
        {
            
Set_WeaponAnim(idANIM_STABEND)
            
set_pev(iEntpev_iuser20)
            
set_pdata_float(iEnt481.45,4)
        }
    }
    
    if(!(
iButton IN_ATTACK2) && get_pdata_float(iEnt47,4) <= 0.0 && g_slashend[id])
    {
        
Set_WeaponAnim(idANIM_SLASHEND)
        
set_pdata_float(iEnt482.03,4)
        
g_slashend[id] = 0
    
}
    
    if (
get_pdata_float(id83) <= 0.0 && pev(iEntpev_iuser1))
    {
        new 
Float:fAngle get_pcvar_float(g_mode[id] ? cvar_slash_radius cvar_stab_radius)
        new 
Float:fDamage get_pcvar_float(g_mode[id] ? cvar_damage_slash[iSlash] : cvar_damage_stab[iState])
        
        new 
iHitResult KnifeAttack_Global(idtruefRangefAnglefDamageget_pcvar_float(cvar_knockback[1+g_mode[id]]))
        switch (
iHitResult)
        {
            case 
RESULT_HIT_PLAYER client_cmd(id"spk %s"weapon_sound[g_mode[id]?random_num(9,11):iState+2]) 
            case 
RESULT_HIT_WORLD client_cmd(id"spk %s"weapon_sound[4])
        }
        
set_pev(iEntpev_iuser10);
    }
    
    if(
get_pdata_float(iEnt47,4) <= 0.0 && iSlash && iSlash <= 4)
    {
        
set_pev(iEntpev_iuser4iSlash)
        
Set_WeaponAnim(idiSlash)
        
        
set_pdata_float(id830.06)
        
        if(!
get_pcvar_num(cvar_fast_attack)) 
            
set_pdata_float(iEnt46iSlash == ? (g_check[id] == 0.43 0.7) : 0.13,4);
        
        
set_pdata_float(iEnt47iSlash == ? (g_check[id] == 0.43 0.7) : 0.13,4);
        
set_pdata_float(iEnt48iSlash == 1.4 1.0,4);
          
        
set_pev(iEntpev_iuser11)
        
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
        
SendSound(idCHAN_WEAPONweapon_sound[iSlash])
        
Create_Slash(id,iEnt,iSlash)
        
        if(
iSlash == 3
        {
            
g_slashend[id] = 1
            
            set_pev
(iEntpev_fuser1get_gametime() + (g_check[id] == 0.43 0.5))
            
set_pev(iEntpev_iuser40)
        }
    }
    
    if(
fSound && fSound get_gametime())
    {
        
SendSound(id,CHAN_VOICE,weapon_sound[g_check[id] == 13 12])
        
set_pev(iEntpev_fuser10.0)
        
        if(
g_check[id] == 5
        {
            
Set_WeaponAnim(id14)
            
SendSound(id,CHAN_ITEM,weapon_sound[20])
            
g_check[id] = 6
            
            set_pdata_float
(iEnt461.03,4)
            
set_pdata_float(iEnt471.03,4)
            
set_pdata_float(iEnt481.03,4)
            
            
set_pev(iEntpev_fuser4get_gametime()+1.7);
            
DPS_Special(id02.0)
        }
    }
    
    if(
g_check[id] == && get_pdata_float(iEnt46,4) <= 0.0)
    {
        
set_pdata_float(iEnt4611.36,4)
        
set_pdata_float(iEnt4711.36,4)
        
set_pdata_float(iEnt4811.36,4)
        
        
g_check[id] = 7
        set_pev
(iEntpev_fuser1get_gametime() + 10.6)
        
Set_WeaponAnim(id15)
    }
    
    
// NANI?!
    
if(g_check[id] == && fSound && fSound get_gametime())
    {
        
SendSound(id,CHAN_VOICE,weapon_sound[14])
        
set_pev(iEntpev_fuser10.0)
        
g_check[id] = 0
        
        DPS_Special
(id11.46)
    }
    
    
DPS_RealSpecial(idiEntfRange)
    
    if(
iButton IN_ATTACK && get_pdata_float(iEnt46,4) <= 0.0)
    {
        
g_mode[id] = 0
        g_slashend
[id] = 0
        
        set_pev
(iEntpev_iuser21)
        
set_pev(iEntpev_iuser40)
        
        switch(
iState)
        {
            case 
0:
            {
                
set_pdata_float(id830.16)
                
set_pdata_float(iEnt460.4,4);
                
                if(!
get_pcvar_num(cvar_fast_attack)) 
                    
set_pdata_float(iEnt470.4,4);
                    
                
set_pdata_float(iEnt481.0,4);
                
                
set_pev(iEntpev_iuser11)
                
set_pev(iEntpev_iuser31)
                
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
                
                
Set_WeaponAnim(idANIM_STAB1)
                
SendSound(idCHAN_WEAPONweapon_sound[0])
                
                if(!
g_check[id]) g_check[id] = 1
                
else if(g_check[id] == 2g_check[id] = 3
                
else g_check[id] = 0
            
}
            case 
1:
            {
                
set_pdata_float(id830.16)
                
set_pdata_float(iEnt460.83,4);
                
                if(!
get_pcvar_num(cvar_fast_attack)) 
                    
set_pdata_float(iEnt470.83,4);
                
                
set_pdata_float(iEnt481.5,4);
                
                
set_pev(iEntpev_iuser11)
                
set_pev(iEntpev_iuser30)
                
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
                
                
Set_WeaponAnim(idANIM_STAB2)
                
SendSound(idCHAN_WEAPONweapon_sound[1])
                
                if(
g_check[id] == 3g_check[id] = 4
                
else g_check[id] = 0
            
}
        }
    }
    
    if(
iButton IN_ATTACK2 && get_pdata_float(iEnt47) <= 0.0 && !iSlash)
    {
        
g_mode[id] = 1
        
        set_pdata_float
(id830.04)
        
        if(!
get_pcvar_num(cvar_fast_attack)) 
            
set_pdata_float(iEnt460.13,4);
        
        
set_pdata_float(iEnt470.13,4);
        
set_pdata_float(iEnt480.5,4);
        
        
set_pev(iEntpev_iuser11)
        
set_pev(iEntpev_iuser20)
        
set_pev(iEntpev_iuser30)
        
set_pev(iEntpev_iuser41)
        
set_pev(iEntpev_fuser4get_gametime() + get_pdata_float(id83))
        
        
Set_WeaponAnim(idANIM_SLASH1)
        
SendSound(idCHAN_WEAPONweapon_sound[5])
        
        
Create_Slash(id,iEnt,0)
        
        if(
g_check[id] == 1g_check[id] = 2
        
else if(g_check[id] == 4g_check[id] = 5
        
else g_check[id] = 0
    
}
    
    
iButton &= ~IN_ATTACK;
    
iButton &= ~IN_ATTACK2;
    
set_pev(idpev_buttoniButton);
    return 
HAM_IGNORED
}

stock Create_Slash(id,iEnt,seq)
{
    new 
Float:vecOrigin[3], Float:vecAngle[3];
    
GetGunPosition(idvecOrigin);
    
pev(idpev_v_anglevecAngle);
    
vecAngle[0] = -vecAngle[0];
    
    new 
pEntity DPS_Entites(id,"models/dualswordfx.mdl",vecOrigin,vecOrigin,0.01,SOLID_NOT,seq)
        
    
// Set info for ent    
    
Set_Entity_Mode(pEntity0)
    
set_pev(pEntitypev_scale0.1);
    
set_pev(pEntitypev_iuser1iEnt);
    
set_pev(pEntitypev_velocityFloat:{0.01,0.01,0.01});
    
set_pev(pEntitypev_anglesvecAngle);
    
set_pev(pEntitypev_nextthinkget_gametime()+0.01);
}

stock DPS_Special(idseqFloat:fTime)
{
    new 
Float:VecOrig[3], Float:VecAng[3]
    
pev(idpev_originVecOrig)
    
pev(idpev_anglesVecAng)
    
    new 
iEfx engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
set_pev(iEfxpev_classname"dps_entytyd");
    
set_pev(iEfxpev_originVecOrig)
    
set_pev(iEfxpev_frame0.0)
    
set_pev(iEfxpev_animtimeget_gametime())
    
set_pev(iEfxpev_framerate1.0)
    
set_pev(iEfxpev_sequenceseq)
    
engfunc(EngFunc_SetModeliEfx"models/dualsword_skill.mdl")
    
dllfunc(DLLFunc_SpawniEfx)
    
Set_Entity_Mode(iEfx1)
    
set_pev(iEfxpev_anglesVecAng)
    
set_pev(iEfxpev_solidSOLID_NOT)
    
set_pev(iEfxpev_ownerid)
    
set_pev(iEfxpev_velocityFloat:{0.01,0.01,0.01});
    
set_pev(iEfxpev_fuser1get_gametime() + fTime)
    
set_pev(iEfxpev_nextthinkget_gametime() + 0.01)
}

stock DPS_RealSpecial(idiEntFloat:fRange)
{
    new 
Float:fTimeEffect;
    
pev(iEntpev_fuser4fTimeEffect);
    
    if (
g_check[id] == && fTimeEffect && fTimeEffect <= get_gametime())
    {
        
KnifeAttack_Global(idfalseget_pcvar_float(cvar_special_range)*2.0180.0get_pcvar_float(cvar_damage_special), get_pcvar_float(cvar_knockback[2]))
            
        new 
Float:vecOrigin3[2][3], Float:vecOrigin[3];
        
pev(idpev_originvecOrigin3[0]);
        
pev(idpev_originvecOrigin);
        
xs_vec_copy(vecOrigin3[0], vecOrigin3[1]);
        
        new 
Float:fFloat random_float(fRange * -0.85fRange 0.85);
        
vecOrigin3[0][2] = vecOrigin3[1][2] = vecOrigin3[0][2] + random_float(-5.065.0);
        
        switch (
random(3))
        {
            case 
0:
            {
                
vecOrigin3[0][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] += fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] -= fFloat*random_float(-1.01.0);
            }
            case 
1:
            {
                
vecOrigin3[0][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] -= fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] += fFloat*random_float(-1.01.0);
            }
            case 
2:
            {
                
vecOrigin3[0][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] += fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] -= fFloat*random_float(-1.01.0);
            }
            case 
3:
            {
                
vecOrigin3[0][0] -= fFloat*random_float(-1.01.0);
                
vecOrigin3[0][1] -= fFloat*random_float(-1.01.0);
                
                
vecOrigin3[1][0] += fFloat*random_float(-1.01.0);
                
vecOrigin3[1][1] += fFloat*random_float(-1.01.0);
            }
        }
        
        if (
random_num(0,9) > 8)
        {
            new 
Float:vecAngle2[3];
            
vecAngle2[0] = random_num(0,1) ? random_float(-30.0, -15.0) : random_float(15.030.0);
            
vecAngle2[1] = random_num(0,1) ? random_float(-180.00.0) : random_float(0.0180.0);
            
            new 
pEntity DPS_Entites(id,"models/dualsword_skillfx1.mdl",vecOrigin3[0],vecOrigin3[0],0.01,SOLID_NOT,0)    
            
set_pev(pEntitypev_anglesvecAngle2);
            
set_pev(pEntitypev_velocityFloat:{0.01,0.01,0.01});
            
set_pev(pEntitypev_iuser11);
            
set_pev(pEntitypev_iuser2iEnt);
            
set_pev(pEntitypev_frame0.0);
            
Set_Entity_Mode(pEntity2)
            
set_pev(pEntitypev_fuser1get_gametime()+0.53);
            
set_pev(pEntitypev_fuser2get_gametime()+0.5);
            
set_pev(pEntitypev_fuser3get_gametime()+0.31);
            
set_pev(pEntitypev_oldoriginvecOrigin);
            
set_pev(pEntitypev_nextthinkget_gametime()+0.01);
        }
        
        new 
pEntity DPS_Entites(id,"models/dualsword_skillfx2.mdl",vecOrigin3[0],vecOrigin3[1],500.0,SOLID_TRIGGER,0)    
        
set_pev(pEntitypev_iuser12);
        
set_pev(pEntitypev_iuser2iEnt);
        
Set_Entity_Mode(pEntity2)
        
set_pev(pEntitypev_frame0.0);
        
set_pev(pEntitypev_oldoriginvecOrigin);
        
set_pev(pEntitypev_fuser1get_gametime()+0.2);
        
set_pev(pEntitypev_fuser2get_gametime()+0.5);
        
set_pev(pEntitypev_fuser3get_gametime()+0.3);
        
set_pev(pEntitypev_nextthinkget_gametime()+0.01);
        
        
set_pev(iEntpev_fuser4get_gametime()+0.05);
    }
}

stock DPS_Entites(idmodels[], Float:Start[3], Float:End[3], Float:speedsolidseqmove=MOVETYPE_FLY)
{
    new 
pEntity engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
        
    
// Set info for ent    
    
set_pev(pEntitypev_movetypemove);
    
set_pev(pEntitypev_ownerid);
    
engfunc(EngFunc_SetModelpEntitymodels);
    
set_pev(pEntitypev_classname"dps_entytyd");
    
set_pev(pEntitypev_minsFloat:{-1.0, -1.0, -1.0});
    
set_pev(pEntitypev_maxsFloat:{1.01.01.0});
    
set_pev(pEntitypev_originStart);
    
set_pev(pEntitypev_gravity0.01);
    
set_pev(pEntitypev_solidsolid);
    
    static 
Float:Velocity[3];
    
Stock_Get_Speed_Vector(StartEndspeedVelocity);
    
set_pev(pEntitypev_velocityVelocity);

    new 
Float:vecVAngle[3]; pev(idpev_v_anglevecVAngle);
    
vector_to_angle(VelocityvecVAngle)
    
    if(
vecVAngle[0] > 90.0vecVAngle[0] = -(360.0 vecVAngle[0]);
    
set_pev(pEntitypev_anglesvecVAngle);
    
    
set_pev(pEntitypev_rendermodekRenderTransAdd);
    
set_pev(pEntitypev_renderamt255.0);
    
set_pev(pEntitypev_sequenceseq)
    
set_pev(pEntitypev_animtimeget_gametime());
    
set_pev(pEntitypev_framerate1.0)
    return 
pEntity;
}

stock Set_Entity_Mode(iEntmodeset_pev(iEntpev_iuser3mode)
stock Get_Entity_Mode(iEnt) return pev(iEnt,pev_iuser3)

stock SendSound(idchansample[]) emit_sound(idchansampleVOL_NORMATTN_NORM0PITCH_NORM)

stock Stock_Get_Speed_Vector(const Float:origin1[3],const Float:origin2[3],Float:speedFloat:new_velocity[3])
{
    
xs_vec_sub(origin2origin1new_velocity)
    new 
Float:num floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
    
xs_vec_mul_scalar(new_velocitynumnew_velocity)
}
stock GetGunPosition(idFloat:vecSrc[3])
{
    new 
Float:vecViewOfs[3];
    
pev(idpev_originvecSrc);
    
pev(idpev_view_ofsvecViewOfs);
    
xs_vec_add(vecSrcvecViewOfsvecSrc);
}
stock KnifeAttack_Global(idbStabFloat:flRangeFloat:fAngleFloat:flDamageFloat:flKnockBack)
{
    new 
iHitResult
    
if(fAngle 0.0iHitResult KnifeAttack2(idbStabFloat:flRangeFloat:fAngleFloat:flDamageFloat:flKnockBack)
    else 
iHitResult KnifeAttack(idbStabFloat:flRangeFloat:flDamageFloat:flKnockBack)

    return 
iHitResult
}

stock KnifeAttack(idbStabFloat:flRangeFloat:flDamageFloat:flKnockBackiHitgroup = -1bitsDamageType DMG_NEVERGIB DMG_CLUB)
{
    new 
Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
    
GetGunPosition(idvecSrc);

    
pev(idpev_v_anglev_angle);
    
engfunc(EngFunc_MakeVectorsv_angle);

    
global_get(glb_v_forwardvecForward);
    
xs_vec_mul_scalar(vecForwardflRangevecForward);
    
xs_vec_add(vecSrcvecForwardvecEnd);

    new 
tr create_tr2();
    
engfunc(EngFunc_TraceLinevecSrcvecEnd0idtr);

    new 
Float:flFractionget_tr2(trTR_flFractionflFraction);
    if (
flFraction >= 1.0engfunc(EngFunc_TraceHullvecSrcvecEnd03idtr);
    
    
get_tr2(trTR_flFractionflFraction);

    new 
iHitResult RESULT_HIT_NONE;
    
    if (
flFraction 1.0)
    {
        new 
pEntity get_tr2(trTR_pHit);
        
iHitResult RESULT_HIT_WORLD;
        
        if (
pev_valid(pEntity) && (IsPlayer(pEntity) || IsHostage(pEntity)))
        {
            if (
CheckBack(idpEntity) && bStab && iHitgroup == -1)
                
flDamage *= 1.0;

            
iHitResult RESULT_HIT_PLAYER;
        }

        if (
pev_valid(pEntity))
        {
            
engfunc(EngFunc_MakeVectorsv_angle);
            
global_get(glb_v_forwardvecForward);

            if (
iHitgroup != -1)
                
set_tr2(trTR_iHitgroupiHitgroup);

            
ExecuteHamB(Ham_TraceAttackpEntityidflDamagevecForwardtrbitsDamageType);
            
ExecuteHamB(Ham_TakeDamagepEntityididflDamagebitsDamageType)
            
Stock_Fake_KnockBack(idpEntityflKnockBack)
            
            if (
IsAlive(pEntity))
            {
                
free_tr2(tr);
                return 
iHitResult;
            }
        }
    }
    
free_tr2(tr);
    return 
iHitResult;
}

stock KnifeAttack2(idbStabFloat:flRangeFloat:fAngleFloat:flDamageFloat:flKnockBackiHitgroup = -1bNoTraceCheck 0)
{
    new 
Float:vecOrigin[3], Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
    
pev(idpev_originvecOrigin);

    new 
iHitResult RESULT_HIT_NONE;
    
GetGunPosition(idvecSrc);

    
pev(idpev_v_anglev_angle);
    
engfunc(EngFunc_MakeVectorsv_angle);

    
global_get(glb_v_forwardvecForward);
    
xs_vec_mul_scalar(vecForwardflRangevecForward);
    
xs_vec_add(vecSrcvecForwardvecEnd);

    new 
tr create_tr2();
    
engfunc(EngFunc_TraceLinevecSrcvecEnd0idtr);
    
    new 
Float:EndPos2[3]
    
get_tr2(trTR_vecEndPosEndPos2)
    
    new 
Float:flFractionget_tr2(trTR_flFractionflFraction);
    if (
flFraction 1.0
    {
        
iHitResult RESULT_HIT_WORLD;
        if(
bStabStock_SakuraEffect(idEndPos2)
    }
    
    new 
Float:vecEndZ vecEnd[2];
    
    new 
pEntity = -1;
    while ((
pEntity engfunc(EngFunc_FindEntityInSpherepEntityvecOriginflRange)) != 0)
    {
        if (!
pev_valid(pEntity))
            continue;
        if (
id == pEntity)
            continue;
        if (!
IsAlive(pEntity))
            continue;
        if (!
CheckAngle(idpEntityfAngle))
            continue;

        
GetGunPosition(idvecSrc);
        
Stock_Get_Origin(pEntityvecEnd);

        
vecEnd[2] = vecSrc[2] + (vecEndZ vecSrc[2]) * (get_distance_f(vecSrcvecEnd) / flRange);

        
xs_vec_sub(vecEndvecSrcvecForward);
        
xs_vec_normalize(vecForwardvecForward);
        
xs_vec_mul_scalar(vecForwardflRangevecForward);
        
xs_vec_add(vecSrcvecForwardvecEnd);

        
engfunc(EngFunc_TraceLinevecSrcvecEnd0idtr);
        
get_tr2(trTR_flFractionflFraction);

        if (
flFraction >= 1.0engfunc(EngFunc_TraceHullvecSrcvecEnd03idtr);
        
get_tr2(trTR_flFractionflFraction);

        if (
flFraction 1.0)
        {
            if (
IsPlayer(pEntity) || IsHostage(pEntity))
            {
                
iHitResult RESULT_HIT_PLAYER;
                if(
bStabStock_SakuraEffect(idvecEnd)
                
                if (
CheckBack(idpEntity) && bStab && iHitgroup == -1)
                    
flDamage *= 1.0;
            }

            if (
get_tr2(trTR_pHit) == pEntity || bNoTraceCheck)
            {
                
engfunc(EngFunc_MakeVectorsv_angle);
                
global_get(glb_v_forwardvecForward);

                if (
iHitgroup != -1set_tr2(trTR_iHitgroupiHitgroup);

                
ExecuteHamB(Ham_TraceAttackpEntityidflDamagevecForwardtrDMG_NEVERGIB DMG_CLUB);
                
ExecuteHamB(Ham_TakeDamagepEntityididflDamageDMG_NEVERGIB DMG_CLUB)
                
                
Stock_Fake_KnockBack(idpEntityflKnockBack)
            }
        }
        
free_tr2(tr);
    }
    return 
iHitResult;
}

stock Set_WeaponAnim(idanim)
{
    
set_pev(idpev_weaponanimanim)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, {000}, id)
    
write_byte(anim)
    
write_byte(pev(idpev_body))
    
message_end()
}

stock Stock_Set_Vis(iEntiVis 1)
    
set_pev(iEntpev_effectsiVis == pev(iEntpev_effects) & ~EF_NODRAW pev(iEntpev_effects) | EF_NODRAW)

stock Stock_Hook_Ent(entFloat:TargetOrigin[3], Float:Speedmode=0)
{
    static 
Float:fl_Velocity[3],Float:EntOrigin[3],Float:distance_f,Float:fl_Time
    pev
(entpev_originEntOrigin)
    
    if(!
mode)
    {
        
distance_f get_distance_f(EntOriginTargetOrigin)
        
fl_Time distance_f Speed
            
        pev
(entpev_velocityfl_Velocity)
            
        
fl_Velocity[0] = (TargetOrigin[0] - EntOrigin[0]) / fl_Time
        fl_Velocity
[1] = (TargetOrigin[1] - EntOrigin[1]) / fl_Time
        fl_Velocity
[2] = (TargetOrigin[2] - EntOrigin[2]) / fl_Time

        
if(vector_length(fl_Velocity) > 1.0set_pev(entpev_velocityfl_Velocity)
        else 
set_pev(entpev_velocityFloat:{0.010.010.01})
    } else {
        static 
Float:fl_EntVelocity[3], Float:fl_Acc[3]
        
Stock_Directed_Vector(TargetOriginEntOriginfl_Velocity)
        
xs_vec_mul_scalar(fl_VelocitySpeedfl_Velocity)
        
        for(new 
=0i<3i++)
        {
            if(
fl_Velocity[i] > fl_EntVelocity[i]) 
            {
                
fl_Acc[i] = fl_Velocity[i]-fl_EntVelocity[i]
                
fl_Acc[i] = floatmin(70.0fl_Acc[i])
                
fl_EntVelocity[i] += fl_Acc[i]
            }
            else if(
fl_Velocity[i] < fl_EntVelocity[i])
            {
                
fl_Acc[i] = fl_EntVelocity[i]-fl_Velocity[i]
                
fl_Acc[i] = floatmin(70.0fl_Acc[i])
                
fl_EntVelocity[i] -= fl_Acc[i]
            }
        }
        
set_pev(entpev_velocityfl_EntVelocity)
    }
}

stock Stock_Directed_Vector(Float:start[3],Float:end[3],Float:reOri[3])
{    
    new 
Float:v3[3],i
    
for(i=0;i<3;i++) v3[i]=start[i]-end[i]

    new 
Float:vl vector_length(v3)
    for(
i=0;i<3;i++) reOri[i] = v3[i] / vl
}

stock Stock_Get_Postion(id,Float:forw,Float:right,Float:up,Float:vStart[])
{
    static 
Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
    
pev(idpev_originvOrigin)
    
pev(idpev_view_ofs,vUp)
    
xs_vec_add(vOrigin,vUp,vOrigin)
    
pev(idpev_v_anglevAngle)
    
    
engfunc(EngFunc_AngleVectorsvAnglevForwardvRightvUp)
    
    
vStart[0] = vOrigin[0] + vForward[0] * forw vRight[0] * right vUp[0] * up
    vStart
[1] = vOrigin[1] + vForward[1] * forw vRight[1] * right vUp[1] * up
    vStart
[2] = vOrigin[2] + vForward[2] * forw vRight[2] * right vUp[2] * up
}

stock IsPlayer(pEntity) return is_user_connected(pEntity)

stock IsHostage(pEntity)
{
    new 
classname[32]; pev(pEntitypev_classnameclassnamecharsmax(classname))
    return 
equal(classname"hostage_entity")
}

stock IsAlive(pEntity)
{
    if (
pEntity 1) return 0
    
return (pev(pEntitypev_deadflag) == DEAD_NO && pev(pEntitypev_health) > 0)
}

stock CheckBack(iEnemy,id)
{
    new 
Float:anglea[3], Float:anglev[3]
    
pev(iEnemypev_v_angleanglea)
    
pev(idpev_v_angleanglev)
    new 
Float:angle anglea[1] - anglev[1
    if (
angle < -180.0angle += 360.0
    
if (angle <= 45.0 && angle >= -45.0) return 1
    
return 0
}

stock CheckAngle(iAttackeriVictimFloat:fAngle)  return(Stock_CheckAngle(iAttackeriVictim) > floatcos(fAngle,degrees))

stock Float:Stock_CheckAngle(id,iTarget)
{
    new 
Float:vOricross[2],Float:fRad,Float:vId_ori[3],Float:vTar_ori[3],Float:vId_ang[3],Float:fLength,Float:vForward[3]
    
Stock_Get_Origin(idvId_ori)
    
Stock_Get_Origin(iTargetvTar_ori)
    
    
pev(id,pev_angles,vId_ang)
    for(new 
i=0;i<2;i++) vOricross[i] = vTar_ori[i] - vId_ori[i]
    
    
fLength floatsqroot(vOricross[0]*vOricross[0] + vOricross[1]*vOricross[1])
    
    if (
fLength<=0.0)
    {
        
vOricross[0]=0.0
        vOricross
[1]=0.0
    
} else {
        
vOricross[0]=vOricross[0]*(1.0/fLength)
        
vOricross[1]=vOricross[1]*(1.0/fLength)
    }
    
    
engfunc(EngFunc_MakeVectors,vId_ang)
    
global_get(glb_v_forward,vForward)
    
    
fRad vOricross[0]*vForward[0]+vOricross[1]*vForward[1]
    return 
fRad   //->   RAD 90' = 0.5rad
}

stock Stock_Get_Origin(idFloat:origin[3])
{
    new 
Float:maxs[3],Float:mins[3]
    if (
pev(idpev_solid) == SOLID_BSP)
    {
        
pev(id,pev_maxs,maxs)
        
pev(id,pev_mins,mins)
        
origin[0] = (maxs[0] - mins[0]) / mins[0]
        
origin[1] = (maxs[1] - mins[1]) / mins[1]
        
origin[2] = (maxs[2] - mins[2]) / mins[2]
    } else 
pev(idpev_originorigin)
}

public 
Stock_Fake_KnockBack(idiVicFloat:iKb)
{
    if(
iVic 32) return
    
    new 
Float:vAttacker[3], Float:vVictim[3], Float:vVelocity[3], flags
    pev
(idpev_originvAttacker)
    
pev(iVicpev_originvVictim)
    
vAttacker[2] = vVictim[2] = 0.0
    flags 
pev(idpev_flags)
    
    
xs_vec_sub(vVictimvAttackervVictim)
    new 
Float:fDistance
    fDistance 
xs_vec_len(vVictim)
    
xs_vec_mul_scalar(vVictimfDistancevVictim)
    
    
pev(iVicpev_velocityvVelocity)
    
xs_vec_mul_scalar(vVictimiKbvVictim)
    
xs_vec_mul_scalar(vVictim50.0vVictim)
    
vVictim[2] = xs_vec_len(vVictim) * 0.15
    
    
if(flags &~ FL_ONGROUND)
    {
        
xs_vec_mul_scalar(vVictim1.2vVictim)
        
vVictim[2] *= 0.4
    
}
    if(
xs_vec_len(vVictim) > xs_vec_len(vVelocity)) set_pev(iVicpev_velocityvVictim)
}    

stock Float:Stock_Get_Body_Dmg(iBody)
{
    switch (
iBody)
    {
        case 
HIT_GENERIC: return 0.75
        
case 1: return 4.0
        
case 2: return 1.0
        
case 3: return 1.25
        
case 4,5,6,7: return 0.75
        
default: return 0.75
    
}
    return 
1.0
}

stock Stock_SakuraEffect(idFloat:vecOri[3])
{
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYvecOri)
    
write_byte(TE_BLOODSPRITE)
    
engfunc(EngFunc_WriteCoord,vecOri[0])
    
engfunc(EngFunc_WriteCoord,vecOri[1])
    
engfunc(EngFunc_WriteCoord,vecOri[2])
    
write_short(ef_sakura[g_mode[id]?2:0])
    
write_short(ef_sakura[g_mode[id]?3:1])
    
write_byte(g_mode[id]?178:128)
    
write_byte(random_num(2,3))
    
message_end()
}

stock can_damage(id1id2)
{
    if(
id1 <= || id1 >= 33 || id2 <= || id2 >= 33)
        return 
1
        
    
// Check team
    
return(get_pdata_int(id1114) != get_pdata_int(id2114))
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 
----------------------------------------------------------------------------------------------------------------
Replace those codes to this plugin
PHP Code:
#include <cstrike>

#define ADMIN_ACCESS ADMIN_KICK

public plugin_init() {

    
RegisterHam(Ham_Spawn"player""PlayerRespawn"1);

}

public 
PlayerRespawn(id)
{
    new 
Flag get_user_flags(id)
    
    if (!
is_user_alive(id))
        return;
    
    if( 
Flag ADMIN_ACCESS && cs_get_user_team(id) == CS_TEAM_CT
    {
        
g_had_dps[id] = 1
        g_mode
[id] = 0
        g_slashend
[id] = 0
        g_check
[id] = 0
        g_soundmode
[id] = 0
        
        fm_give_item
(idweapon_dps)
        
        if (
get_user_weapon(id) == CSW_DPSEvent_CurWeapon(id)
        else 
engclient_cmd(id,weapon_dps)
    }


Change this line from this

PHP Code:
public client_connect(idremove_dps(id
to this

PHP Code:
//public client_connect(id) remove_dps(id) 

Last edited by Supremache; 06-25-2020 at 06:50.
Supremache is offline
mohanad
Junior Member
Join Date: Jun 2020
Old 06-25-2020 , 10:00   Re: Help on Plugin plz
Reply With Quote #4

when i do compile it say : undefined symbol "AMXX_VERSION_NUM"
this is the code after i did what you said :
PHP Code:
/* Plugin generated by AMXX-Studio */
#pragma compress 1

#include <cstrike>
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <xs>
#include <zombieplague>

#define PLUGIN "CSO Dual Sword Phantom Slayer"
#define VERSION "1.0"
#define AUTHOR "Natasha aka Asdian"

#define ADMIN_ACCESS ADMIN_KICK
#define CSW_DPS CSW_KNIFE
#define weapon_dps "weapon_knife"

#define v_model "models/v_dualsword.mdl"
#define p_model "models/p_dualsword_a.mdl"
#define p_model2 "models/p_dualsword_b.mdl"
#define spr_wpn    "knife_dualsword"

new const weapon_sound[][] =
{
    
"weapons/dualsword_stab1.wav",                // 0
    
"weapons/dualsword_stab2.wav",                // 1
    
"weapons/dualsword_stab1_hit.wav",            // 2
    
"weapons/dualsword_stab2_hit.wav",            // 3
    
"weapons/katanad_hitwall.wav",                // 4
    
    
"weapons/dualsword_slash_1.wav",            // 5
    
"weapons/dualsword_slash_2.wav",            // 6
    
"weapons/dualsword_slash_3.wav",            // 7
    
"weapons/dualsword_slash_4.wav",            // 8
    
"weapons/dualsword_hit1.wav",                // 9
    
"weapons/dualsword_hit2.wav",                // 10
    
"weapons/dualsword_hit3.wav",                // 11
    
"weapons/dualsword_slash_4_1.wav",            // 12
    
"weapons/dualsword_slash_4_2.wav",            // 13
    
"weapons/dualsword_skill_end.wav",            // 14
    
    
"weapons/dualsword_fly1.wav",                // 15
    
"weapons/dualsword_fly2.wav",                // 16
    
"weapons/dualsword_fly3.wav",                // 17
    
"weapons/dualsword_fly4.wav",                // 18
    
"weapons/dualsword_fly5.wav",                // 19
    
"weapons/dualsword_skill_start.wav"
}

//Hit
#define    RESULT_HIT_NONE             0
#define    RESULT_HIT_PLAYER            1
#define    RESULT_HIT_WORLD            2

enum _:WpnAnim
{
    
ANIM_IDLEA 0,
    
ANIM_SLASH1,
    
ANIM_SLASH2,
    
ANIM_SLASH3,
    
ANIM_SLASH4,
    
ANIM_SLASHEND,
    
ANIM_DRAWA,
    
ANIM_IDLEB,
    
ANIM_STAB1,
    
ANIM_STAB2,
    
ANIM_STABEND,
    
ANIM_DRAWB
}

new 
g_had_dps[33], g_mode[33], g_slashend[33], g_check[33], g_dpsg_soundmode[33]
new 
ef_sakura[4]
new 
Float:g_Sound[33]

new 
cvar_damage_slash[4], cvar_slash_radiuscvar_slash_range
new cvar_damage_stab[2], cvar_stab_radiuscvar_stab_range
new cvar_damage_specialcvar_special_range
new cvar_knockback[3], cvar_fast_attackcvar_removecvar_spr

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
    
register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
    
register_event("HLTV""Event_NewRound""a""1=0""2=0")
    
register_forward(FM_AddToFullPack"Fw_AddToFullPack_Post"1);

    
register_think("dps_entytyd""Fw_DPSEnt_Think")
    
    
RegisterHam(Ham_Item_PostFrameweapon_dps"fw_Item_PostFrame")
    
RegisterHam(Ham_Spawn"player""PlayerRespawn"1);
    
    
g_dps zp_register_extra_item("Dual Sword Phantom Slayer"0ZP_TEAM_HUMAN)
    
register_clcmd(spr_wpn"hook_rb")
    
    
cvar_damage_slash[0] = register_cvar("dps_slashdamage_4","486.0")
    
cvar_damage_slash[1] = register_cvar("dps_slashdamage_1","120.0")
    
cvar_damage_slash[2] = register_cvar("dps_slashdamage_2","140.0")
    
cvar_damage_slash[3] = register_cvar("dps_slashdamage_3","360.0")
    
cvar_slash_radius register_cvar("dps_slashradius","120.0")
    
cvar_slash_range register_cvar("dps_slashrange","95.0")
    
    
cvar_damage_stab[0] = register_cvar("dps_stabdamage_2","1200.0")
    
cvar_damage_stab[1] = register_cvar("dps_stabdamage_1","350.0")
    
cvar_stab_radius register_cvar("dps_stabradius","90.0")
    
cvar_stab_range register_cvar("dps_stabrange","150.0")
    
    
cvar_damage_special register_cvar("dps_specialdamage","95.0")
    
cvar_special_range register_cvar("dps_specialrange","120.0")
    
    
cvar_knockback[0] = register_cvar("dps_slashknockback","0.0")
    
cvar_knockback[1] = register_cvar("dps_stabknockback","0.0")
    
cvar_knockback[2] = register_cvar("dps_specialknockback","0.0")
    
    
cvar_fast_attack register_cvar("dps_fast_attack_enabled""0")
    
cvar_remove register_cvar("dps_remove_onnewround""0")
    
cvar_spr register_cvar("dps_enable_sprites""1")
    
    
g_dps zp_register_extra_item("Dual Sword Phantom Slayer"10ZP_TEAM_HUMAN)
}

public 
PlayerRespawn(id)
{
    new 
Flag get_user_flags(id)
    
    if (!
is_user_alive(id))
        return;
    
    if( 
Flag ADMIN_ACCESS && cs_get_user_team(id) == CS_TEAM_CT
    {
        
g_had_dps[id] = 1
        g_mode
[id] = 0
        g_slashend
[id] = 0
        g_check
[id] = 0
        g_soundmode
[id] = 0
        
        fm_give_item
(idweapon_dps)
        
        if (
get_user_weapon(id) == CSW_DPSEvent_CurWeapon(id)
        else 
engclient_cmd(id,weapon_dps)
    }

}

public 
<