Dual Sword Phantom Slayer Crashing Server

Unpaid Requests, Public Plugins
Post Reply
Mystic Viper
Senior Member
Senior Member
Romania
Posts: 104
Joined: 11 Months Ago
Has thanked: 1 time
Been thanked: 3 times
Contact:

Dual Sword Phantom Slayer Crashing Server

#1

Post by Mystic Viper » 2 Months Ago

  1. /* Plugin generated by AMXX-Studio */
  2. #pragma compress 1
  3.  
  4. #include <amxmodx>
  5. #include <engine>
  6. #include <fakemeta>
  7. #include <fakemeta_util>
  8. #include <hamsandwich>
  9. #include <xs>
  10. #include <zombie_escape>
  11. #include <ze_vip>
  12.  
  13. #define PLUGIN "CSO Dual Sword Phantom Slayer"
  14. #define VERSION "1.0"
  15. #define AUTHOR "Natasha aka Asdian"
  16.  
  17. #define CSW_DPS CSW_KNIFE
  18. #define weapon_dps "weapon_knife"
  19.  
  20. #define v_model "models/v_dualsword.mdl"
  21. #define p_model "models/p_dualsword_a.mdl"
  22. #define p_model2 "models/p_dualsword_b.mdl"
  23. #define spr_wpn "knife_dualsword"
  24.  
  25. new const weapon_sound[][] =
  26. {
  27.     "weapons/dualsword_stab1.wav",              // 0
  28.     "weapons/dualsword_stab2.wav",              // 1
  29.     "weapons/dualsword_stab1_hit.wav",          // 2
  30.     "weapons/dualsword_stab2_hit.wav",          // 3
  31.     "weapons/katanad_hitwall.wav",              // 4
  32.    
  33.     "weapons/dualsword_slash_1.wav",            // 5
  34.     "weapons/dualsword_slash_2.wav",            // 6
  35.     "weapons/dualsword_slash_3.wav",            // 7
  36.     "weapons/dualsword_slash_4.wav",            // 8
  37.     "weapons/dualsword_hit1.wav",               // 9
  38.     "weapons/dualsword_hit2.wav",               // 10
  39.     "weapons/dualsword_hit3.wav",               // 11
  40.     "weapons/dualsword_slash_4_1.wav",          // 12
  41.     "weapons/dualsword_slash_4_2.wav",          // 13
  42.     "weapons/dualsword_skill_end.wav",          // 14
  43.    
  44.     "weapons/dualsword_fly1.wav",               // 15
  45.     "weapons/dualsword_fly2.wav",               // 16
  46.     "weapons/dualsword_fly3.wav",               // 17
  47.     "weapons/dualsword_fly4.wav",               // 18
  48.     "weapons/dualsword_fly5.wav",               // 19
  49.     "weapons/dualsword_skill_start.wav"
  50. }
  51.  
  52. //Hit
  53. #define RESULT_HIT_NONE             0
  54. #define RESULT_HIT_PLAYER           1
  55. #define RESULT_HIT_WORLD            2
  56.  
  57. enum _:WpnAnim
  58. {
  59.     ANIM_IDLEA = 0,
  60.     ANIM_SLASH1,
  61.     ANIM_SLASH2,
  62.     ANIM_SLASH3,
  63.     ANIM_SLASH4,
  64.     ANIM_SLASHEND,
  65.     ANIM_DRAWA,
  66.     ANIM_IDLEB,
  67.     ANIM_STAB1,
  68.     ANIM_STAB2,
  69.     ANIM_STABEND,
  70.     ANIM_DRAWB
  71. }
  72.  
  73. new g_had_dps[33], g_mode[33], g_slashend[33], g_check[33], g_dps, g_soundmode[33]
  74. new ef_sakura[4]
  75. new Float:g_Sound[33]
  76.  
  77. new cvar_damage_slash[4], cvar_slash_radius, cvar_slash_range
  78. new cvar_damage_stab[2], cvar_stab_radius, cvar_stab_range
  79. new cvar_damage_special, cvar_special_range
  80. new cvar_knockback[3], cvar_fast_attack, cvar_remove, cvar_spr
  81.  
  82. public plugin_init()
  83. {
  84.     register_plugin(PLUGIN, VERSION, AUTHOR)
  85.    
  86.     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
  87.     register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
  88.     register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
  89.     register_forward(FM_AddToFullPack, "Fw_AddToFullPack_Post", 1);
  90.  
  91.     register_think("dps_entytyd", "Fw_DPSEnt_Think")
  92.    
  93.     RegisterHam(Ham_Item_PostFrame, weapon_dps, "fw_Item_PostFrame")
  94.    
  95.     register_clcmd(spr_wpn, "hook_rb")
  96.    
  97.     cvar_damage_slash[0] = register_cvar("dps_slashdamage_4","486.0")
  98.     cvar_damage_slash[1] = register_cvar("dps_slashdamage_1","120.0")
  99.     cvar_damage_slash[2] = register_cvar("dps_slashdamage_2","140.0")
  100.     cvar_damage_slash[3] = register_cvar("dps_slashdamage_3","360.0")
  101.     cvar_slash_radius = register_cvar("dps_slashradius","120.0")
  102.     cvar_slash_range = register_cvar("dps_slashrange","95.0")
  103.    
  104.     cvar_damage_stab[0] = register_cvar("dps_stabdamage_2","1200.0")
  105.     cvar_damage_stab[1] = register_cvar("dps_stabdamage_1","350.0")
  106.     cvar_stab_radius = register_cvar("dps_stabradius","90.0")
  107.     cvar_stab_range = register_cvar("dps_stabrange","150.0")
  108.    
  109.     cvar_damage_special = register_cvar("dps_specialdamage","95.0")
  110.     cvar_special_range = register_cvar("dps_specialrange","120.0")
  111.    
  112.     cvar_knockback[0] = register_cvar("dps_slashknockback","0.0")
  113.     cvar_knockback[1] = register_cvar("dps_stabknockback","0.0")
  114.     cvar_knockback[2] = register_cvar("dps_specialknockback","0.0")
  115.    
  116.     cvar_fast_attack = register_cvar("dps_fast_attack_enabled", "0")
  117.     cvar_remove = register_cvar("dps_remove_onnewround", "0")
  118.     cvar_spr = register_cvar("dps_enable_sprites", "1")
  119.    
  120.     g_dps = ze_register_item("Dual Sword Phantom Slayer \r(VIP)", 50, 0)
  121. }
  122.  
  123. public plugin_precache()
  124. {
  125.     precache_model(v_model)
  126.     precache_model(p_model)
  127.     precache_model(p_model2)
  128.    
  129.     for(new i = 0; i < sizeof(weapon_sound); i++)
  130.         precache_sound(weapon_sound[i])
  131.    
  132.     precache_model("models/dualswordfx.mdl")
  133.     precache_model("models/dualsword_skill.mdl")
  134.     precache_model("models/dualsword_skillfx1.mdl")
  135.     precache_model("models/dualsword_skillfx2.mdl")
  136.    
  137.     ef_sakura[0] = precache_model("sprites/leaf01_dualsword.spr")
  138.     ef_sakura[1] = precache_model("sprites/leaf02_dualsword.spr")
  139.     ef_sakura[2] = precache_model("sprites/petal01_dualsword.spr")
  140.     ef_sakura[3] = precache_model("sprites/petal02_dualsword.spr")
  141.    
  142.     new Txt[32]
  143.     format(Txt, 31, "sprites/%s.txt", spr_wpn)
  144.     engfunc(EngFunc_PrecacheGeneric, Txt)
  145. }
  146.  
  147. public ze_user_infected(id) remove_dps(id)
  148. public ze_user_humanized(id) remove_dps(id)
  149.  
  150. public hook_rb(id)
  151. {
  152.     engclient_cmd(id, weapon_dps)
  153.     return PLUGIN_HANDLED
  154. }
  155.  
  156. public get_dps(id)
  157. {
  158.     if (!is_user_alive(id))
  159.         return
  160.  
  161.     g_had_dps[id] = 1
  162.     g_mode[id] = 0
  163.     g_slashend[id] = 0
  164.     g_check[id] = 0
  165.     g_soundmode[id] = 0
  166.    
  167.     fm_give_item(id, weapon_dps)
  168.    
  169.     if (get_user_weapon(id) == CSW_DPS) Event_CurWeapon(id)
  170.     else engclient_cmd(id,weapon_dps)
  171. }
  172.  
  173. public client_connected(id) remove_dps(id)
  174. public client_disconnected(id) remove_dps(id)
  175.  
  176. public Event_NewRound()
  177. {
  178.     if(!get_pcvar_num(cvar_remove))
  179.         return
  180.    
  181.     for(new i = 0; i < get_maxplayers(); i++)
  182.         remove_dps(i)
  183. }
  184.  
  185. public remove_dps(id)
  186. {
  187.     g_had_dps[id] = 0
  188.     g_slashend[id] = 0
  189.     g_check[id] = 0
  190.    
  191.     static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)
  192.     if(!pev_valid(iEnt)) return
  193.    
  194.     set_pev(iEnt, pev_iuser1, 0)
  195.     set_pev(iEnt, pev_iuser2, 0)
  196.     set_pev(iEnt, pev_iuser3, 0)
  197.     set_pev(iEnt, pev_iuser4, 0)
  198.     set_pev(iEnt, pev_fuser1, 0.0)
  199. }
  200.  
  201. public ze_select_item_pre(id, itemid)
  202. {  
  203.     if (itemid != g_dps)
  204.         return ZE_ITEM_AVAILABLE
  205.            
  206.     if (ze_is_user_zombie(id))
  207.         return ZE_ITEM_DONT_SHOW
  208.  
  209.         if (!(ze_get_vip_flags(id) & VIP_A))
  210.         return ZE_ITEM_DONT_SHOW
  211.        
  212.     return ZE_ITEM_AVAILABLE
  213. }
  214.  
  215. public ze_select_item_post(id, itemid)
  216. {
  217.     if (itemid != g_dps)
  218.         return
  219.    
  220.     get_dps(id)
  221. }
  222.  
  223. public Event_CurWeapon(id)
  224. {
  225.     if(!is_user_alive(id))
  226.         return 1
  227.     if(get_user_weapon(id) != CSW_DPS)
  228.         return 1
  229.     if(!g_had_dps[id])
  230.         return 1
  231.     if(ze_is_user_zombie(id))
  232.         return 1
  233.        
  234.     set_pev(id, pev_viewmodel2, v_model)
  235.     set_pev(id, pev_weaponmodel2, g_mode[id] ? p_model2:p_model)
  236.    
  237.     Set_WeaponAnim(id, g_mode[id]?ANIM_DRAWA:ANIM_DRAWB)
  238.    
  239.     static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)
  240.     if(!pev_valid(iEnt)) return 1
  241.    
  242.     set_pev(iEnt, pev_iuser1, 0)
  243.     set_pev(iEnt, pev_iuser2, 0)
  244.     set_pev(iEnt, pev_iuser3, 0)
  245.     set_pev(iEnt, pev_iuser4, 0)
  246.     set_pev(iEnt, pev_fuser1, 0.0)
  247.        
  248.     g_slashend[id] = 0
  249.     g_check[id] = 0
  250.    
  251.     set_pdata_float(id, 83, 0.23)
  252.     set_pdata_float(iEnt, 46, 0.25);
  253.     set_pdata_float(iEnt, 47, 0.25);
  254.     set_pdata_float(iEnt, 48, 0.25);
  255.    
  256.     if(get_pcvar_num(cvar_spr))
  257.     {
  258.         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
  259.         write_string(g_had_dps[id] == 1 ? spr_wpn : weapon_dps)
  260.         write_byte(-1)
  261.         write_byte(-1)
  262.         write_byte(-1)
  263.         write_byte(-1)
  264.         write_byte(2)
  265.         write_byte(1)
  266.         write_byte(CSW_DPS)
  267.         write_byte(0)
  268.         message_end()
  269.     }
  270.     return 0
  271. }
  272.  
  273. public message_DeathMsg(msg_id, msg_dest, msg_ent)
  274. {
  275.     new szWeapon[64]
  276.     get_msg_arg_string(4, szWeapon, charsmax(szWeapon))
  277.    
  278.     if (strcmp(szWeapon, "knife"))
  279.         return PLUGIN_CONTINUE
  280.  
  281.     new iEntity = get_pdata_cbase(get_msg_arg_int(1), 373)
  282.     if (!pev_valid(iEntity) || get_pdata_int(iEntity, 43, 4) != CSW_DPS || !g_had_dps[get_msg_arg_int(1)])
  283.         return PLUGIN_CONTINUE
  284.  
  285.     set_msg_arg_string(4, "dualsword")
  286.     return PLUGIN_CONTINUE
  287. }
  288.  
  289. public Fw_AddToFullPack_Post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
  290. {
  291.     if (!pev_valid(iEnt))
  292.         return;
  293.     if (pev(iEnt, pev_flags) & FL_KILLME)
  294.         return;
  295.  
  296.     new classname[32];
  297.     pev(iEnt, pev_classname, classname, 31);
  298.  
  299.     if (equal(classname,"dps_entytyd") && pev(iEnt, pev_iuser4))
  300.     {
  301.         if (iHost != pev(iEnt, pev_owner))
  302.             set_es(esState, ES_Effects, (get_es(esState, ES_Effects) | EF_NODRAW));
  303.     }
  304. }
  305.  
  306. public Fw_DPSEnt_Think(iEnt)
  307. {
  308.     if(!pev_valid(iEnt))
  309.         return
  310.    
  311.     new iOwner
  312.     iOwner = pev(iEnt, pev_owner)
  313.    
  314.     if(!is_user_alive(iOwner) || !is_user_connected(iOwner) || ze_is_user_zombie(iOwner))
  315.     {
  316.         remove_entity(iEnt)
  317.         g_soundmode[iOwner] = 0
  318.         return
  319.     }
  320.    
  321.     if(!Get_Entity_Mode(iEnt))
  322.     {
  323.         new iWpn,iState,Float:vecOrigin[3], Float:vecAngle[3];
  324.         iWpn = pev(iEnt, pev_iuser1)
  325.         iState = pev(iWpn, pev_iuser4)
  326.         Stock_Get_Postion(iOwner, 0.0, 0.0, 0.0, vecOrigin);
  327.        
  328.         pev(iOwner, pev_v_angle, vecAngle);
  329.         vecAngle[0] = -vecAngle[0];
  330.        
  331.         set_pev(iEnt, pev_origin, vecOrigin);
  332.         set_pev(iEnt, pev_angles, vecAngle);
  333.        
  334.         if(!iState || get_user_weapon(iOwner) != CSW_DPS)
  335.         {
  336.             new Float:fRenderAmount;
  337.             pev(iEnt, pev_renderamt, fRenderAmount);
  338.  
  339.             fRenderAmount -= 4.5;
  340.  
  341.             if (fRenderAmount <= 5.0)
  342.             {
  343.                 remove_entity(iEnt);
  344.                 return;
  345.             }
  346.             set_pev(iEnt, pev_renderamt, fRenderAmount);
  347.         }
  348.     }
  349.    
  350.     if(Get_Entity_Mode(iEnt) == 1)
  351.     {
  352.         set_pev(iEnt, pev_movetype, MOVETYPE_FLY)
  353.    
  354.         static Float:Origin[3]; pev(iOwner, pev_origin, Origin)
  355.         Origin[2] -= 25.0
  356.        
  357.         Stock_Hook_Ent(iEnt, Origin, 0.01)
  358.        
  359.         if(pev(iEnt, pev_fuser1) < get_gametime() || !IsAlive(iOwner))
  360.         {
  361.             set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME)
  362.             return
  363.         }
  364.            
  365.         set_pev(iEnt, pev_velocity, Float:{1.0,1.0,1.0});
  366.         set_pev(iEnt, pev_origin, Origin);
  367.     }
  368.    
  369.     if(Get_Entity_Mode(iEnt) == 2)
  370.     {
  371.         new Float:vecOrigin[3]
  372.         GetGunPosition(iOwner, vecOrigin);
  373.        
  374.         new Float:fOldOrigin[3];
  375.         pev(iEnt, pev_oldorigin, fOldOrigin);
  376.        
  377.         new Float:vecNewOrigin[3];
  378.         pev(iEnt, pev_origin, vecNewOrigin);
  379.        
  380.         new Float:vecfff[3];
  381.         xs_vec_sub(vecOrigin, fOldOrigin, vecfff);
  382.         xs_vec_add(vecNewOrigin, vecfff, vecNewOrigin);
  383.        
  384.         set_pev(iEnt, pev_origin, vecNewOrigin);
  385.         set_pev(iEnt, pev_oldorigin, vecOrigin);
  386.        
  387.         if (pev(iEnt, pev_iuser1) == 2)
  388.         {
  389.             new Float:fDist = get_distance_f(vecOrigin, vecNewOrigin);
  390.             if (fDist > 175.0 * 0.5)
  391.             {
  392.                 remove_entity(iEnt);
  393.                 return;
  394.             }
  395.         }
  396.        
  397.         if(g_Sound[iOwner] < get_gametime())
  398.         {
  399.             if(!g_soundmode[iOwner]) emit_sound(iOwner, CHAN_ITEM, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  400.             if(g_soundmode[iOwner] == 1) emit_sound(iOwner, CHAN_BODY, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  401.             if(g_soundmode[iOwner] == 2) emit_sound(iOwner, CHAN_VOICE, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  402.             if(g_soundmode[iOwner] == 3) emit_sound(iOwner, CHAN_WEAPON, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  403.            
  404.             g_soundmode[iOwner]++
  405.             if(g_soundmode[iOwner] > 3) g_soundmode[iOwner] = 0
  406.            
  407.             g_Sound[iOwner] = get_gametime()+0.088;
  408.         }
  409.     }
  410.     set_pev(iEnt, pev_nextthink, get_gametime() + 0.01)
  411.    
  412.     if(Get_Entity_Mode(iEnt) == 2)
  413.     {
  414.         new Float:fTimeLast;
  415.         pev(iEnt, pev_fuser1, fTimeLast);
  416.        
  417.         if (fTimeLast < get_gametime() || pev(pev(iEnt, pev_iuser2), pev_fuser1) < get_gametime())
  418.         {
  419.             if (pev(iEnt, pev_iuser1) == 1)
  420.             {
  421.                 new Float:fRenderAmount;
  422.                 pev(iEnt, pev_renderamt, fRenderAmount);
  423.                 fRenderAmount -= 7.5;
  424.                
  425.                 if (fRenderAmount <= 5.0)
  426.                 {
  427.                     remove_entity(iEnt);
  428.                     return;
  429.                 }
  430.                 set_pev(iEnt, pev_renderamt, fRenderAmount);
  431.             } else remove_entity(iEnt);
  432.            
  433.             g_soundmode[iOwner] = 0
  434.         }
  435.     }
  436. }
  437.  
  438. public fw_Item_PostFrame(ent)
  439. {
  440.     new id = pev(ent, pev_owner)
  441.    
  442.     if(!is_user_connected(id))
  443.         return HAM_IGNORED
  444.     if(get_user_weapon(id) != CSW_DPS || !g_had_dps[id])
  445.         return HAM_IGNORED
  446.  
  447.     if(get_pdata_float(ent, 48, 4) <= 0.01 && (!pev(ent, pev_iuser2) || !g_slashend[id]))
  448.     {
  449.         if(g_check[id] < 6) g_check[id] = 0
  450.         set_pev(ent, pev_iuser3, 0)
  451.         Set_WeaponAnim(id, g_mode[id]?ANIM_IDLEA:ANIM_IDLEB)
  452.         set_pdata_float(ent, 48, 4.03, 4)
  453.     }
  454.    
  455.     new iButton = pev(id,pev_button)
  456.     return AurezBotac(id, ent, iButton)
  457. }
  458.  
  459. public AurezBotac(id, iEnt, iButton)
  460. {
  461.     new iState = pev(iEnt, pev_iuser3)
  462.     new iState2 = pev(iEnt, pev_iuser2)
  463.     new iSlash = pev(iEnt, pev_iuser4)
  464.     new Float:fSound; pev(iEnt, pev_fuser1, fSound)
  465.     new Float:fRange = get_pcvar_float(g_mode[id] ? cvar_slash_range : cvar_stab_range)
  466.    
  467.     if(!(iButton & IN_ATTACK) && get_pdata_float(iEnt, 46,4) <= 0.0 && iState2)
  468.     {
  469.         if(!iState || iState == 1)
  470.         {
  471.             Set_WeaponAnim(id, ANIM_STABEND)
  472.             set_pev(iEnt, pev_iuser2, 0)
  473.             set_pdata_float(iEnt, 48, 1.45,4)
  474.         }
  475.     }
  476.    
  477.     if(!(iButton & IN_ATTACK2) && get_pdata_float(iEnt, 47,4) <= 0.0 && g_slashend[id])
  478.     {
  479.         Set_WeaponAnim(id, ANIM_SLASHEND)
  480.         set_pdata_float(iEnt, 48, 2.03,4)
  481.         g_slashend[id] = 0
  482.     }
  483.    
  484.     if (get_pdata_float(id, 83) <= 0.0 && pev(iEnt, pev_iuser1))
  485.     {
  486.         new Float:fAngle = get_pcvar_float(g_mode[id] ? cvar_slash_radius : cvar_stab_radius)
  487.         new Float:fDamage = get_pcvar_float(g_mode[id] ? cvar_damage_slash[iSlash] : cvar_damage_stab[iState])
  488.        
  489.         new iHitResult = KnifeAttack_Global(id, true, fRange, fAngle, fDamage, get_pcvar_float(cvar_knockback[1+g_mode[id]]))
  490.         switch (iHitResult)
  491.         {
  492.             case RESULT_HIT_PLAYER : client_cmd(id, "spk %s", weapon_sound[g_mode[id]?random_num(9,11):iState+2])
  493.             case RESULT_HIT_WORLD : client_cmd(id, "spk %s", weapon_sound[4])
  494.         }
  495.         set_pev(iEnt, pev_iuser1, 0);
  496.     }
  497.    
  498.     if(get_pdata_float(iEnt, 47,4) <= 0.0 && iSlash && iSlash <= 4)
  499.     {
  500.         set_pev(iEnt, pev_iuser4, 1 + iSlash)
  501.         Set_WeaponAnim(id, 1 + iSlash)
  502.        
  503.         set_pdata_float(id, 83, 0.06)
  504.        
  505.         if(!get_pcvar_num(cvar_fast_attack))
  506.             set_pdata_float(iEnt, 46, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);
  507.        
  508.         set_pdata_float(iEnt, 47, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);
  509.         set_pdata_float(iEnt, 48, iSlash == 3 ? 1.4 : 1.0,4);
  510.          
  511.         set_pev(iEnt, pev_iuser1, 1)
  512.         set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  513.         SendSound(id, CHAN_WEAPON, weapon_sound[5 + iSlash])
  514.         Create_Slash(id,iEnt,iSlash)
  515.        
  516.         if(iSlash == 3)
  517.         {
  518.             g_slashend[id] = 1
  519.            
  520.             set_pev(iEnt, pev_fuser1, get_gametime() + (g_check[id] == 5 ? 0.43 : 0.5))
  521.             set_pev(iEnt, pev_iuser4, 0)
  522.         }
  523.     }
  524.    
  525.     if(fSound && fSound < get_gametime())
  526.     {
  527.         SendSound(id,CHAN_VOICE,weapon_sound[g_check[id] == 5 ? 13 : 12])
  528.         set_pev(iEnt, pev_fuser1, 0.0)
  529.        
  530.         if(g_check[id] == 5)
  531.         {
  532.             Set_WeaponAnim(id, 14)
  533.             SendSound(id,CHAN_ITEM,weapon_sound[20])
  534.             g_check[id] = 6
  535.            
  536.             set_pdata_float(iEnt, 46, 1.03,4)
  537.             set_pdata_float(iEnt, 47, 1.03,4)
  538.             set_pdata_float(iEnt, 48, 1.03,4)
  539.            
  540.             set_pev(iEnt, pev_fuser4, get_gametime()+1.7);
  541.             DPS_Special(id, 0, 2.0)
  542.         }
  543.     }
  544.    
  545.     if(g_check[id] == 6 && get_pdata_float(iEnt, 46,4) <= 0.0)
  546.     {
  547.         set_pdata_float(iEnt, 46, 11.36,4)
  548.         set_pdata_float(iEnt, 47, 11.36,4)
  549.         set_pdata_float(iEnt, 48, 11.36,4)
  550.        
  551.         g_check[id] = 7
  552.         set_pev(iEnt, pev_fuser1, get_gametime() + 10.6)
  553.         Set_WeaponAnim(id, 15)
  554.     }
  555.    
  556.     // NANI?!
  557.     if(g_check[id] == 7 && fSound && fSound < get_gametime())
  558.     {
  559.         SendSound(id,CHAN_VOICE,weapon_sound[14])
  560.         set_pev(iEnt, pev_fuser1, 0.0)
  561.         g_check[id] = 0
  562.        
  563.         DPS_Special(id, 1, 1.46)
  564.     }
  565.    
  566.     DPS_RealSpecial(id, iEnt, fRange)
  567.    
  568.     if(iButton & IN_ATTACK && get_pdata_float(iEnt, 46,4) <= 0.0)
  569.     {
  570.         g_mode[id] = 0
  571.         g_slashend[id] = 0
  572.        
  573.         set_pev(iEnt, pev_iuser2, 1)
  574.         set_pev(iEnt, pev_iuser4, 0)
  575.        
  576.         switch(iState)
  577.         {
  578.             case 0:
  579.             {
  580.                 set_pdata_float(id, 83, 0.16)
  581.                 set_pdata_float(iEnt, 46, 0.4,4);
  582.                
  583.                 if(!get_pcvar_num(cvar_fast_attack))
  584.                     set_pdata_float(iEnt, 47, 0.4,4);
  585.                    
  586.                 set_pdata_float(iEnt, 48, 1.0,4);
  587.                
  588.                 set_pev(iEnt, pev_iuser1, 1)
  589.                 set_pev(iEnt, pev_iuser3, 1)
  590.                 set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  591.                
  592.                 Set_WeaponAnim(id, ANIM_STAB1)
  593.                 SendSound(id, CHAN_WEAPON, weapon_sound[0])
  594.                
  595.                 if(!g_check[id]) g_check[id] = 1
  596.                 else if(g_check[id] == 2) g_check[id] = 3
  597.                 else g_check[id] = 0
  598.             }
  599.             case 1:
  600.             {
  601.                 set_pdata_float(id, 83, 0.16)
  602.                 set_pdata_float(iEnt, 46, 0.83,4);
  603.                
  604.                 if(!get_pcvar_num(cvar_fast_attack))
  605.                     set_pdata_float(iEnt, 47, 0.83,4);
  606.                
  607.                 set_pdata_float(iEnt, 48, 1.5,4);
  608.                
  609.                 set_pev(iEnt, pev_iuser1, 1)
  610.                 set_pev(iEnt, pev_iuser3, 0)
  611.                 set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  612.                
  613.                 Set_WeaponAnim(id, ANIM_STAB2)
  614.                 SendSound(id, CHAN_WEAPON, weapon_sound[1])
  615.                
  616.                 if(g_check[id] == 3) g_check[id] = 4
  617.                 else g_check[id] = 0
  618.             }
  619.         }
  620.     }
  621.    
  622.     if(iButton & IN_ATTACK2 && get_pdata_float(iEnt, 47) <= 0.0 && !iSlash)
  623.     {
  624.         g_mode[id] = 1
  625.        
  626.         set_pdata_float(id, 83, 0.04)
  627.        
  628.         if(!get_pcvar_num(cvar_fast_attack))
  629.             set_pdata_float(iEnt, 46, 0.13,4);
  630.        
  631.         set_pdata_float(iEnt, 47, 0.13,4);
  632.         set_pdata_float(iEnt, 48, 0.5,4);
  633.        
  634.         set_pev(iEnt, pev_iuser1, 1)
  635.         set_pev(iEnt, pev_iuser2, 0)
  636.         set_pev(iEnt, pev_iuser3, 0)
  637.         set_pev(iEnt, pev_iuser4, 1)
  638.         set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  639.        
  640.         Set_WeaponAnim(id, ANIM_SLASH1)
  641.         SendSound(id, CHAN_WEAPON, weapon_sound[5])
  642.        
  643.         Create_Slash(id,iEnt,0)
  644.        
  645.         if(g_check[id] == 1) g_check[id] = 2
  646.         else if(g_check[id] == 4) g_check[id] = 5
  647.         else g_check[id] = 0
  648.     }
  649.    
  650.     iButton &= ~IN_ATTACK;
  651.     iButton &= ~IN_ATTACK2;
  652.     set_pev(id, pev_button, iButton);
  653.     return HAM_IGNORED
  654. }
  655.  
  656. stock Create_Slash(id,iEnt,seq)
  657. {
  658.     new Float:vecOrigin[3], Float:vecAngle[3];
  659.     GetGunPosition(id, vecOrigin);
  660.     pev(id, pev_v_angle, vecAngle);
  661.     vecAngle[0] = -vecAngle[0];
  662.    
  663.     new pEntity = DPS_Entites(id,"models/dualswordfx.mdl",vecOrigin,vecOrigin,0.01,SOLID_NOT,seq)
  664.        
  665.     // Set info for ent
  666.     Set_Entity_Mode(pEntity, 0)
  667.     set_pev(pEntity, pev_scale, 0.1);
  668.     set_pev(pEntity, pev_iuser1, iEnt);
  669.     set_pev(pEntity, pev_velocity, Float:{0.01,0.01,0.01});
  670.     set_pev(pEntity, pev_angles, vecAngle);
  671.     set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
  672. }
  673.  
  674. stock DPS_Special(id, seq, Float:fTime)
  675. {
  676.     new Float:VecOrig[3], Float:VecAng[3]
  677.     pev(id, pev_origin, VecOrig)
  678.     pev(id, pev_angles, VecAng)
  679.    
  680.     new iEfx = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  681.     set_pev(iEfx, pev_classname, "dps_entytyd");
  682.     set_pev(iEfx, pev_origin, VecOrig)
  683.     set_pev(iEfx, pev_frame, 0.0)
  684.     set_pev(iEfx, pev_animtime, get_gametime())
  685.     set_pev(iEfx, pev_framerate, 1.0)
  686.     set_pev(iEfx, pev_sequence, seq)
  687.     engfunc(EngFunc_SetModel, iEfx, "models/dualsword_skill.mdl")
  688.     dllfunc(DLLFunc_Spawn, iEfx)
  689.     Set_Entity_Mode(iEfx, 1)
  690.     set_pev(iEfx, pev_angles, VecAng)
  691.     set_pev(iEfx, pev_solid, SOLID_NOT)
  692.     set_pev(iEfx, pev_owner, id)
  693.     set_pev(iEfx, pev_velocity, Float:{0.01,0.01,0.01});
  694.     set_pev(iEfx, pev_fuser1, get_gametime() + fTime)
  695.     set_pev(iEfx, pev_nextthink, get_gametime() + 0.01)
  696. }
  697.  
  698. stock DPS_RealSpecial(id, iEnt, Float:fRange)
  699. {
  700.     new Float:fTimeEffect;
  701.     pev(iEnt, pev_fuser4, fTimeEffect);
  702.    
  703.     if (g_check[id] == 7 && fTimeEffect && fTimeEffect <= get_gametime())
  704.     {
  705.         KnifeAttack_Global(id, false, get_pcvar_float(cvar_special_range)*2.0, 180.0, get_pcvar_float(cvar_damage_special), get_pcvar_float(cvar_knockback[2]))
  706.            
  707.         new Float:vecOrigin3[2][3], Float:vecOrigin[3];
  708.         pev(id, pev_origin, vecOrigin3[0]);
  709.         pev(id, pev_origin, vecOrigin);
  710.         xs_vec_copy(vecOrigin3[0], vecOrigin3[1]);
  711.        
  712.         new Float:fFloat = random_float(fRange * -0.85, fRange * 0.85);
  713.         vecOrigin3[0][2] = vecOrigin3[1][2] = vecOrigin3[0][2] + random_float(-5.0, 65.0);
  714.        
  715.         switch (random(3))
  716.         {
  717.             case 0:
  718.             {
  719.                 vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);
  720.                 vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);
  721.                
  722.                 vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);
  723.                 vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);
  724.             }
  725.             case 1:
  726.             {
  727.                 vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);
  728.                 vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);
  729.                
  730.                 vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);
  731.                 vecOrigin3[1][1] += fFloat*random_float(-1.0, 1.0);
  732.             }
  733.             case 2:
  734.             {
  735.                 vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);
  736.                 vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);
  737.                
  738.                 vecOrigin3[1][0] += fFloat*random_float(-1.0, 1.0);
  739.                 vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);
  740.             }
  741.             case 3:
  742.             {
  743.                 vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);
  744.                 vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);
  745.                
  746.                 vecOrigin3[1][0] += fFloat*random_float(-1.0, 1.0);
  747.                 vecOrigin3[1][1] += fFloat*random_float(-1.0, 1.0);
  748.             }
  749.         }
  750.        
  751.         if (random_num(0,9) > 8)
  752.         {
  753.             new Float:vecAngle2[3];
  754.             vecAngle2[0] = random_num(0,1) ? random_float(-30.0, -15.0) : random_float(15.0, 30.0);
  755.             vecAngle2[1] = random_num(0,1) ? random_float(-180.0, 0.0) : random_float(0.0, 180.0);
  756.            
  757.             new pEntity = DPS_Entites(id,"models/dualsword_skillfx1.mdl",vecOrigin3[0],vecOrigin3[0],0.01,SOLID_NOT,0) 
  758.             set_pev(pEntity, pev_angles, vecAngle2);
  759.             set_pev(pEntity, pev_velocity, Float:{0.01,0.01,0.01});
  760.             set_pev(pEntity, pev_iuser1, 1);
  761.             set_pev(pEntity, pev_iuser2, iEnt);
  762.             set_pev(pEntity, pev_frame, 0.0);
  763.             Set_Entity_Mode(pEntity, 2)
  764.             set_pev(pEntity, pev_fuser1, get_gametime()+0.53);
  765.             set_pev(pEntity, pev_fuser2, get_gametime()+0.5);
  766.             set_pev(pEntity, pev_fuser3, get_gametime()+0.31);
  767.             set_pev(pEntity, pev_oldorigin, vecOrigin);
  768.             set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
  769.         }
  770.        
  771.         new pEntity = DPS_Entites(id,"models/dualsword_skillfx2.mdl",vecOrigin3[0],vecOrigin3[1],500.0,SOLID_TRIGGER,0)
  772.         set_pev(pEntity, pev_iuser1, 2);
  773.         set_pev(pEntity, pev_iuser2, iEnt);
  774.         Set_Entity_Mode(pEntity, 2)
  775.         set_pev(pEntity, pev_frame, 0.0);
  776.         set_pev(pEntity, pev_oldorigin, vecOrigin);
  777.         set_pev(pEntity, pev_fuser1, get_gametime()+0.2);
  778.         set_pev(pEntity, pev_fuser2, get_gametime()+0.5);
  779.         set_pev(pEntity, pev_fuser3, get_gametime()+0.3);
  780.         set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
  781.        
  782.         set_pev(iEnt, pev_fuser4, get_gametime()+0.05);
  783.     }
  784. }
  785.  
  786. stock DPS_Entites(id, models[], Float:Start[3], Float:End[3], Float:speed, solid, seq, move=MOVETYPE_FLY)
  787. {
  788.     new pEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
  789.        
  790.     // Set info for ent
  791.     set_pev(pEntity, pev_movetype, move);
  792.     set_pev(pEntity, pev_owner, id);
  793.     engfunc(EngFunc_SetModel, pEntity, models);
  794.     set_pev(pEntity, pev_classname, "dps_entytyd");
  795.     set_pev(pEntity, pev_mins, Float:{-1.0, -1.0, -1.0});
  796.     set_pev(pEntity, pev_maxs, Float:{1.0, 1.0, 1.0});
  797.     set_pev(pEntity, pev_origin, Start);
  798.     set_pev(pEntity, pev_gravity, 0.01);
  799.     set_pev(pEntity, pev_solid, solid);
  800.    
  801.     static Float:Velocity[3];
  802.     Stock_Get_Speed_Vector(Start, End, speed, Velocity);
  803.     set_pev(pEntity, pev_velocity, Velocity);
  804.  
  805.     new Float:vecVAngle[3]; pev(id, pev_v_angle, vecVAngle);
  806.     vector_to_angle(Velocity, vecVAngle)
  807.    
  808.     if(vecVAngle[0] > 90.0) vecVAngle[0] = -(360.0 - vecVAngle[0]);
  809.     set_pev(pEntity, pev_angles, vecVAngle);
  810.    
  811.     set_pev(pEntity, pev_rendermode, kRenderTransAdd);
  812.     set_pev(pEntity, pev_renderamt, 255.0);
  813.     set_pev(pEntity, pev_sequence, seq)
  814.     set_pev(pEntity, pev_animtime, get_gametime());
  815.     set_pev(pEntity, pev_framerate, 1.0)
  816.     return pEntity;
  817. }
  818.  
  819. stock Set_Entity_Mode(iEnt, mode) set_pev(iEnt, pev_iuser3, mode)
  820. stock Get_Entity_Mode(iEnt) return pev(iEnt,pev_iuser3)
  821.  
  822. stock SendSound(id, chan, sample[]) emit_sound(id, chan, sample, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  823.  
  824. stock Stock_Get_Speed_Vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
  825. {
  826.     xs_vec_sub(origin2, origin1, new_velocity)
  827.     new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
  828.     xs_vec_mul_scalar(new_velocity, num, new_velocity)
  829. }
  830. stock GetGunPosition(id, Float:vecSrc[3])
  831. {
  832.     new Float:vecViewOfs[3];
  833.     pev(id, pev_origin, vecSrc);
  834.     pev(id, pev_view_ofs, vecViewOfs);
  835.     xs_vec_add(vecSrc, vecViewOfs, vecSrc);
  836. }
  837. stock KnifeAttack_Global(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack)
  838. {
  839.     new iHitResult
  840.     if(fAngle > 0.0) iHitResult = KnifeAttack2(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack)
  841.     else iHitResult = KnifeAttack(id, bStab, Float:flRange, Float:flDamage, Float:flKnockBack)
  842.  
  843.     return iHitResult
  844. }
  845.  
  846. stock KnifeAttack(id, bStab, Float:flRange, Float:flDamage, Float:flKnockBack, iHitgroup = -1, bitsDamageType = DMG_NEVERGIB | DMG_CLUB)
  847. {
  848.     new Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
  849.     GetGunPosition(id, vecSrc);
  850.  
  851.     pev(id, pev_v_angle, v_angle);
  852.     engfunc(EngFunc_MakeVectors, v_angle);
  853.  
  854.     global_get(glb_v_forward, vecForward);
  855.     xs_vec_mul_scalar(vecForward, flRange, vecForward);
  856.     xs_vec_add(vecSrc, vecForward, vecEnd);
  857.  
  858.     new tr = create_tr2();
  859.     engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);
  860.  
  861.     new Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);
  862.     if (flFraction >= 1.0) engfunc(EngFunc_TraceHull, vecSrc, vecEnd, 0, 3, id, tr);
  863.    
  864.     get_tr2(tr, TR_flFraction, flFraction);
  865.  
  866.     new iHitResult = RESULT_HIT_NONE;
  867.    
  868.     if (flFraction < 1.0)
  869.     {
  870.         new pEntity = get_tr2(tr, TR_pHit);
  871.         iHitResult = RESULT_HIT_WORLD;
  872.        
  873.         if (pev_valid(pEntity) && (IsPlayer(pEntity) || IsHostage(pEntity)))
  874.         {
  875.             if (CheckBack(id, pEntity) && bStab && iHitgroup == -1)
  876.                 flDamage *= 1.0;
  877.  
  878.             iHitResult = RESULT_HIT_PLAYER;
  879.         }
  880.  
  881.         if (pev_valid(pEntity))
  882.         {
  883.             engfunc(EngFunc_MakeVectors, v_angle);
  884.             global_get(glb_v_forward, vecForward);
  885.  
  886.             if (iHitgroup != -1)
  887.                 set_tr2(tr, TR_iHitgroup, iHitgroup);
  888.  
  889.             ExecuteHamB(Ham_TraceAttack, pEntity, id, flDamage, vecForward, tr, bitsDamageType);
  890.             ExecuteHamB(Ham_TakeDamage, pEntity, id, id, flDamage, bitsDamageType)
  891.             Stock_Fake_KnockBack(id, pEntity, flKnockBack)
  892.            
  893.             if (IsAlive(pEntity))
  894.             {
  895.                 free_tr2(tr);
  896.                 return iHitResult;
  897.             }
  898.         }
  899.     }
  900.     free_tr2(tr);
  901.     return iHitResult;
  902. }
  903.  
  904. stock KnifeAttack2(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack, iHitgroup = -1, bNoTraceCheck = 0)
  905. {
  906.     new Float:vecOrigin[3], Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
  907.     pev(id, pev_origin, vecOrigin);
  908.  
  909.     new iHitResult = RESULT_HIT_NONE;
  910.     GetGunPosition(id, vecSrc);
  911.  
  912.     pev(id, pev_v_angle, v_angle);
  913.     engfunc(EngFunc_MakeVectors, v_angle);
  914.  
  915.     global_get(glb_v_forward, vecForward);
  916.     xs_vec_mul_scalar(vecForward, flRange, vecForward);
  917.     xs_vec_add(vecSrc, vecForward, vecEnd);
  918.  
  919.     new tr = create_tr2();
  920.     engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);
  921.    
  922.     new Float:EndPos2[3]
  923.     get_tr2(tr, TR_vecEndPos, EndPos2)
  924.    
  925.     new Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);
  926.     if (flFraction < 1.0)
  927.     {
  928.         iHitResult = RESULT_HIT_WORLD;
  929.         if(bStab) Stock_SakuraEffect(id, EndPos2)
  930.     }
  931.    
  932.     new Float:vecEndZ = vecEnd[2];
  933.    
  934.     new pEntity = -1;
  935.     while ((pEntity = engfunc(EngFunc_FindEntityInSphere, pEntity, vecOrigin, flRange)) != 0)
  936.     {
  937.         if (!pev_valid(pEntity))
  938.             continue;
  939.         if (id == pEntity)
  940.             continue;
  941.         if (!IsAlive(pEntity))
  942.             continue;
  943.         if (!CheckAngle(id, pEntity, fAngle))
  944.             continue;
  945.  
  946.         GetGunPosition(id, vecSrc);
  947.         Stock_Get_Origin(pEntity, vecEnd);
  948.  
  949.         vecEnd[2] = vecSrc[2] + (vecEndZ - vecSrc[2]) * (get_distance_f(vecSrc, vecEnd) / flRange);
  950.  
  951.         xs_vec_sub(vecEnd, vecSrc, vecForward);
  952.         xs_vec_normalize(vecForward, vecForward);
  953.         xs_vec_mul_scalar(vecForward, flRange, vecForward);
  954.         xs_vec_add(vecSrc, vecForward, vecEnd);
  955.  
  956.         engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);
  957.         get_tr2(tr, TR_flFraction, flFraction);
  958.  
  959.         if (flFraction >= 1.0) engfunc(EngFunc_TraceHull, vecSrc, vecEnd, 0, 3, id, tr);
  960.         get_tr2(tr, TR_flFraction, flFraction);
  961.  
  962.         if (flFraction < 1.0)
  963.         {
  964.             if (IsPlayer(pEntity) || IsHostage(pEntity))
  965.             {
  966.                 iHitResult = RESULT_HIT_PLAYER;
  967.                 if(bStab) Stock_SakuraEffect(id, vecEnd)
  968.                
  969.                 if (CheckBack(id, pEntity) && bStab && iHitgroup == -1)
  970.                     flDamage *= 1.0;
  971.             }
  972.  
  973.             if (get_tr2(tr, TR_pHit) == pEntity || bNoTraceCheck)
  974.             {
  975.                 engfunc(EngFunc_MakeVectors, v_angle);
  976.                 global_get(glb_v_forward, vecForward);
  977.  
  978.                 if (iHitgroup != -1) set_tr2(tr, TR_iHitgroup, iHitgroup);
  979.  
  980.                 ExecuteHamB(Ham_TraceAttack, pEntity, id, flDamage, vecForward, tr, DMG_NEVERGIB | DMG_CLUB);
  981.                 ExecuteHamB(Ham_TakeDamage, pEntity, id, id, flDamage, DMG_NEVERGIB | DMG_CLUB)
  982.                
  983.                 Stock_Fake_KnockBack(id, pEntity, flKnockBack)
  984.             }
  985.         }
  986.         free_tr2(tr);
  987.     }
  988.     return iHitResult;
  989. }
  990.  
  991. stock Set_WeaponAnim(id, anim)
  992. {
  993.     set_pev(id, pev_weaponanim, anim)
  994.    
  995.     message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
  996.     write_byte(anim)
  997.     write_byte(pev(id, pev_body))
  998.     message_end()
  999. }
  1000.  
  1001. stock Stock_Set_Vis(iEnt, iVis = 1)
  1002.     set_pev(iEnt, pev_effects, iVis == 1 ? pev(iEnt, pev_effects) & ~EF_NODRAW : pev(iEnt, pev_effects) | EF_NODRAW)
  1003.  
  1004. stock Stock_Hook_Ent(ent, Float:TargetOrigin[3], Float:Speed, mode=0)
  1005. {
  1006.     static Float:fl_Velocity[3],Float:EntOrigin[3],Float:distance_f,Float:fl_Time
  1007.     pev(ent, pev_origin, EntOrigin)
  1008.    
  1009.     if(!mode)
  1010.     {
  1011.         distance_f = get_distance_f(EntOrigin, TargetOrigin)
  1012.         fl_Time = distance_f / Speed
  1013.            
  1014.         pev(ent, pev_velocity, fl_Velocity)
  1015.            
  1016.         fl_Velocity[0] = (TargetOrigin[0] - EntOrigin[0]) / fl_Time
  1017.         fl_Velocity[1] = (TargetOrigin[1] - EntOrigin[1]) / fl_Time
  1018.         fl_Velocity[2] = (TargetOrigin[2] - EntOrigin[2]) / fl_Time
  1019.  
  1020.         if(vector_length(fl_Velocity) > 1.0) set_pev(ent, pev_velocity, fl_Velocity)
  1021.         else set_pev(ent, pev_velocity, Float:{0.01, 0.01, 0.01})
  1022.     } else {
  1023.         static Float:fl_EntVelocity[3], Float:fl_Acc[3]
  1024.         Stock_Directed_Vector(TargetOrigin, EntOrigin, fl_Velocity)
  1025.         xs_vec_mul_scalar(fl_Velocity, Speed, fl_Velocity)
  1026.        
  1027.         for(new i =0; i<3; i++)
  1028.         {
  1029.             if(fl_Velocity[i] > fl_EntVelocity[i])
  1030.             {
  1031.                 fl_Acc[i] = fl_Velocity[i]-fl_EntVelocity[i]
  1032.                 fl_Acc[i] = floatmin(70.0, fl_Acc[i])
  1033.                 fl_EntVelocity[i] += fl_Acc[i]
  1034.             }
  1035.             else if(fl_Velocity[i] < fl_EntVelocity[i])
  1036.             {
  1037.                 fl_Acc[i] = fl_EntVelocity[i]-fl_Velocity[i]
  1038.                 fl_Acc[i] = floatmin(70.0, fl_Acc[i])
  1039.                 fl_EntVelocity[i] -= fl_Acc[i]
  1040.             }
  1041.         }
  1042.         set_pev(ent, pev_velocity, fl_EntVelocity)
  1043.     }
  1044. }
  1045.  
  1046. stock Stock_Directed_Vector(Float:start[3],Float:end[3],Float:reOri[3])
  1047. {  
  1048.     new Float:v3[3],i
  1049.     for(i=0;i<3;i++) v3[i]=start[i]-end[i]
  1050.  
  1051.     new Float:vl = vector_length(v3)
  1052.     for(i=0;i<3;i++) reOri[i] = v3[i] / vl
  1053. }
  1054.  
  1055. stock Stock_Get_Postion(id,Float:forw,Float:right,Float:up,Float:vStart[])
  1056. {
  1057.     static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
  1058.     pev(id, pev_origin, vOrigin)
  1059.     pev(id, pev_view_ofs,vUp)
  1060.     xs_vec_add(vOrigin,vUp,vOrigin)
  1061.     pev(id, pev_v_angle, vAngle)
  1062.    
  1063.     engfunc(EngFunc_AngleVectors, vAngle, vForward, vRight, vUp)
  1064.    
  1065.     vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
  1066.     vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
  1067.     vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
  1068. }
  1069.  
  1070. stock IsPlayer(pEntity) return is_user_connected(pEntity)
  1071.  
  1072. stock IsHostage(pEntity)
  1073. {
  1074.     new classname[32]; pev(pEntity, pev_classname, classname, charsmax(classname))
  1075.     return equal(classname, "hostage_entity")
  1076. }
  1077.  
  1078. stock IsAlive(pEntity)
  1079. {
  1080.     if (pEntity < 1) return 0
  1081.     return (pev(pEntity, pev_deadflag) == DEAD_NO && pev(pEntity, pev_health) > 0)
  1082. }
  1083.  
  1084. stock CheckBack(iEnemy,id)
  1085. {
  1086.     new Float:anglea[3], Float:anglev[3]
  1087.     pev(iEnemy, pev_v_angle, anglea)
  1088.     pev(id, pev_v_angle, anglev)
  1089.     new Float:angle = anglea[1] - anglev[1]
  1090.     if (angle < -180.0) angle += 360.0
  1091.     if (angle <= 45.0 && angle >= -45.0) return 1
  1092.     return 0
  1093. }
  1094.  
  1095. stock CheckAngle(iAttacker, iVictim, Float:fAngle)  return(Stock_CheckAngle(iAttacker, iVictim) > floatcos(fAngle,degrees))
  1096.  
  1097. stock Float:Stock_CheckAngle(id,iTarget)
  1098. {
  1099.     new Float:vOricross[2],Float:fRad,Float:vId_ori[3],Float:vTar_ori[3],Float:vId_ang[3],Float:fLength,Float:vForward[3]
  1100.     Stock_Get_Origin(id, vId_ori)
  1101.     Stock_Get_Origin(iTarget, vTar_ori)
  1102.    
  1103.     pev(id,pev_angles,vId_ang)
  1104.     for(new i=0;i<2;i++) vOricross[i] = vTar_ori[i] - vId_ori[i]
  1105.    
  1106.     fLength = floatsqroot(vOricross[0]*vOricross[0] + vOricross[1]*vOricross[1])
  1107.    
  1108.     if (fLength<=0.0)
  1109.     {
  1110.         vOricross[0]=0.0
  1111.         vOricross[1]=0.0
  1112.     } else {
  1113.         vOricross[0]=vOricross[0]*(1.0/fLength)
  1114.         vOricross[1]=vOricross[1]*(1.0/fLength)
  1115.     }
  1116.    
  1117.     engfunc(EngFunc_MakeVectors,vId_ang)
  1118.     global_get(glb_v_forward,vForward)
  1119.    
  1120.     fRad = vOricross[0]*vForward[0]+vOricross[1]*vForward[1]
  1121.     return fRad   //->   RAD 90' = 0.5rad
  1122. }
  1123.  
  1124. stock Stock_Get_Origin(id, Float:origin[3])
  1125. {
  1126.     new Float:maxs[3],Float:mins[3]
  1127.     if (pev(id, pev_solid) == SOLID_BSP)
  1128.     {
  1129.         pev(id,pev_maxs,maxs)
  1130.         pev(id,pev_mins,mins)
  1131.         origin[0] = (maxs[0] - mins[0]) / 2 + mins[0]
  1132.         origin[1] = (maxs[1] - mins[1]) / 2 + mins[1]
  1133.         origin[2] = (maxs[2] - mins[2]) / 2 + mins[2]
  1134.     } else pev(id, pev_origin, origin)
  1135. }
  1136.  
  1137. public Stock_Fake_KnockBack(id, iVic, Float:iKb)
  1138. {
  1139.     if(iVic > 32) return
  1140.    
  1141.     new Float:vAttacker[3], Float:vVictim[3], Float:vVelocity[3], flags
  1142.     pev(id, pev_origin, vAttacker)
  1143.     pev(iVic, pev_origin, vVictim)
  1144.     vAttacker[2] = vVictim[2] = 0.0
  1145.     flags = pev(id, pev_flags)
  1146.    
  1147.     xs_vec_sub(vVictim, vAttacker, vVictim)
  1148.     new Float:fDistance
  1149.     fDistance = xs_vec_len(vVictim)
  1150.     xs_vec_mul_scalar(vVictim, 1 / fDistance, vVictim)
  1151.    
  1152.     pev(iVic, pev_velocity, vVelocity)
  1153.     xs_vec_mul_scalar(vVictim, iKb, vVictim)
  1154.     xs_vec_mul_scalar(vVictim, 50.0, vVictim)
  1155.     vVictim[2] = xs_vec_len(vVictim) * 0.15
  1156.    
  1157.     if(flags &~ FL_ONGROUND)
  1158.     {
  1159.         xs_vec_mul_scalar(vVictim, 1.2, vVictim)
  1160.         vVictim[2] *= 0.4
  1161.     }
  1162.     if(xs_vec_len(vVictim) > xs_vec_len(vVelocity)) set_pev(iVic, pev_velocity, vVictim)
  1163. }  
  1164.  
  1165. stock Float:Stock_Get_Body_Dmg(iBody)
  1166. {
  1167.     switch (iBody)
  1168.     {
  1169.         case HIT_GENERIC: return 0.75
  1170.         case 1: return 4.0
  1171.         case 2: return 1.0
  1172.         case 3: return 1.25
  1173.         case 4,5,6,7: return 0.75
  1174.         default: return 0.75
  1175.     }
  1176.     return 1.0
  1177. }
  1178.  
  1179. stock Stock_SakuraEffect(id, Float:vecOri[3])
  1180. {
  1181.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOri)
  1182.     write_byte(TE_BLOODSPRITE)
  1183.     engfunc(EngFunc_WriteCoord,vecOri[0])
  1184.     engfunc(EngFunc_WriteCoord,vecOri[1])
  1185.     engfunc(EngFunc_WriteCoord,vecOri[2])
  1186.     write_short(ef_sakura[g_mode[id]?2:0])
  1187.     write_short(ef_sakura[g_mode[id]?3:1])
  1188.     write_byte(g_mode[id]?178:128)
  1189.     write_byte(random_num(2,3))
  1190.     message_end()
  1191. }
  1192.  
  1193. stock can_damage(id1, id2)
  1194. {
  1195.     if(id1 <= 0 || id1 >= 33 || id2 <= 0 || id2 >= 33)
  1196.         return 1
  1197.        
  1198.     // Check team
  1199.     return(get_pdata_int(id1, 114) != get_pdata_int(id2, 114))
  1200. }
  1201. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  1202. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  1203. */
I converted this new extra item but when i try to get it from shop server crashing for no reason from this plugin. Can someone fix it?

User avatar
Muhammet20
Veteran Member
Veteran Member
Syria
Posts: 391
Joined: 1 Year Ago
Location: Turkey
Has thanked: 36 times
Been thanked: 5 times
Age: 13
Contact:

#2

Post by Muhammet20 » 2 Months Ago

Mystic Viper wrote:
2 Months Ago
  1. /* Plugin generated by AMXX-Studio */
  2. #pragma compress 1
  3.  
  4. #include <amxmodx>
  5. #include <engine>
  6. #include <fakemeta>
  7. #include <fakemeta_util>
  8. #include <hamsandwich>
  9. #include <xs>
  10. #include <zombie_escape>
  11. #include <ze_vip>
  12.  
  13. #define PLUGIN "CSO Dual Sword Phantom Slayer"
  14. #define VERSION "1.0"
  15. #define AUTHOR "Natasha aka Asdian"
  16.  
  17. #define CSW_DPS CSW_KNIFE
  18. #define weapon_dps "weapon_knife"
  19.  
  20. #define v_model "models/v_dualsword.mdl"
  21. #define p_model "models/p_dualsword_a.mdl"
  22. #define p_model2 "models/p_dualsword_b.mdl"
  23. #define spr_wpn "knife_dualsword"
  24.  
  25. new const weapon_sound[][] =
  26. {
  27.     "weapons/dualsword_stab1.wav",              // 0
  28.     "weapons/dualsword_stab2.wav",              // 1
  29.     "weapons/dualsword_stab1_hit.wav",          // 2
  30.     "weapons/dualsword_stab2_hit.wav",          // 3
  31.     "weapons/katanad_hitwall.wav",              // 4
  32.    
  33.     "weapons/dualsword_slash_1.wav",            // 5
  34.     "weapons/dualsword_slash_2.wav",            // 6
  35.     "weapons/dualsword_slash_3.wav",            // 7
  36.     "weapons/dualsword_slash_4.wav",            // 8
  37.     "weapons/dualsword_hit1.wav",               // 9
  38.     "weapons/dualsword_hit2.wav",               // 10
  39.     "weapons/dualsword_hit3.wav",               // 11
  40.     "weapons/dualsword_slash_4_1.wav",          // 12
  41.     "weapons/dualsword_slash_4_2.wav",          // 13
  42.     "weapons/dualsword_skill_end.wav",          // 14
  43.    
  44.     "weapons/dualsword_fly1.wav",               // 15
  45.     "weapons/dualsword_fly2.wav",               // 16
  46.     "weapons/dualsword_fly3.wav",               // 17
  47.     "weapons/dualsword_fly4.wav",               // 18
  48.     "weapons/dualsword_fly5.wav",               // 19
  49.     "weapons/dualsword_skill_start.wav"
  50. }
  51.  
  52. //Hit
  53. #define RESULT_HIT_NONE             0
  54. #define RESULT_HIT_PLAYER           1
  55. #define RESULT_HIT_WORLD            2
  56.  
  57. enum _:WpnAnim
  58. {
  59.     ANIM_IDLEA = 0,
  60.     ANIM_SLASH1,
  61.     ANIM_SLASH2,
  62.     ANIM_SLASH3,
  63.     ANIM_SLASH4,
  64.     ANIM_SLASHEND,
  65.     ANIM_DRAWA,
  66.     ANIM_IDLEB,
  67.     ANIM_STAB1,
  68.     ANIM_STAB2,
  69.     ANIM_STABEND,
  70.     ANIM_DRAWB
  71. }
  72.  
  73. new g_had_dps[33], g_mode[33], g_slashend[33], g_check[33], g_dps, g_soundmode[33]
  74. new ef_sakura[4]
  75. new Float:g_Sound[33]
  76.  
  77. new cvar_damage_slash[4], cvar_slash_radius, cvar_slash_range
  78. new cvar_damage_stab[2], cvar_stab_radius, cvar_stab_range
  79. new cvar_damage_special, cvar_special_range
  80. new cvar_knockback[3], cvar_fast_attack, cvar_remove, cvar_spr
  81.  
  82. public plugin_init()
  83. {
  84.     register_plugin(PLUGIN, VERSION, AUTHOR)
  85.    
  86.     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
  87.     register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
  88.     register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
  89.     register_forward(FM_AddToFullPack, "Fw_AddToFullPack_Post", 1);
  90.  
  91.     register_think("dps_entytyd", "Fw_DPSEnt_Think")
  92.    
  93.     RegisterHam(Ham_Item_PostFrame, weapon_dps, "fw_Item_PostFrame")
  94.    
  95.     register_clcmd(spr_wpn, "hook_rb")
  96.    
  97.     cvar_damage_slash[0] = register_cvar("dps_slashdamage_4","486.0")
  98.     cvar_damage_slash[1] = register_cvar("dps_slashdamage_1","120.0")
  99.     cvar_damage_slash[2] = register_cvar("dps_slashdamage_2","140.0")
  100.     cvar_damage_slash[3] = register_cvar("dps_slashdamage_3","360.0")
  101.     cvar_slash_radius = register_cvar("dps_slashradius","120.0")
  102.     cvar_slash_range = register_cvar("dps_slashrange","95.0")
  103.    
  104.     cvar_damage_stab[0] = register_cvar("dps_stabdamage_2","1200.0")
  105.     cvar_damage_stab[1] = register_cvar("dps_stabdamage_1","350.0")
  106.     cvar_stab_radius = register_cvar("dps_stabradius","90.0")
  107.     cvar_stab_range = register_cvar("dps_stabrange","150.0")
  108.    
  109.     cvar_damage_special = register_cvar("dps_specialdamage","95.0")
  110.     cvar_special_range = register_cvar("dps_specialrange","120.0")
  111.    
  112.     cvar_knockback[0] = register_cvar("dps_slashknockback","0.0")
  113.     cvar_knockback[1] = register_cvar("dps_stabknockback","0.0")
  114.     cvar_knockback[2] = register_cvar("dps_specialknockback","0.0")
  115.    
  116.     cvar_fast_attack = register_cvar("dps_fast_attack_enabled", "0")
  117.     cvar_remove = register_cvar("dps_remove_onnewround", "0")
  118.     cvar_spr = register_cvar("dps_enable_sprites", "1")
  119.    
  120.     g_dps = ze_register_item("Dual Sword Phantom Slayer \r(VIP)", 50, 0)
  121. }
  122.  
  123. public plugin_precache()
  124. {
  125.     precache_model(v_model)
  126.     precache_model(p_model)
  127.     precache_model(p_model2)
  128.    
  129.     for(new i = 0; i < sizeof(weapon_sound); i++)
  130.         precache_sound(weapon_sound[i])
  131.    
  132.     precache_model("models/dualswordfx.mdl")
  133.     precache_model("models/dualsword_skill.mdl")
  134.     precache_model("models/dualsword_skillfx1.mdl")
  135.     precache_model("models/dualsword_skillfx2.mdl")
  136.    
  137.     ef_sakura[0] = precache_model("sprites/leaf01_dualsword.spr")
  138.     ef_sakura[1] = precache_model("sprites/leaf02_dualsword.spr")
  139.     ef_sakura[2] = precache_model("sprites/petal01_dualsword.spr")
  140.     ef_sakura[3] = precache_model("sprites/petal02_dualsword.spr")
  141.    
  142.     new Txt[32]
  143.     format(Txt, 31, "sprites/%s.txt", spr_wpn)
  144.     engfunc(EngFunc_PrecacheGeneric, Txt)
  145. }
  146.  
  147. public ze_user_infected(id) remove_dps(id)
  148. public ze_user_humanized(id) remove_dps(id)
  149.  
  150. public hook_rb(id)
  151. {
  152.     engclient_cmd(id, weapon_dps)
  153.     return PLUGIN_HANDLED
  154. }
  155.  
  156. public get_dps(id)
  157. {
  158.     if (!is_user_alive(id))
  159.         return
  160.  
  161.     g_had_dps[id] = 1
  162.     g_mode[id] = 0
  163.     g_slashend[id] = 0
  164.     g_check[id] = 0
  165.     g_soundmode[id] = 0
  166.    
  167.     fm_give_item(id, weapon_dps)
  168.    
  169.     if (get_user_weapon(id) == CSW_DPS) Event_CurWeapon(id)
  170.     else engclient_cmd(id,weapon_dps)
  171. }
  172.  
  173. public client_connected(id) remove_dps(id)
  174. public client_disconnected(id) remove_dps(id)
  175.  
  176. public Event_NewRound()
  177. {
  178.     if(!get_pcvar_num(cvar_remove))
  179.         return
  180.    
  181.     for(new i = 0; i < get_maxplayers(); i++)
  182.         remove_dps(i)
  183. }
  184.  
  185. public remove_dps(id)
  186. {
  187.     g_had_dps[id] = 0
  188.     g_slashend[id] = 0
  189.     g_check[id] = 0
  190.    
  191.     static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)
  192.     if(!pev_valid(iEnt)) return
  193.    
  194.     set_pev(iEnt, pev_iuser1, 0)
  195.     set_pev(iEnt, pev_iuser2, 0)
  196.     set_pev(iEnt, pev_iuser3, 0)
  197.     set_pev(iEnt, pev_iuser4, 0)
  198.     set_pev(iEnt, pev_fuser1, 0.0)
  199. }
  200.  
  201. public ze_select_item_pre(id, itemid)
  202. {  
  203.     if (itemid != g_dps)
  204.         return ZE_ITEM_AVAILABLE
  205.            
  206.     if (ze_is_user_zombie(id))
  207.         return ZE_ITEM_DONT_SHOW
  208.  
  209.         if (!(ze_get_vip_flags(id) & VIP_A))
  210.         return ZE_ITEM_DONT_SHOW
  211.        
  212.     return ZE_ITEM_AVAILABLE
  213. }
  214.  
  215. public ze_select_item_post(id, itemid)
  216. {
  217.     if (itemid != g_dps)
  218.         return
  219.    
  220.     get_dps(id)
  221. }
  222.  
  223. public Event_CurWeapon(id)
  224. {
  225.     if(!is_user_alive(id))
  226.         return 1
  227.     if(get_user_weapon(id) != CSW_DPS)
  228.         return 1
  229.     if(!g_had_dps[id])
  230.         return 1
  231.     if(ze_is_user_zombie(id))
  232.         return 1
  233.        
  234.     set_pev(id, pev_viewmodel2, v_model)
  235.     set_pev(id, pev_weaponmodel2, g_mode[id] ? p_model2:p_model)
  236.    
  237.     Set_WeaponAnim(id, g_mode[id]?ANIM_DRAWA:ANIM_DRAWB)
  238.    
  239.     static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)
  240.     if(!pev_valid(iEnt)) return 1
  241.    
  242.     set_pev(iEnt, pev_iuser1, 0)
  243.     set_pev(iEnt, pev_iuser2, 0)
  244.     set_pev(iEnt, pev_iuser3, 0)
  245.     set_pev(iEnt, pev_iuser4, 0)
  246.     set_pev(iEnt, pev_fuser1, 0.0)
  247.        
  248.     g_slashend[id] = 0
  249.     g_check[id] = 0
  250.    
  251.     set_pdata_float(id, 83, 0.23)
  252.     set_pdata_float(iEnt, 46, 0.25);
  253.     set_pdata_float(iEnt, 47, 0.25);
  254.     set_pdata_float(iEnt, 48, 0.25);
  255.    
  256.     if(get_pcvar_num(cvar_spr))
  257.     {
  258.         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
  259.         write_string(g_had_dps[id] == 1 ? spr_wpn : weapon_dps)
  260.         write_byte(-1)
  261.         write_byte(-1)
  262.         write_byte(-1)
  263.         write_byte(-1)
  264.         write_byte(2)
  265.         write_byte(1)
  266.         write_byte(CSW_DPS)
  267.         write_byte(0)
  268.         message_end()
  269.     }
  270.     return 0
  271. }
  272.  
  273. public message_DeathMsg(msg_id, msg_dest, msg_ent)
  274. {
  275.     new szWeapon[64]
  276.     get_msg_arg_string(4, szWeapon, charsmax(szWeapon))
  277.    
  278.     if (strcmp(szWeapon, "knife"))
  279.         return PLUGIN_CONTINUE
  280.  
  281.     new iEntity = get_pdata_cbase(get_msg_arg_int(1), 373)
  282.     if (!pev_valid(iEntity) || get_pdata_int(iEntity, 43, 4) != CSW_DPS || !g_had_dps[get_msg_arg_int(1)])
  283.         return PLUGIN_CONTINUE
  284.  
  285.     set_msg_arg_string(4, "dualsword")
  286.     return PLUGIN_CONTINUE
  287. }
  288.  
  289. public Fw_AddToFullPack_Post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
  290. {
  291.     if (!pev_valid(iEnt))
  292.         return;
  293.     if (pev(iEnt, pev_flags) & FL_KILLME)
  294.         return;
  295.  
  296.     new classname[32];
  297.     pev(iEnt, pev_classname, classname, 31);
  298.  
  299.     if (equal(classname,"dps_entytyd") && pev(iEnt, pev_iuser4))
  300.     {
  301.         if (iHost != pev(iEnt, pev_owner))
  302.             set_es(esState, ES_Effects, (get_es(esState, ES_Effects) | EF_NODRAW));
  303.     }
  304. }
  305.  
  306. public Fw_DPSEnt_Think(iEnt)
  307. {
  308.     if(!pev_valid(iEnt))
  309.         return
  310.    
  311.     new iOwner
  312.     iOwner = pev(iEnt, pev_owner)
  313.    
  314.     if(!is_user_alive(iOwner) || !is_user_connected(iOwner) || ze_is_user_zombie(iOwner))
  315.     {
  316.         remove_entity(iEnt)
  317.         g_soundmode[iOwner] = 0
  318.         return
  319.     }
  320.    
  321.     if(!Get_Entity_Mode(iEnt))
  322.     {
  323.         new iWpn,iState,Float:vecOrigin[3], Float:vecAngle[3];
  324.         iWpn = pev(iEnt, pev_iuser1)
  325.         iState = pev(iWpn, pev_iuser4)
  326.         Stock_Get_Postion(iOwner, 0.0, 0.0, 0.0, vecOrigin);
  327.        
  328.         pev(iOwner, pev_v_angle, vecAngle);
  329.         vecAngle[0] = -vecAngle[0];
  330.        
  331.         set_pev(iEnt, pev_origin, vecOrigin);
  332.         set_pev(iEnt, pev_angles, vecAngle);
  333.        
  334.         if(!iState || get_user_weapon(iOwner) != CSW_DPS)
  335.         {
  336.             new Float:fRenderAmount;
  337.             pev(iEnt, pev_renderamt, fRenderAmount);
  338.  
  339.             fRenderAmount -= 4.5;
  340.  
  341.             if (fRenderAmount <= 5.0)
  342.             {
  343.                 remove_entity(iEnt);
  344.                 return;
  345.             }
  346.             set_pev(iEnt, pev_renderamt, fRenderAmount);
  347.         }
  348.     }
  349.    
  350.     if(Get_Entity_Mode(iEnt) == 1)
  351.     {
  352.         set_pev(iEnt, pev_movetype, MOVETYPE_FLY)
  353.    
  354.         static Float:Origin[3]; pev(iOwner, pev_origin, Origin)
  355.         Origin[2] -= 25.0
  356.        
  357.         Stock_Hook_Ent(iEnt, Origin, 0.01)
  358.        
  359.         if(pev(iEnt, pev_fuser1) < get_gametime() || !IsAlive(iOwner))
  360.         {
  361.             set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME)
  362.             return
  363.         }
  364.            
  365.         set_pev(iEnt, pev_velocity, Float:{1.0,1.0,1.0});
  366.         set_pev(iEnt, pev_origin, Origin);
  367.     }
  368.    
  369.     if(Get_Entity_Mode(iEnt) == 2)
  370.     {
  371.         new Float:vecOrigin[3]
  372.         GetGunPosition(iOwner, vecOrigin);
  373.        
  374.         new Float:fOldOrigin[3];
  375.         pev(iEnt, pev_oldorigin, fOldOrigin);
  376.        
  377.         new Float:vecNewOrigin[3];
  378.         pev(iEnt, pev_origin, vecNewOrigin);
  379.        
  380.         new Float:vecfff[3];
  381.         xs_vec_sub(vecOrigin, fOldOrigin, vecfff);
  382.         xs_vec_add(vecNewOrigin, vecfff, vecNewOrigin);
  383.        
  384.         set_pev(iEnt, pev_origin, vecNewOrigin);
  385.         set_pev(iEnt, pev_oldorigin, vecOrigin);
  386.        
  387.         if (pev(iEnt, pev_iuser1) == 2)
  388.         {
  389.             new Float:fDist = get_distance_f(vecOrigin, vecNewOrigin);
  390.             if (fDist > 175.0 * 0.5)
  391.             {
  392.                 remove_entity(iEnt);
  393.                 return;
  394.             }
  395.         }
  396.        
  397.         if(g_Sound[iOwner] < get_gametime())
  398.         {
  399.             if(!g_soundmode[iOwner]) emit_sound(iOwner, CHAN_ITEM, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  400.             if(g_soundmode[iOwner] == 1) emit_sound(iOwner, CHAN_BODY, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  401.             if(g_soundmode[iOwner] == 2) emit_sound(iOwner, CHAN_VOICE, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  402.             if(g_soundmode[iOwner] == 3) emit_sound(iOwner, CHAN_WEAPON, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  403.            
  404.             g_soundmode[iOwner]++
  405.             if(g_soundmode[iOwner] > 3) g_soundmode[iOwner] = 0
  406.            
  407.             g_Sound[iOwner] = get_gametime()+0.088;
  408.         }
  409.     }
  410.     set_pev(iEnt, pev_nextthink, get_gametime() + 0.01)
  411.    
  412.     if(Get_Entity_Mode(iEnt) == 2)
  413.     {
  414.         new Float:fTimeLast;
  415.         pev(iEnt, pev_fuser1, fTimeLast);
  416.        
  417.         if (fTimeLast < get_gametime() || pev(pev(iEnt, pev_iuser2), pev_fuser1) < get_gametime())
  418.         {
  419.             if (pev(iEnt, pev_iuser1) == 1)
  420.             {
  421.                 new Float:fRenderAmount;
  422.                 pev(iEnt, pev_renderamt, fRenderAmount);
  423.                 fRenderAmount -= 7.5;
  424.                
  425.                 if (fRenderAmount <= 5.0)
  426.                 {
  427.                     remove_entity(iEnt);
  428.                     return;
  429.                 }
  430.                 set_pev(iEnt, pev_renderamt, fRenderAmount);
  431.             } else remove_entity(iEnt);
  432.            
  433.             g_soundmode[iOwner] = 0
  434.         }
  435.     }
  436. }
  437.  
  438. public fw_Item_PostFrame(ent)
  439. {
  440.     new id = pev(ent, pev_owner)
  441.    
  442.     if(!is_user_connected(id))
  443.         return HAM_IGNORED
  444.     if(get_user_weapon(id) != CSW_DPS || !g_had_dps[id])
  445.         return HAM_IGNORED
  446.  
  447.     if(get_pdata_float(ent, 48, 4) <= 0.01 && (!pev(ent, pev_iuser2) || !g_slashend[id]))
  448.     {
  449.         if(g_check[id] < 6) g_check[id] = 0
  450.         set_pev(ent, pev_iuser3, 0)
  451.         Set_WeaponAnim(id, g_mode[id]?ANIM_IDLEA:ANIM_IDLEB)
  452.         set_pdata_float(ent, 48, 4.03, 4)
  453.     }
  454.    
  455.     new iButton = pev(id,pev_button)
  456.     return AurezBotac(id, ent, iButton)
  457. }
  458.  
  459. public AurezBotac(id, iEnt, iButton)
  460. {
  461.     new iState = pev(iEnt, pev_iuser3)
  462.     new iState2 = pev(iEnt, pev_iuser2)
  463.     new iSlash = pev(iEnt, pev_iuser4)
  464.     new Float:fSound; pev(iEnt, pev_fuser1, fSound)
  465.     new Float:fRange = get_pcvar_float(g_mode[id] ? cvar_slash_range : cvar_stab_range)
  466.    
  467.     if(!(iButton & IN_ATTACK) && get_pdata_float(iEnt, 46,4) <= 0.0 && iState2)
  468.     {
  469.         if(!iState || iState == 1)
  470.         {
  471.             Set_WeaponAnim(id, ANIM_STABEND)
  472.             set_pev(iEnt, pev_iuser2, 0)
  473.             set_pdata_float(iEnt, 48, 1.45,4)
  474.         }
  475.     }
  476.    
  477.     if(!(iButton & IN_ATTACK2) && get_pdata_float(iEnt, 47,4) <= 0.0 && g_slashend[id])
  478.     {
  479.         Set_WeaponAnim(id, ANIM_SLASHEND)
  480.         set_pdata_float(iEnt, 48, 2.03,4)
  481.         g_slashend[id] = 0
  482.     }
  483.    
  484.     if (get_pdata_float(id, 83) <= 0.0 && pev(iEnt, pev_iuser1))
  485.     {
  486.         new Float:fAngle = get_pcvar_float(g_mode[id] ? cvar_slash_radius : cvar_stab_radius)
  487.         new Float:fDamage = get_pcvar_float(g_mode[id] ? cvar_damage_slash[iSlash] : cvar_damage_stab[iState])
  488.        
  489.         new iHitResult = KnifeAttack_Global(id, true, fRange, fAngle, fDamage, get_pcvar_float(cvar_knockback[1+g_mode[id]]))
  490.         switch (iHitResult)
  491.         {
  492.             case RESULT_HIT_PLAYER : client_cmd(id, "spk %s", weapon_sound[g_mode[id]?random_num(9,11):iState+2])
  493.             case RESULT_HIT_WORLD : client_cmd(id, "spk %s", weapon_sound[4])
  494.         }
  495.         set_pev(iEnt, pev_iuser1, 0);
  496.     }
  497.    
  498.     if(get_pdata_float(iEnt, 47,4) <= 0.0 && iSlash && iSlash <= 4)
  499.     {
  500.         set_pev(iEnt, pev_iuser4, 1 + iSlash)
  501.         Set_WeaponAnim(id, 1 + iSlash)
  502.        
  503.         set_pdata_float(id, 83, 0.06)
  504.        
  505.         if(!get_pcvar_num(cvar_fast_attack))
  506.             set_pdata_float(iEnt, 46, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);
  507.        
  508.         set_pdata_float(iEnt, 47, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);
  509.         set_pdata_float(iEnt, 48, iSlash == 3 ? 1.4 : 1.0,4);
  510.          
  511.         set_pev(iEnt, pev_iuser1, 1)
  512.         set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  513.         SendSound(id, CHAN_WEAPON, weapon_sound[5 + iSlash])
  514.         Create_Slash(id,iEnt,iSlash)
  515.        
  516.         if(iSlash == 3)
  517.         {
  518.             g_slashend[id] = 1
  519.            
  520.             set_pev(iEnt, pev_fuser1, get_gametime() + (g_check[id] == 5 ? 0.43 : 0.5))
  521.             set_pev(iEnt, pev_iuser4, 0)
  522.         }
  523.     }
  524.    
  525.     if(fSound && fSound < get_gametime())
  526.     {
  527.         SendSound(id,CHAN_VOICE,weapon_sound[g_check[id] == 5 ? 13 : 12])
  528.         set_pev(iEnt, pev_fuser1, 0.0)
  529.        
  530.         if(g_check[id] == 5)
  531.         {
  532.             Set_WeaponAnim(id, 14)
  533.             SendSound(id,CHAN_ITEM,weapon_sound[20])
  534.             g_check[id] = 6
  535.            
  536.             set_pdata_float(iEnt, 46, 1.03,4)
  537.             set_pdata_float(iEnt, 47, 1.03,4)
  538.             set_pdata_float(iEnt, 48, 1.03,4)
  539.            
  540.             set_pev(iEnt, pev_fuser4, get_gametime()+1.7);
  541.             DPS_Special(id, 0, 2.0)
  542.         }
  543.     }
  544.    
  545.     if(g_check[id] == 6 && get_pdata_float(iEnt, 46,4) <= 0.0)
  546.     {
  547.         set_pdata_float(iEnt, 46, 11.36,4)
  548.         set_pdata_float(iEnt, 47, 11.36,4)
  549.         set_pdata_float(iEnt, 48, 11.36,4)
  550.        
  551.         g_check[id] = 7
  552.         set_pev(iEnt, pev_fuser1, get_gametime() + 10.6)
  553.         Set_WeaponAnim(id, 15)
  554.     }
  555.    
  556.     // NANI?!
  557.     if(g_check[id] == 7 && fSound && fSound < get_gametime())
  558.     {
  559.         SendSound(id,CHAN_VOICE,weapon_sound[14])
  560.         set_pev(iEnt, pev_fuser1, 0.0)
  561.         g_check[id] = 0
  562.        
  563.         DPS_Special(id, 1, 1.46)
  564.     }
  565.    
  566.     DPS_RealSpecial(id, iEnt, fRange)
  567.    
  568.     if(iButton & IN_ATTACK && get_pdata_float(iEnt, 46,4) <= 0.0)
  569.     {
  570.         g_mode[id] = 0
  571.         g_slashend[id] = 0
  572.        
  573.         set_pev(iEnt, pev_iuser2, 1)
  574.         set_pev(iEnt, pev_iuser4, 0)
  575.        
  576.         switch(iState)
  577.         {
  578.             case 0:
  579.             {
  580.                 set_pdata_float(id, 83, 0.16)
  581.                 set_pdata_float(iEnt, 46, 0.4,4);
  582.                
  583.                 if(!get_pcvar_num(cvar_fast_attack))
  584.                     set_pdata_float(iEnt, 47, 0.4,4);
  585.                    
  586.                 set_pdata_float(iEnt, 48, 1.0,4);
  587.                
  588.                 set_pev(iEnt, pev_iuser1, 1)
  589.                 set_pev(iEnt, pev_iuser3, 1)
  590.                 set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  591.                
  592.                 Set_WeaponAnim(id, ANIM_STAB1)
  593.                 SendSound(id, CHAN_WEAPON, weapon_sound[0])
  594.                
  595.                 if(!g_check[id]) g_check[id] = 1
  596.                 else if(g_check[id] == 2) g_check[id] = 3
  597.                 else g_check[id] = 0
  598.             }
  599.             case 1:
  600.             {
  601.                 set_pdata_float(id, 83, 0.16)
  602.                 set_pdata_float(iEnt, 46, 0.83,4);
  603.                
  604.                 if(!get_pcvar_num(cvar_fast_attack))
  605.                     set_pdata_float(iEnt, 47, 0.83,4);
  606.                
  607.                 set_pdata_float(iEnt, 48, 1.5,4);
  608.                
  609.                 set_pev(iEnt, pev_iuser1, 1)
  610.                 set_pev(iEnt, pev_iuser3, 0)
  611.                 set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  612.                
  613.                 Set_WeaponAnim(id, ANIM_STAB2)
  614.                 SendSound(id, CHAN_WEAPON, weapon_sound[1])
  615.                
  616.                 if(g_check[id] == 3) g_check[id] = 4
  617.                 else g_check[id] = 0
  618.             }
  619.         }
  620.     }
  621.    
  622.     if(iButton & IN_ATTACK2 && get_pdata_float(iEnt, 47) <= 0.0 && !iSlash)
  623.     {
  624.         g_mode[id] = 1
  625.        
  626.         set_pdata_float(id, 83, 0.04)
  627.        
  628.         if(!get_pcvar_num(cvar_fast_attack))
  629.             set_pdata_float(iEnt, 46, 0.13,4);
  630.        
  631.         set_pdata_float(iEnt, 47, 0.13,4);
  632.         set_pdata_float(iEnt, 48, 0.5,4);
  633.        
  634.         set_pev(iEnt, pev_iuser1, 1)
  635.         set_pev(iEnt, pev_iuser2, 0)
  636.         set_pev(iEnt, pev_iuser3, 0)
  637.         set_pev(iEnt, pev_iuser4, 1)
  638.         set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  639.        
  640.         Set_WeaponAnim(id, ANIM_SLASH1)
  641.         SendSound(id, CHAN_WEAPON, weapon_sound[5])
  642.        
  643.         Create_Slash(id,iEnt,0)
  644.        
  645.         if(g_check[id] == 1) g_check[id] = 2
  646.         else if(g_check[id] == 4) g_check[id] = 5
  647.         else g_check[id] = 0
  648.     }
  649.    
  650.     iButton &= ~IN_ATTACK;
  651.     iButton &= ~IN_ATTACK2;
  652.     set_pev(id, pev_button, iButton);
  653.     return HAM_IGNORED
  654. }
  655.  
  656. stock Create_Slash(id,iEnt,seq)
  657. {
  658.     new Float:vecOrigin[3], Float:vecAngle[3];
  659.     GetGunPosition(id, vecOrigin);
  660.     pev(id, pev_v_angle, vecAngle);
  661.     vecAngle[0] = -vecAngle[0];
  662.    
  663.     new pEntity = DPS_Entites(id,"models/dualswordfx.mdl",vecOrigin,vecOrigin,0.01,SOLID_NOT,seq)
  664.        
  665.     // Set info for ent
  666.     Set_Entity_Mode(pEntity, 0)
  667.     set_pev(pEntity, pev_scale, 0.1);
  668.     set_pev(pEntity, pev_iuser1, iEnt);
  669.     set_pev(pEntity, pev_velocity, Float:{0.01,0.01,0.01});
  670.     set_pev(pEntity, pev_angles, vecAngle);
  671.     set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
  672. }
  673.  
  674. stock DPS_Special(id, seq, Float:fTime)
  675. {
  676.     new Float:VecOrig[3], Float:VecAng[3]
  677.     pev(id, pev_origin, VecOrig)
  678.     pev(id, pev_angles, VecAng)
  679.    
  680.     new iEfx = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  681.     set_pev(iEfx, pev_classname, "dps_entytyd");
  682.     set_pev(iEfx, pev_origin, VecOrig)
  683.     set_pev(iEfx, pev_frame, 0.0)
  684.     set_pev(iEfx, pev_animtime, get_gametime())
  685.     set_pev(iEfx, pev_framerate, 1.0)
  686.     set_pev(iEfx, pev_sequence, seq)
  687.     engfunc(EngFunc_SetModel, iEfx, "models/dualsword_skill.mdl")
  688.     dllfunc(DLLFunc_Spawn, iEfx)
  689.     Set_Entity_Mode(iEfx, 1)
  690.     set_pev(iEfx, pev_angles, VecAng)
  691.     set_pev(iEfx, pev_solid, SOLID_NOT)
  692.     set_pev(iEfx, pev_owner, id)
  693.     set_pev(iEfx, pev_velocity, Float:{0.01,0.01,0.01});
  694.     set_pev(iEfx, pev_fuser1, get_gametime() + fTime)
  695.     set_pev(iEfx, pev_nextthink, get_gametime() + 0.01)
  696. }
  697.  
  698. stock DPS_RealSpecial(id, iEnt, Float:fRange)
  699. {
  700.     new Float:fTimeEffect;
  701.     pev(iEnt, pev_fuser4, fTimeEffect);
  702.    
  703.     if (g_check[id] == 7 && fTimeEffect && fTimeEffect <= get_gametime())
  704.     {
  705.         KnifeAttack_Global(id, false, get_pcvar_float(cvar_special_range)*2.0, 180.0, get_pcvar_float(cvar_damage_special), get_pcvar_float(cvar_knockback[2]))
  706.            
  707.         new Float:vecOrigin3[2][3], Float:vecOrigin[3];
  708.         pev(id, pev_origin, vecOrigin3[0]);
  709.         pev(id, pev_origin, vecOrigin);
  710.         xs_vec_copy(vecOrigin3[0], vecOrigin3[1]);
  711.        
  712.         new Float:fFloat = random_float(fRange * -0.85, fRange * 0.85);
  713.         vecOrigin3[0][2] = vecOrigin3[1][2] = vecOrigin3[0][2] + random_float(-5.0, 65.0);
  714.        
  715.         switch (random(3))
  716.         {
  717.             case 0:
  718.             {
  719.                 vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);
  720.                 vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);
  721.                
  722.                 vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);
  723.                 vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);
  724.             }
  725.             case 1:
  726.             {
  727.                 vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);
  728.                 vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);
  729.                
  730.                 vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);
  731.                 vecOrigin3[1][1] += fFloat*random_float(-1.0, 1.0);
  732.             }
  733.             case 2:
  734.             {
  735.                 vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);
  736.                 vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);
  737.                
  738.                 vecOrigin3[1][0] += fFloat*random_float(-1.0, 1.0);
  739.                 vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);
  740.             }
  741.             case 3:
  742.             {
  743.                 vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);
  744.                 vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);
  745.                
  746.                 vecOrigin3[1][0] += fFloat*random_float(-1.0, 1.0);
  747.                 vecOrigin3[1][1] += fFloat*random_float(-1.0, 1.0);
  748.             }
  749.         }
  750.        
  751.         if (random_num(0,9) > 8)
  752.         {
  753.             new Float:vecAngle2[3];
  754.             vecAngle2[0] = random_num(0,1) ? random_float(-30.0, -15.0) : random_float(15.0, 30.0);
  755.             vecAngle2[1] = random_num(0,1) ? random_float(-180.0, 0.0) : random_float(0.0, 180.0);
  756.            
  757.             new pEntity = DPS_Entites(id,"models/dualsword_skillfx1.mdl",vecOrigin3[0],vecOrigin3[0],0.01,SOLID_NOT,0) 
  758.             set_pev(pEntity, pev_angles, vecAngle2);
  759.             set_pev(pEntity, pev_velocity, Float:{0.01,0.01,0.01});
  760.             set_pev(pEntity, pev_iuser1, 1);
  761.             set_pev(pEntity, pev_iuser2, iEnt);
  762.             set_pev(pEntity, pev_frame, 0.0);
  763.             Set_Entity_Mode(pEntity, 2)
  764.             set_pev(pEntity, pev_fuser1, get_gametime()+0.53);
  765.             set_pev(pEntity, pev_fuser2, get_gametime()+0.5);
  766.             set_pev(pEntity, pev_fuser3, get_gametime()+0.31);
  767.             set_pev(pEntity, pev_oldorigin, vecOrigin);
  768.             set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
  769.         }
  770.        
  771.         new pEntity = DPS_Entites(id,"models/dualsword_skillfx2.mdl",vecOrigin3[0],vecOrigin3[1],500.0,SOLID_TRIGGER,0)
  772.         set_pev(pEntity, pev_iuser1, 2);
  773.         set_pev(pEntity, pev_iuser2, iEnt);
  774.         Set_Entity_Mode(pEntity, 2)
  775.         set_pev(pEntity, pev_frame, 0.0);
  776.         set_pev(pEntity, pev_oldorigin, vecOrigin);
  777.         set_pev(pEntity, pev_fuser1, get_gametime()+0.2);
  778.         set_pev(pEntity, pev_fuser2, get_gametime()+0.5);
  779.         set_pev(pEntity, pev_fuser3, get_gametime()+0.3);
  780.         set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
  781.        
  782.         set_pev(iEnt, pev_fuser4, get_gametime()+0.05);
  783.     }
  784. }
  785.  
  786. stock DPS_Entites(id, models[], Float:Start[3], Float:End[3], Float:speed, solid, seq, move=MOVETYPE_FLY)
  787. {
  788.     new pEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
  789.        
  790.     // Set info for ent
  791.     set_pev(pEntity, pev_movetype, move);
  792.     set_pev(pEntity, pev_owner, id);
  793.     engfunc(EngFunc_SetModel, pEntity, models);
  794.     set_pev(pEntity, pev_classname, "dps_entytyd");
  795.     set_pev(pEntity, pev_mins, Float:{-1.0, -1.0, -1.0});
  796.     set_pev(pEntity, pev_maxs, Float:{1.0, 1.0, 1.0});
  797.     set_pev(pEntity, pev_origin, Start);
  798.     set_pev(pEntity, pev_gravity, 0.01);
  799.     set_pev(pEntity, pev_solid, solid);
  800.    
  801.     static Float:Velocity[3];
  802.     Stock_Get_Speed_Vector(Start, End, speed, Velocity);
  803.     set_pev(pEntity, pev_velocity, Velocity);
  804.  
  805.     new Float:vecVAngle[3]; pev(id, pev_v_angle, vecVAngle);
  806.     vector_to_angle(Velocity, vecVAngle)
  807.    
  808.     if(vecVAngle[0] > 90.0) vecVAngle[0] = -(360.0 - vecVAngle[0]);
  809.     set_pev(pEntity, pev_angles, vecVAngle);
  810.    
  811.     set_pev(pEntity, pev_rendermode, kRenderTransAdd);
  812.     set_pev(pEntity, pev_renderamt, 255.0);
  813.     set_pev(pEntity, pev_sequence, seq)
  814.     set_pev(pEntity, pev_animtime, get_gametime());
  815.     set_pev(pEntity, pev_framerate, 1.0)
  816.     return pEntity;
  817. }
  818.  
  819. stock Set_Entity_Mode(iEnt, mode) set_pev(iEnt, pev_iuser3, mode)
  820. stock Get_Entity_Mode(iEnt) return pev(iEnt,pev_iuser3)
  821.  
  822. stock SendSound(id, chan, sample[]) emit_sound(id, chan, sample, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  823.  
  824. stock Stock_Get_Speed_Vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
  825. {
  826.     xs_vec_sub(origin2, origin1, new_velocity)
  827.     new Float:num = floatsqroot(speed*speed / (new_velocity[0]*new_velocity[0] + new_velocity[1]*new_velocity[1] + new_velocity[2]*new_velocity[2]))
  828.     xs_vec_mul_scalar(new_velocity, num, new_velocity)
  829. }
  830. stock GetGunPosition(id, Float:vecSrc[3])
  831. {
  832.     new Float:vecViewOfs[3];
  833.     pev(id, pev_origin, vecSrc);
  834.     pev(id, pev_view_ofs, vecViewOfs);
  835.     xs_vec_add(vecSrc, vecViewOfs, vecSrc);
  836. }
  837. stock KnifeAttack_Global(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack)
  838. {
  839.     new iHitResult
  840.     if(fAngle > 0.0) iHitResult = KnifeAttack2(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack)
  841.     else iHitResult = KnifeAttack(id, bStab, Float:flRange, Float:flDamage, Float:flKnockBack)
  842.  
  843.     return iHitResult
  844. }
  845.  
  846. stock KnifeAttack(id, bStab, Float:flRange, Float:flDamage, Float:flKnockBack, iHitgroup = -1, bitsDamageType = DMG_NEVERGIB | DMG_CLUB)
  847. {
  848.     new Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
  849.     GetGunPosition(id, vecSrc);
  850.  
  851.     pev(id, pev_v_angle, v_angle);
  852.     engfunc(EngFunc_MakeVectors, v_angle);
  853.  
  854.     global_get(glb_v_forward, vecForward);
  855.     xs_vec_mul_scalar(vecForward, flRange, vecForward);
  856.     xs_vec_add(vecSrc, vecForward, vecEnd);
  857.  
  858.     new tr = create_tr2();
  859.     engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);
  860.  
  861.     new Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);
  862.     if (flFraction >= 1.0) engfunc(EngFunc_TraceHull, vecSrc, vecEnd, 0, 3, id, tr);
  863.    
  864.     get_tr2(tr, TR_flFraction, flFraction);
  865.  
  866.     new iHitResult = RESULT_HIT_NONE;
  867.    
  868.     if (flFraction < 1.0)
  869.     {
  870.         new pEntity = get_tr2(tr, TR_pHit);
  871.         iHitResult = RESULT_HIT_WORLD;
  872.        
  873.         if (pev_valid(pEntity) && (IsPlayer(pEntity) || IsHostage(pEntity)))
  874.         {
  875.             if (CheckBack(id, pEntity) && bStab && iHitgroup == -1)
  876.                 flDamage *= 1.0;
  877.  
  878.             iHitResult = RESULT_HIT_PLAYER;
  879.         }
  880.  
  881.         if (pev_valid(pEntity))
  882.         {
  883.             engfunc(EngFunc_MakeVectors, v_angle);
  884.             global_get(glb_v_forward, vecForward);
  885.  
  886.             if (iHitgroup != -1)
  887.                 set_tr2(tr, TR_iHitgroup, iHitgroup);
  888.  
  889.             ExecuteHamB(Ham_TraceAttack, pEntity, id, flDamage, vecForward, tr, bitsDamageType);
  890.             ExecuteHamB(Ham_TakeDamage, pEntity, id, id, flDamage, bitsDamageType)
  891.             Stock_Fake_KnockBack(id, pEntity, flKnockBack)
  892.            
  893.             if (IsAlive(pEntity))
  894.             {
  895.                 free_tr2(tr);
  896.                 return iHitResult;
  897.             }
  898.         }
  899.     }
  900.     free_tr2(tr);
  901.     return iHitResult;
  902. }
  903.  
  904. stock KnifeAttack2(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack, iHitgroup = -1, bNoTraceCheck = 0)
  905. {
  906.     new Float:vecOrigin[3], Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
  907.     pev(id, pev_origin, vecOrigin);
  908.  
  909.     new iHitResult = RESULT_HIT_NONE;
  910.     GetGunPosition(id, vecSrc);
  911.  
  912.     pev(id, pev_v_angle, v_angle);
  913.     engfunc(EngFunc_MakeVectors, v_angle);
  914.  
  915.     global_get(glb_v_forward, vecForward);
  916.     xs_vec_mul_scalar(vecForward, flRange, vecForward);
  917.     xs_vec_add(vecSrc, vecForward, vecEnd);
  918.  
  919.     new tr = create_tr2();
  920.     engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);
  921.    
  922.     new Float:EndPos2[3]
  923.     get_tr2(tr, TR_vecEndPos, EndPos2)
  924.    
  925.     new Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);
  926.     if (flFraction < 1.0)
  927.     {
  928.         iHitResult = RESULT_HIT_WORLD;
  929.         if(bStab) Stock_SakuraEffect(id, EndPos2)
  930.     }
  931.    
  932.     new Float:vecEndZ = vecEnd[2];
  933.    
  934.     new pEntity = -1;
  935.     while ((pEntity = engfunc(EngFunc_FindEntityInSphere, pEntity, vecOrigin, flRange)) != 0)
  936.     {
  937.         if (!pev_valid(pEntity))
  938.             continue;
  939.         if (id == pEntity)
  940.             continue;
  941.         if (!IsAlive(pEntity))
  942.             continue;
  943.         if (!CheckAngle(id, pEntity, fAngle))
  944.             continue;
  945.  
  946.         GetGunPosition(id, vecSrc);
  947.         Stock_Get_Origin(pEntity, vecEnd);
  948.  
  949.         vecEnd[2] = vecSrc[2] + (vecEndZ - vecSrc[2]) * (get_distance_f(vecSrc, vecEnd) / flRange);
  950.  
  951.         xs_vec_sub(vecEnd, vecSrc, vecForward);
  952.         xs_vec_normalize(vecForward, vecForward);
  953.         xs_vec_mul_scalar(vecForward, flRange, vecForward);
  954.         xs_vec_add(vecSrc, vecForward, vecEnd);
  955.  
  956.         engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);
  957.         get_tr2(tr, TR_flFraction, flFraction);
  958.  
  959.         if (flFraction >= 1.0) engfunc(EngFunc_TraceHull, vecSrc, vecEnd, 0, 3, id, tr);
  960.         get_tr2(tr, TR_flFraction, flFraction);
  961.  
  962.         if (flFraction < 1.0)
  963.         {
  964.             if (IsPlayer(pEntity) || IsHostage(pEntity))
  965.             {
  966.                 iHitResult = RESULT_HIT_PLAYER;
  967.                 if(bStab) Stock_SakuraEffect(id, vecEnd)
  968.                
  969.                 if (CheckBack(id, pEntity) && bStab && iHitgroup == -1)
  970.                     flDamage *= 1.0;
  971.             }
  972.  
  973.             if (get_tr2(tr, TR_pHit) == pEntity || bNoTraceCheck)
  974.             {
  975.                 engfunc(EngFunc_MakeVectors, v_angle);
  976.                 global_get(glb_v_forward, vecForward);
  977.  
  978.                 if (iHitgroup != -1) set_tr2(tr, TR_iHitgroup, iHitgroup);
  979.  
  980.                 ExecuteHamB(Ham_TraceAttack, pEntity, id, flDamage, vecForward, tr, DMG_NEVERGIB | DMG_CLUB);
  981.                 ExecuteHamB(Ham_TakeDamage, pEntity, id, id, flDamage, DMG_NEVERGIB | DMG_CLUB)
  982.                
  983.                 Stock_Fake_KnockBack(id, pEntity, flKnockBack)
  984.             }
  985.         }
  986.         free_tr2(tr);
  987.     }
  988.     return iHitResult;
  989. }
  990.  
  991. stock Set_WeaponAnim(id, anim)
  992. {
  993.     set_pev(id, pev_weaponanim, anim)
  994.    
  995.     message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
  996.     write_byte(anim)
  997.     write_byte(pev(id, pev_body))
  998.     message_end()
  999. }
  1000.  
  1001. stock Stock_Set_Vis(iEnt, iVis = 1)
  1002.     set_pev(iEnt, pev_effects, iVis == 1 ? pev(iEnt, pev_effects) & ~EF_NODRAW : pev(iEnt, pev_effects) | EF_NODRAW)
  1003.  
  1004. stock Stock_Hook_Ent(ent, Float:TargetOrigin[3], Float:Speed, mode=0)
  1005. {
  1006.     static Float:fl_Velocity[3],Float:EntOrigin[3],Float:distance_f,Float:fl_Time
  1007.     pev(ent, pev_origin, EntOrigin)
  1008.    
  1009.     if(!mode)
  1010.     {
  1011.         distance_f = get_distance_f(EntOrigin, TargetOrigin)
  1012.         fl_Time = distance_f / Speed
  1013.            
  1014.         pev(ent, pev_velocity, fl_Velocity)
  1015.            
  1016.         fl_Velocity[0] = (TargetOrigin[0] - EntOrigin[0]) / fl_Time
  1017.         fl_Velocity[1] = (TargetOrigin[1] - EntOrigin[1]) / fl_Time
  1018.         fl_Velocity[2] = (TargetOrigin[2] - EntOrigin[2]) / fl_Time
  1019.  
  1020.         if(vector_length(fl_Velocity) > 1.0) set_pev(ent, pev_velocity, fl_Velocity)
  1021.         else set_pev(ent, pev_velocity, Float:{0.01, 0.01, 0.01})
  1022.     } else {
  1023.         static Float:fl_EntVelocity[3], Float:fl_Acc[3]
  1024.         Stock_Directed_Vector(TargetOrigin, EntOrigin, fl_Velocity)
  1025.         xs_vec_mul_scalar(fl_Velocity, Speed, fl_Velocity)
  1026.        
  1027.         for(new i =0; i<3; i++)
  1028.         {
  1029.             if(fl_Velocity[i] > fl_EntVelocity[i])
  1030.             {
  1031.                 fl_Acc[i] = fl_Velocity[i]-fl_EntVelocity[i]
  1032.                 fl_Acc[i] = floatmin(70.0, fl_Acc[i])
  1033.                 fl_EntVelocity[i] += fl_Acc[i]
  1034.             }
  1035.             else if(fl_Velocity[i] < fl_EntVelocity[i])
  1036.             {
  1037.                 fl_Acc[i] = fl_EntVelocity[i]-fl_Velocity[i]
  1038.                 fl_Acc[i] = floatmin(70.0, fl_Acc[i])
  1039.                 fl_EntVelocity[i] -= fl_Acc[i]
  1040.             }
  1041.         }
  1042.         set_pev(ent, pev_velocity, fl_EntVelocity)
  1043.     }
  1044. }
  1045.  
  1046. stock Stock_Directed_Vector(Float:start[3],Float:end[3],Float:reOri[3])
  1047. {  
  1048.     new Float:v3[3],i
  1049.     for(i=0;i<3;i++) v3[i]=start[i]-end[i]
  1050.  
  1051.     new Float:vl = vector_length(v3)
  1052.     for(i=0;i<3;i++) reOri[i] = v3[i] / vl
  1053. }
  1054.  
  1055. stock Stock_Get_Postion(id,Float:forw,Float:right,Float:up,Float:vStart[])
  1056. {
  1057.     static Float:vOrigin[3], Float:vAngle[3], Float:vForward[3], Float:vRight[3], Float:vUp[3]
  1058.     pev(id, pev_origin, vOrigin)
  1059.     pev(id, pev_view_ofs,vUp)
  1060.     xs_vec_add(vOrigin,vUp,vOrigin)
  1061.     pev(id, pev_v_angle, vAngle)
  1062.    
  1063.     engfunc(EngFunc_AngleVectors, vAngle, vForward, vRight, vUp)
  1064.    
  1065.     vStart[0] = vOrigin[0] + vForward[0] * forw + vRight[0] * right + vUp[0] * up
  1066.     vStart[1] = vOrigin[1] + vForward[1] * forw + vRight[1] * right + vUp[1] * up
  1067.     vStart[2] = vOrigin[2] + vForward[2] * forw + vRight[2] * right + vUp[2] * up
  1068. }
  1069.  
  1070. stock IsPlayer(pEntity) return is_user_connected(pEntity)
  1071.  
  1072. stock IsHostage(pEntity)
  1073. {
  1074.     new classname[32]; pev(pEntity, pev_classname, classname, charsmax(classname))
  1075.     return equal(classname, "hostage_entity")
  1076. }
  1077.  
  1078. stock IsAlive(pEntity)
  1079. {
  1080.     if (pEntity < 1) return 0
  1081.     return (pev(pEntity, pev_deadflag) == DEAD_NO && pev(pEntity, pev_health) > 0)
  1082. }
  1083.  
  1084. stock CheckBack(iEnemy,id)
  1085. {
  1086.     new Float:anglea[3], Float:anglev[3]
  1087.     pev(iEnemy, pev_v_angle, anglea)
  1088.     pev(id, pev_v_angle, anglev)
  1089.     new Float:angle = anglea[1] - anglev[1]
  1090.     if (angle < -180.0) angle += 360.0
  1091.     if (angle <= 45.0 && angle >= -45.0) return 1
  1092.     return 0
  1093. }
  1094.  
  1095. stock CheckAngle(iAttacker, iVictim, Float:fAngle)  return(Stock_CheckAngle(iAttacker, iVictim) > floatcos(fAngle,degrees))
  1096.  
  1097. stock Float:Stock_CheckAngle(id,iTarget)
  1098. {
  1099.     new Float:vOricross[2],Float:fRad,Float:vId_ori[3],Float:vTar_ori[3],Float:vId_ang[3],Float:fLength,Float:vForward[3]
  1100.     Stock_Get_Origin(id, vId_ori)
  1101.     Stock_Get_Origin(iTarget, vTar_ori)
  1102.    
  1103.     pev(id,pev_angles,vId_ang)
  1104.     for(new i=0;i<2;i++) vOricross[i] = vTar_ori[i] - vId_ori[i]
  1105.    
  1106.     fLength = floatsqroot(vOricross[0]*vOricross[0] + vOricross[1]*vOricross[1])
  1107.    
  1108.     if (fLength<=0.0)
  1109.     {
  1110.         vOricross[0]=0.0
  1111.         vOricross[1]=0.0
  1112.     } else {
  1113.         vOricross[0]=vOricross[0]*(1.0/fLength)
  1114.         vOricross[1]=vOricross[1]*(1.0/fLength)
  1115.     }
  1116.    
  1117.     engfunc(EngFunc_MakeVectors,vId_ang)
  1118.     global_get(glb_v_forward,vForward)
  1119.    
  1120.     fRad = vOricross[0]*vForward[0]+vOricross[1]*vForward[1]
  1121.     return fRad   //->   RAD 90' = 0.5rad
  1122. }
  1123.  
  1124. stock Stock_Get_Origin(id, Float:origin[3])
  1125. {
  1126.     new Float:maxs[3],Float:mins[3]
  1127.     if (pev(id, pev_solid) == SOLID_BSP)
  1128.     {
  1129.         pev(id,pev_maxs,maxs)
  1130.         pev(id,pev_mins,mins)
  1131.         origin[0] = (maxs[0] - mins[0]) / 2 + mins[0]
  1132.         origin[1] = (maxs[1] - mins[1]) / 2 + mins[1]
  1133.         origin[2] = (maxs[2] - mins[2]) / 2 + mins[2]
  1134.     } else pev(id, pev_origin, origin)
  1135. }
  1136.  
  1137. public Stock_Fake_KnockBack(id, iVic, Float:iKb)
  1138. {
  1139.     if(iVic > 32) return
  1140.    
  1141.     new Float:vAttacker[3], Float:vVictim[3], Float:vVelocity[3], flags
  1142.     pev(id, pev_origin, vAttacker)
  1143.     pev(iVic, pev_origin, vVictim)
  1144.     vAttacker[2] = vVictim[2] = 0.0
  1145.     flags = pev(id, pev_flags)
  1146.    
  1147.     xs_vec_sub(vVictim, vAttacker, vVictim)
  1148.     new Float:fDistance
  1149.     fDistance = xs_vec_len(vVictim)
  1150.     xs_vec_mul_scalar(vVictim, 1 / fDistance, vVictim)
  1151.    
  1152.     pev(iVic, pev_velocity, vVelocity)
  1153.     xs_vec_mul_scalar(vVictim, iKb, vVictim)
  1154.     xs_vec_mul_scalar(vVictim, 50.0, vVictim)
  1155.     vVictim[2] = xs_vec_len(vVictim) * 0.15
  1156.    
  1157.     if(flags &~ FL_ONGROUND)
  1158.     {
  1159.         xs_vec_mul_scalar(vVictim, 1.2, vVictim)
  1160.         vVictim[2] *= 0.4
  1161.     }
  1162.     if(xs_vec_len(vVictim) > xs_vec_len(vVelocity)) set_pev(iVic, pev_velocity, vVictim)
  1163. }  
  1164.  
  1165. stock Float:Stock_Get_Body_Dmg(iBody)
  1166. {
  1167.     switch (iBody)
  1168.     {
  1169.         case HIT_GENERIC: return 0.75
  1170.         case 1: return 4.0
  1171.         case 2: return 1.0
  1172.         case 3: return 1.25
  1173.         case 4,5,6,7: return 0.75
  1174.         default: return 0.75
  1175.     }
  1176.     return 1.0
  1177. }
  1178.  
  1179. stock Stock_SakuraEffect(id, Float:vecOri[3])
  1180. {
  1181.     engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOri)
  1182.     write_byte(TE_BLOODSPRITE)
  1183.     engfunc(EngFunc_WriteCoord,vecOri[0])
  1184.     engfunc(EngFunc_WriteCoord,vecOri[1])
  1185.     engfunc(EngFunc_WriteCoord,vecOri[2])
  1186.     write_short(ef_sakura[g_mode[id]?2:0])
  1187.     write_short(ef_sakura[g_mode[id]?3:1])
  1188.     write_byte(g_mode[id]?178:128)
  1189.     write_byte(random_num(2,3))
  1190.     message_end()
  1191. }
  1192.  
  1193. stock can_damage(id1, id2)
  1194. {
  1195.     if(id1 <= 0 || id1 >= 33 || id2 <= 0 || id2 >= 33)
  1196.         return 1
  1197.        
  1198.     // Check team
  1199.     return(get_pdata_int(id1, 114) != get_pdata_int(id2, 114))
  1200. }
  1201. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  1202. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
  1203. */
I converted this new extra item but when i try to get it from shop server crashing for no reason from this plugin. Can someone fix it?

you forgot remove some includes that found in zombie_escape.inc
so replace your extra item code with:

Code: Select all

/* Plugin generated by AMXX-Studio */
#pragma compress 1
 
 
#include <engine>
#include <fakemeta_util>
#include <xs>
#include <zombie_escape>
#include <ze_vip>
 
#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_dps, g_soundmode[33]
new ef_sakura[4]
new Float:g_Sound[33]
 
new cvar_damage_slash[4], cvar_slash_radius, cvar_slash_range
new cvar_damage_stab[2], cvar_stab_radius, cvar_stab_range
new cvar_damage_special, cvar_special_range
new cvar_knockback[3], cvar_fast_attack, cvar_remove, cvar_spr
 
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    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_PostFrame, weapon_dps, "fw_Item_PostFrame")
   
    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 = ze_register_item("Dual Sword Phantom Slayer \r(VIP)", 50, 0)
}
 
public plugin_precache()
{
    precache_model(v_model)
    precache_model(p_model)
    precache_model(p_model2)
   
    for(new i = 0; i < sizeof(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(Txt, 31, "sprites/%s.txt", spr_wpn)
    engfunc(EngFunc_PrecacheGeneric, Txt)
}
 
public ze_user_infected(id) remove_dps(id)
public ze_user_humanized(id) remove_dps(id)
 
public hook_rb(id)
{
    engclient_cmd(id, weapon_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(id, weapon_dps)
   
    if (get_user_weapon(id) == CSW_DPS) Event_CurWeapon(id)
    else engclient_cmd(id,weapon_dps)
}
 
public client_connected(id) remove_dps(id)
public client_disconnected(id) remove_dps(id)
 
public Event_NewRound()
{
    if(!get_pcvar_num(cvar_remove))
        return
   
    for(new i = 0; i < get_maxplayers(); i++)
        remove_dps(i)
}
 
public remove_dps(id)
{
    g_had_dps[id] = 0
    g_slashend[id] = 0
    g_check[id] = 0
   
    static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)
    if(!pev_valid(iEnt)) return
   
    set_pev(iEnt, pev_iuser1, 0)
    set_pev(iEnt, pev_iuser2, 0)
    set_pev(iEnt, pev_iuser3, 0)
    set_pev(iEnt, pev_iuser4, 0)
    set_pev(iEnt, pev_fuser1, 0.0)
}
 
public ze_select_item_pre(id, itemid)
{  
    if (itemid != g_dps)
        return ZE_ITEM_AVAILABLE
           
    if (ze_is_user_zombie(id))
        return ZE_ITEM_DONT_SHOW
 
        if (!(ze_get_vip_flags(id) & VIP_A))
        return ZE_ITEM_DONT_SHOW
       
    return ZE_ITEM_AVAILABLE
}
 
public ze_select_item_post(id, itemid)
{
    if (itemid != g_dps)
        return
   
    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(ze_is_user_zombie(id))
        return 1
       
    set_pev(id, pev_viewmodel2, v_model)
    set_pev(id, pev_weaponmodel2, g_mode[id] ? p_model2:p_model)
   
    Set_WeaponAnim(id, g_mode[id]?ANIM_DRAWA:ANIM_DRAWB)
   
    static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)
    if(!pev_valid(iEnt)) return 1
   
    set_pev(iEnt, pev_iuser1, 0)
    set_pev(iEnt, pev_iuser2, 0)
    set_pev(iEnt, pev_iuser3, 0)
    set_pev(iEnt, pev_iuser4, 0)
    set_pev(iEnt, pev_fuser1, 0.0)
       
    g_slashend[id] = 0
    g_check[id] = 0
   
    set_pdata_float(id, 83, 0.23)
    set_pdata_float(iEnt, 46, 0.25);
    set_pdata_float(iEnt, 47, 0.25);
    set_pdata_float(iEnt, 48, 0.25);
   
    if(get_pcvar_num(cvar_spr))
    {
        message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
        write_string(g_had_dps[id] == 1 ? 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_id, msg_dest, msg_ent)
{
    new szWeapon[64]
    get_msg_arg_string(4, szWeapon, charsmax(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(iEntity, 43, 4) != 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(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
{
    if (!pev_valid(iEnt))
        return;
    if (pev(iEnt, pev_flags) & FL_KILLME)
        return;
 
    new classname[32];
    pev(iEnt, pev_classname, classname, 31);
 
    if (equal(classname,"dps_entytyd") && pev(iEnt, pev_iuser4))
    {
        if (iHost != pev(iEnt, pev_owner))
            set_es(esState, ES_Effects, (get_es(esState, ES_Effects) | EF_NODRAW));
    }
}
 
public Fw_DPSEnt_Think(iEnt)
{
    if(!pev_valid(iEnt))
        return
   
    new iOwner
    iOwner = pev(iEnt, pev_owner)
   
    if(!is_user_alive(iOwner) || !is_user_connected(iOwner) || ze_is_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(iEnt, pev_iuser1)
        iState = pev(iWpn, pev_iuser4)
        Stock_Get_Postion(iOwner, 0.0, 0.0, 0.0, vecOrigin);
       
        pev(iOwner, pev_v_angle, vecAngle);
        vecAngle[0] = -vecAngle[0];
       
        set_pev(iEnt, pev_origin, vecOrigin);
        set_pev(iEnt, pev_angles, vecAngle);
       
        if(!iState || get_user_weapon(iOwner) != CSW_DPS)
        {
            new Float:fRenderAmount;
            pev(iEnt, pev_renderamt, fRenderAmount);
 
            fRenderAmount -= 4.5;
 
            if (fRenderAmount <= 5.0)
            {
                remove_entity(iEnt);
                return;
            }
            set_pev(iEnt, pev_renderamt, fRenderAmount);
        }
    }
   
    if(Get_Entity_Mode(iEnt) == 1)
    {
        set_pev(iEnt, pev_movetype, MOVETYPE_FLY)
   
        static Float:Origin[3]; pev(iOwner, pev_origin, Origin)
        Origin[2] -= 25.0
       
        Stock_Hook_Ent(iEnt, Origin, 0.01)
       
        if(pev(iEnt, pev_fuser1) < get_gametime() || !IsAlive(iOwner))
        {
            set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME)
            return
        }
           
        set_pev(iEnt, pev_velocity, Float:{1.0,1.0,1.0});
        set_pev(iEnt, pev_origin, Origin);
    }
   
    if(Get_Entity_Mode(iEnt) == 2)
    {
        new Float:vecOrigin[3]
        GetGunPosition(iOwner, vecOrigin);
       
        new Float:fOldOrigin[3];
        pev(iEnt, pev_oldorigin, fOldOrigin);
       
        new Float:vecNewOrigin[3];
        pev(iEnt, pev_origin, vecNewOrigin);
       
        new Float:vecfff[3];
        xs_vec_sub(vecOrigin, fOldOrigin, vecfff);
        xs_vec_add(vecNewOrigin, vecfff, vecNewOrigin);
       
        set_pev(iEnt, pev_origin, vecNewOrigin);
        set_pev(iEnt, pev_oldorigin, vecOrigin);
       
        if (pev(iEnt, pev_iuser1) == 2)
        {
            new Float:fDist = get_distance_f(vecOrigin, vecNewOrigin);
            if (fDist > 175.0 * 0.5)
            {
                remove_entity(iEnt);
                return;
            }
        }
       
        if(g_Sound[iOwner] < get_gametime())
        {
            if(!g_soundmode[iOwner]) emit_sound(iOwner, CHAN_ITEM, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
            if(g_soundmode[iOwner] == 1) emit_sound(iOwner, CHAN_BODY, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
            if(g_soundmode[iOwner] == 2) emit_sound(iOwner, CHAN_VOICE, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
            if(g_soundmode[iOwner] == 3) emit_sound(iOwner, CHAN_WEAPON, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
           
            g_soundmode[iOwner]++
            if(g_soundmode[iOwner] > 3) g_soundmode[iOwner] = 0
           
            g_Sound[iOwner] = get_gametime()+0.088;
        }
    }
    set_pev(iEnt, pev_nextthink, get_gametime() + 0.01)
   
    if(Get_Entity_Mode(iEnt) == 2)
    {
        new Float:fTimeLast;
        pev(iEnt, pev_fuser1, fTimeLast);
       
        if (fTimeLast < get_gametime() || pev(pev(iEnt, pev_iuser2), pev_fuser1) < get_gametime())
        {
            if (pev(iEnt, pev_iuser1) == 1)
            {
                new Float:fRenderAmount;
                pev(iEnt, pev_renderamt, fRenderAmount);
                fRenderAmount -= 7.5;
               
                if (fRenderAmount <= 5.0)
                {
                    remove_entity(iEnt);
                    return;
                }
                set_pev(iEnt, pev_renderamt, fRenderAmount);
            } else remove_entity(iEnt);
           
            g_soundmode[iOwner] = 0
        }
    }
}
 
public fw_Item_PostFrame(ent)
{
    new id = pev(ent, pev_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(ent, 48, 4) <= 0.01 && (!pev(ent, pev_iuser2) || !g_slashend[id]))
    {
        if(g_check[id] < 6) g_check[id] = 0
        set_pev(ent, pev_iuser3, 0)
        Set_WeaponAnim(id, g_mode[id]?ANIM_IDLEA:ANIM_IDLEB)
        set_pdata_float(ent, 48, 4.03, 4)
    }
   
    new iButton = pev(id,pev_button)
    return AurezBotac(id, ent, iButton)
}
 
public AurezBotac(id, iEnt, iButton)
{
    new iState = pev(iEnt, pev_iuser3)
    new iState2 = pev(iEnt, pev_iuser2)
    new iSlash = pev(iEnt, pev_iuser4)
    new Float:fSound; pev(iEnt, pev_fuser1, fSound)
    new Float:fRange = get_pcvar_float(g_mode[id] ? cvar_slash_range : cvar_stab_range)
   
    if(!(iButton & IN_ATTACK) && get_pdata_float(iEnt, 46,4) <= 0.0 && iState2)
    {
        if(!iState || iState == 1)
        {
            Set_WeaponAnim(id, ANIM_STABEND)
            set_pev(iEnt, pev_iuser2, 0)
            set_pdata_float(iEnt, 48, 1.45,4)
        }
    }
   
    if(!(iButton & IN_ATTACK2) && get_pdata_float(iEnt, 47,4) <= 0.0 && g_slashend[id])
    {
        Set_WeaponAnim(id, ANIM_SLASHEND)
        set_pdata_float(iEnt, 48, 2.03,4)
        g_slashend[id] = 0
    }
   
    if (get_pdata_float(id, 83) <= 0.0 && pev(iEnt, pev_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(id, true, fRange, fAngle, fDamage, get_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(iEnt, pev_iuser1, 0);
    }
   
    if(get_pdata_float(iEnt, 47,4) <= 0.0 && iSlash && iSlash <= 4)
    {
        set_pev(iEnt, pev_iuser4, 1 + iSlash)
        Set_WeaponAnim(id, 1 + iSlash)
       
        set_pdata_float(id, 83, 0.06)
       
        if(!get_pcvar_num(cvar_fast_attack))
            set_pdata_float(iEnt, 46, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);
       
        set_pdata_float(iEnt, 47, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);
        set_pdata_float(iEnt, 48, iSlash == 3 ? 1.4 : 1.0,4);
         
        set_pev(iEnt, pev_iuser1, 1)
        set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
        SendSound(id, CHAN_WEAPON, weapon_sound[5 + iSlash])
        Create_Slash(id,iEnt,iSlash)
       
        if(iSlash == 3)
        {
            g_slashend[id] = 1
           
            set_pev(iEnt, pev_fuser1, get_gametime() + (g_check[id] == 5 ? 0.43 : 0.5))
            set_pev(iEnt, pev_iuser4, 0)
        }
    }
   
    if(fSound && fSound < get_gametime())
    {
        SendSound(id,CHAN_VOICE,weapon_sound[g_check[id] == 5 ? 13 : 12])
        set_pev(iEnt, pev_fuser1, 0.0)
       
        if(g_check[id] == 5)
        {
            Set_WeaponAnim(id, 14)
            SendSound(id,CHAN_ITEM,weapon_sound[20])
            g_check[id] = 6
           
            set_pdata_float(iEnt, 46, 1.03,4)
            set_pdata_float(iEnt, 47, 1.03,4)
            set_pdata_float(iEnt, 48, 1.03,4)
           
            set_pev(iEnt, pev_fuser4, get_gametime()+1.7);
            DPS_Special(id, 0, 2.0)
        }
    }
   
    if(g_check[id] == 6 && get_pdata_float(iEnt, 46,4) <= 0.0)
    {
        set_pdata_float(iEnt, 46, 11.36,4)
        set_pdata_float(iEnt, 47, 11.36,4)
        set_pdata_float(iEnt, 48, 11.36,4)
       
        g_check[id] = 7
        set_pev(iEnt, pev_fuser1, get_gametime() + 10.6)
        Set_WeaponAnim(id, 15)
    }
   
    // NANI?!
    if(g_check[id] == 7 && fSound && fSound < get_gametime())
    {
        SendSound(id,CHAN_VOICE,weapon_sound[14])
        set_pev(iEnt, pev_fuser1, 0.0)
        g_check[id] = 0
       
        DPS_Special(id, 1, 1.46)
    }
   
    DPS_RealSpecial(id, iEnt, fRange)
   
    if(iButton & IN_ATTACK && get_pdata_float(iEnt, 46,4) <= 0.0)
    {
        g_mode[id] = 0
        g_slashend[id] = 0
       
        set_pev(iEnt, pev_iuser2, 1)
        set_pev(iEnt, pev_iuser4, 0)
       
        switch(iState)
        {
            case 0:
            {
                set_pdata_float(id, 83, 0.16)
                set_pdata_float(iEnt, 46, 0.4,4);
               
                if(!get_pcvar_num(cvar_fast_attack))
                    set_pdata_float(iEnt, 47, 0.4,4);
                   
                set_pdata_float(iEnt, 48, 1.0,4);
               
                set_pev(iEnt, pev_iuser1, 1)
                set_pev(iEnt, pev_iuser3, 1)
                set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
               
                Set_WeaponAnim(id, ANIM_STAB1)
                SendSound(id, CHAN_WEAPON, weapon_sound[0])
               
                if(!g_check[id]) g_check[id] = 1
                else if(g_check[id] == 2) g_check[id] = 3
                else g_check[id] = 0
            }
            case 1:
            {
                set_pdata_float(id, 83, 0.16)
                set_pdata_float(iEnt, 46, 0.83,4);
               
                if(!get_pcvar_num(cvar_fast_attack))
                    set_pdata_float(iEnt, 47, 0.83,4);
               
                set_pdata_float(iEnt, 48, 1.5,4);
               
                set_pev(iEnt, pev_iuser1, 1)
                set_pev(iEnt, pev_iuser3, 0)
                set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
               
                Set_WeaponAnim(id, ANIM_STAB2)
                SendSound(id, CHAN_WEAPON, weapon_sound[1])
               
                if(g_check[id] == 3) g_check[id] = 4
                else g_check[id] = 0
            }
        }
    }
   
    if(iButton & IN_ATTACK2 && get_pdata_float(iEnt, 47) <= 0.0 && !iSlash)
    {
        g_mode[id] = 1
       
        set_pdata_float(id, 83, 0.04)
       
        if(!get_pcvar_num(cvar_fast_attack))
            set_pdata_float(iEnt, 46, 0.13,4);
       
        set_pdata_float(iEnt, 47, 0.13,4);
        set_pdata_float(iEnt, 48, 0.5,4);
       
        set_pev(iEnt, pev_iuser1, 1)
        set_pev(iEnt, pev_iuser2, 0)
        set_pev(iEnt, pev_iuser3, 0)
        set_pev(iEnt, pev_iuser4, 1)
        set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
       
        Set_WeaponAnim(id, ANIM_SLASH1)
        SendSound(id, CHAN_WEAPON, weapon_sound[5])
       
        Create_Slash(id,iEnt,0)
       
        if(g_check[id] == 1) g_check[id] = 2
        else if(g_check[id] == 4) g_check[id] = 5
        else g_check[id] = 0
    }
   
    iButton &= ~IN_ATTACK;
    iButton &= ~IN_ATTACK2;
    set_pev(id, pev_button, iButton);
    return HAM_IGNORED
}
 
stock Create_Slash(id,iEnt,seq)
{
    new Float:vecOrigin[3], Float:vecAngle[3];
    GetGunPosition(id, vecOrigin);
    pev(id, pev_v_angle, vecAngle);
    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(pEntity, 0)
    set_pev(pEntity, pev_scale, 0.1);
    set_pev(pEntity, pev_iuser1, iEnt);
    set_pev(pEntity, pev_velocity, Float:{0.01,0.01,0.01});
    set_pev(pEntity, pev_angles, vecAngle);
    set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
}
 
stock DPS_Special(id, seq, Float:fTime)
{
    new Float:VecOrig[3], Float:VecAng[3]
    pev(id, pev_origin, VecOrig)
    pev(id, pev_angles, VecAng)
   
    new iEfx = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
    set_pev(iEfx, pev_classname, "dps_entytyd");
    set_pev(iEfx, pev_origin, VecOrig)
    set_pev(iEfx, pev_frame, 0.0)
    set_pev(iEfx, pev_animtime, get_gametime())
    set_pev(iEfx, pev_framerate, 1.0)
    set_pev(iEfx, pev_sequence, seq)
    engfunc(EngFunc_SetModel, iEfx, "models/dualsword_skill.mdl")
    dllfunc(DLLFunc_Spawn, iEfx)
    Set_Entity_Mode(iEfx, 1)
    set_pev(iEfx, pev_angles, VecAng)
    set_pev(iEfx, pev_solid, SOLID_NOT)
    set_pev(iEfx, pev_owner, id)
    set_pev(iEfx, pev_velocity, Float:{0.01,0.01,0.01});
    set_pev(iEfx, pev_fuser1, get_gametime() + fTime)
    set_pev(iEfx, pev_nextthink, get_gametime() + 0.01)
}
 
stock DPS_RealSpecial(id, iEnt, Float:fRange)
{
    new Float:fTimeEffect;
    pev(iEnt, pev_fuser4, fTimeEffect);
   
    if (g_check[id] == 7 && fTimeEffect && fTimeEffect <= get_gametime())
    {
        KnifeAttack_Global(id, false, get_pcvar_float(cvar_special_range)*2.0, 180.0, get_pcvar_float(cvar_damage_special), get_pcvar_float(cvar_knockback[2]))
           
        new Float:vecOrigin3[2][3], Float:vecOrigin[3];
        pev(id, pev_origin, vecOrigin3[0]);
        pev(id, pev_origin, vecOrigin);
        xs_vec_copy(vecOrigin3[0], vecOrigin3[1]);
       
        new Float:fFloat = random_float(fRange * -0.85, fRange * 0.85);
        vecOrigin3[0][2] = vecOrigin3[1][2] = vecOrigin3[0][2] + random_float(-5.0, 65.0);
       
        switch (random(3))
        {
            case 0:
            {
                vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);
                vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);
               
                vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);
                vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);
            }
            case 1:
            {
                vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);
                vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);
               
                vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);
                vecOrigin3[1][1] += fFloat*random_float(-1.0, 1.0);
            }
            case 2:
            {
                vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);
                vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);
               
                vecOrigin3[1][0] += fFloat*random_float(-1.0, 1.0);
                vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);
            }
            case 3:
            {
                vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);
                vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);
               
                vecOrigin3[1][0] += fFloat*random_float(-1.0, 1.0);
                vecOrigin3[1][1] += fFloat*random_float(-1.0, 1.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.0, 30.0);
            vecAngle2[1] = random_num(0,1) ? random_float(-180.0, 0.0) : random_float(0.0, 180.0);
           
            new pEntity = DPS_Entites(id,"models/dualsword_skillfx1.mdl",vecOrigin3[0],vecOrigin3[0],0.01,SOLID_NOT,0) 
            set_pev(pEntity, pev_angles, vecAngle2);
            set_pev(pEntity, pev_velocity, Float:{0.01,0.01,0.01});
            set_pev(pEntity, pev_iuser1, 1);
            set_pev(pEntity, pev_iuser2, iEnt);
            set_pev(pEntity, pev_frame, 0.0);
            Set_Entity_Mode(pEntity, 2)
            set_pev(pEntity, pev_fuser1, get_gametime()+0.53);
            set_pev(pEntity, pev_fuser2, get_gametime()+0.5);
            set_pev(pEntity, pev_fuser3, get_gametime()+0.31);
            set_pev(pEntity, pev_oldorigin, vecOrigin);
            set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
        }
       
        new pEntity = DPS_Entites(id,"models/dualsword_skillfx2.mdl",vecOrigin3[0],vecOrigin3[1],500.0,SOLID_TRIGGER,0)
        set_pev(pEntity, pev_iuser1, 2);
        set_pev(pEntity, pev_iuser2, iEnt);
        Set_Entity_Mode(pEntity, 2)
        set_pev(pEntity, pev_frame, 0.0);
        set_pev(pEntity, pev_oldorigin, vecOrigin);
        set_pev(pEntity, pev_fuser1, get_gametime()+0.2);
        set_pev(pEntity, pev_fuser2, get_gametime()+0.5);
        set_pev(pEntity, pev_fuser3, get_gametime()+0.3);
        set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
       
        set_pev(iEnt, pev_fuser4, get_gametime()+0.05);
    }
}
 
stock DPS_Entites(id, models[], Float:Start[3], Float:End[3], Float:speed, solid, seq, move=MOVETYPE_FLY)
{
    new pEntity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
       
    // Set info for ent
    set_pev(pEntity, pev_movetype, move);
    set_pev(pEntity, pev_owner, id);
    engfunc(EngFunc_SetModel, pEntity, models);
    set_pev(pEntity, pev_classname, "dps_entytyd");
    set_pev(pEntity, pev_mins, Float:{-1.0, -1.0, -1.0});
    set_pev(pEntity, pev_maxs, Float:{1.0, 1.0, 1.0});
    set_pev(pEntity, pev_origin, Start);
    set_pev(pEntity, pev_gravity, 0.01);
    set_pev(pEntity, pev_solid, solid);
   
    static Float:Velocity[3];
    Stock_Get_Speed_Vector(Start, End, speed, Velocity);
    set_pev(pEntity, pev_velocity, Velocity);
 
    new Float:vecVAngle[3]; pev(id, pev_v_angle, vecVAngle);
    vector_to_angle(Velocity, vecVAngle)
   
    if(vecVAngle[0] > 90.0) vecVAngle[0] = -(360.0 - vecVAngle[0]);
    set_pev(pEntity, pev_angles, vecVAngle);
   
    set_pev(pEntity, pev_rendermode, kRenderTransAdd);
    set_pev(pEntity, pev_renderamt, 255.0);
    set_pev(pEntity, pev_sequence, seq)
    set_pev(pEntity, pev_animtime, get_gametime());
    set_pev(pEntity, pev_framerate, 1.0)
    return pEntity;
}
 
stock Set_Entity_Mode(iEnt, mode) set_pev(iEnt, pev_iuser3, mode)
stock Get_Entity_Mode(iEnt) return pev(iEnt,pev_iuser3)
 
stock SendSound(id, chan, sample[]) emit_sound(id, chan, sample, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
 
stock Stock_Get_Speed_Vector(const Float:origin1[3],const Float:origin2[3],Float:speed, Float:new_velocity[3])
{
    xs_vec_sub(origin2, origin1, new_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_velocity, num, new_velocity)
}
stock GetGunPosition(id, Float:vecSrc[3])
{
    new Float:vecViewOfs[3];
    pev(id, pev_origin, vecSrc);
    pev(id, pev_view_ofs, vecViewOfs);
    xs_vec_add(vecSrc, vecViewOfs, vecSrc);
}
stock KnifeAttack_Global(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack)
{
    new iHitResult
    if(fAngle > 0.0) iHitResult = KnifeAttack2(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack)
    else iHitResult = KnifeAttack(id, bStab, Float:flRange, Float:flDamage, Float:flKnockBack)
 
    return iHitResult
}
 
stock KnifeAttack(id, bStab, Float:flRange, Float:flDamage, Float:flKnockBack, iHitgroup = -1, bitsDamageType = DMG_NEVERGIB | DMG_CLUB)
{
    new Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
    GetGunPosition(id, vecSrc);
 
    pev(id, pev_v_angle, v_angle);
    engfunc(EngFunc_MakeVectors, v_angle);
 
    global_get(glb_v_forward, vecForward);
    xs_vec_mul_scalar(vecForward, flRange, vecForward);
    xs_vec_add(vecSrc, vecForward, vecEnd);
 
    new tr = create_tr2();
    engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);
 
    new Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);
    if (flFraction >= 1.0) engfunc(EngFunc_TraceHull, vecSrc, vecEnd, 0, 3, id, tr);
   
    get_tr2(tr, TR_flFraction, flFraction);
 
    new iHitResult = RESULT_HIT_NONE;
   
    if (flFraction < 1.0)
    {
        new pEntity = get_tr2(tr, TR_pHit);
        iHitResult = RESULT_HIT_WORLD;
       
        if (pev_valid(pEntity) && (IsPlayer(pEntity) || IsHostage(pEntity)))
        {
            if (CheckBack(id, pEntity) && bStab && iHitgroup == -1)
                flDamage *= 1.0;
 
            iHitResult = RESULT_HIT_PLAYER;
        }
 
        if (pev_valid(pEntity))
        {
            engfunc(EngFunc_MakeVectors, v_angle);
            global_get(glb_v_forward, vecForward);
 
            if (iHitgroup != -1)
                set_tr2(tr, TR_iHitgroup, iHitgroup);
 
            ExecuteHamB(Ham_TraceAttack, pEntity, id, flDamage, vecForward, tr, bitsDamageType);
            ExecuteHamB(Ham_TakeDamage, pEntity, id, id, flDamage, bitsDamageType)
            Stock_Fake_KnockBack(id, pEntity, flKnockBack)
           
            if (IsAlive(pEntity))
            {
                free_tr2(tr);
                return iHitResult;
            }
        }
    }
    free_tr2(tr);
    return iHitResult;
}
 
stock KnifeAttack2(id, bStab, Float:flRange, Float:fAngle, Float:flDamage, Float:flKnockBack, iHitgroup = -1, bNoTraceCheck = 0)
{
    new Float:vecOrigin[3], Float:vecSrc[3], Float:vecEnd[3], Float:v_angle[3], Float:vecForward[3];
    pev(id, pev_origin, vecOrigin);
 
    new iHitResult = RESULT_HIT_NONE;
    GetGunPosition(id, vecSrc);
 
    pev(id, pev_v_angle, v_angle);
    engfunc(EngFunc_MakeVectors, v_angle);
 
    global_get(glb_v_forward, vecForward);
    xs_vec_mul_scalar(vecForward, flRange, vecForward);
    xs_vec_add(vecSrc, vecForward, vecEnd);
 
    new tr = create_tr2();
    engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);
   
    new Float:EndPos2[3]
    get_tr2(tr, TR_vecEndPos, EndPos2)
   
    new Float:flFraction; get_tr2(tr, TR_flFraction, flFraction);
    if (flFraction < 1.0)
    {
        iHitResult = RESULT_HIT_WORLD;
        if(bStab) Stock_SakuraEffect(id, EndPos2)
    }
   
    new Float:vecEndZ = vecEnd[2];
   
    new pEntity = -1;
    while ((pEntity = engfunc(EngFunc_FindEntityInSphere, pEntity, vecOrigin, flRange)) != 0)
    {
        if (!pev_valid(pEntity))
            continue;
        if (id == pEntity)
            continue;
        if (!IsAlive(pEntity))
            continue;
        if (!CheckAngle(id, pEntity, fAngle))
            continue;
 
        GetGunPosition(id, vecSrc);
        Stock_Get_Origin(pEntity, vecEnd);
 
        vecEnd[2] = vecSrc[2] + (vecEndZ - vecSrc[2]) * (get_distance_f(vecSrc, vecEnd) / flRange);
 
        xs_vec_sub(vecEnd, vecSrc, vecForward);
        xs_vec_normalize(vecForward, vecForward);
        xs_vec_mul_scalar(vecForward, flRange, vecForward);
        xs_vec_add(vecSrc, vecForward, vecEnd);
 
        engfunc(EngFunc_TraceLine, vecSrc, vecEnd, 0, id, tr);
        get_tr2(tr, TR_flFraction, flFraction);
 
        if (flFraction >= 1.0) engfunc(EngFunc_TraceHull, vecSrc, vecEnd, 0, 3, id, tr);
        get_tr2(tr, TR_flFraction, flFraction);
 
        if (flFraction < 1.0)
        {
            if (IsPlayer(pEntity) || IsHostage(pEntity))
            {
                iHitResult = RESULT_HIT_PLAYER;
                if(bStab) Stock_SakuraEffect(id, vecEnd)
               
                if (CheckBack(id, pEntity) && bStab && iHitgroup == -1)
                    flDamage *= 1.0;
            }
 
            if (get_tr2(tr, TR_pHit) == pEntity || bNoTraceCheck)
            {
                engfunc(EngFunc_MakeVectors, v_angle);
                global_get(glb_v_forward, vecForward);
 
                if (iHitgroup != -1) set_tr2(tr, TR_iHitgroup, iHitgroup);
 
                ExecuteHamB(Ham_TraceAttack, pEntity, id, flDamage, vecForward, tr, DMG_NEVERGIB | DMG_CLUB);
                ExecuteHamB(Ham_TakeDamage, pEntity, id, id, flDamage, DMG_NEVERGIB | DMG_CLUB)
               
                Stock_Fake_KnockBack(id, pEntity, flKnockBack)
            }
        }
        free_tr2(tr);
    }
    return iHitResult;
}
 
stock Set_WeaponAnim(id, anim)
{
    set_pev(id, pev_weaponanim, anim)
   
    message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0, 0, 0}, id)
    write_byte(anim)
    write_byte(pev(id, pev_body))
    message_end()
}
 
stock Stock_Set_Vis(iEnt, iVis = 1)
    set_pev(iEnt, pev_effects, iVis == 1 ? pev(iEnt, pev_effects) & ~EF_NODRAW : pev(iEnt, pev_effects) | EF_NODRAW)
 
stock Stock_Hook_Ent(ent, Float:TargetOrigin[3], Float:Speed, mode=0)
{
    static Float:fl_Velocity[3],Float:EntOrigin[3],Float:distance_f,Float:fl_Time
    pev(ent, pev_origin, EntOrigin)
   
    if(!mode)
    {
        distance_f = get_distance_f(EntOrigin, TargetOrigin)
        fl_Time = distance_f / Speed
           
        pev(ent, pev_velocity, fl_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.0) set_pev(ent, pev_velocity, fl_Velocity)
        else set_pev(ent, pev_velocity, Float:{0.01, 0.01, 0.01})
    } else {
        static Float:fl_EntVelocity[3], Float:fl_Acc[3]
        Stock_Directed_Vector(TargetOrigin, EntOrigin, fl_Velocity)
        xs_vec_mul_scalar(fl_Velocity, Speed, fl_Velocity)
       
        for(new i =0; i<3; i++)
        {
            if(fl_Velocity[i] > fl_EntVelocity[i])
            {
                fl_Acc[i] = fl_Velocity[i]-fl_EntVelocity[i]
                fl_Acc[i] = floatmin(70.0, fl_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.0, fl_Acc[i])
                fl_EntVelocity[i] -= fl_Acc[i]
            }
        }
        set_pev(ent, pev_velocity, fl_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(id, pev_origin, vOrigin)
    pev(id, pev_view_ofs,vUp)
    xs_vec_add(vOrigin,vUp,vOrigin)
    pev(id, pev_v_angle, vAngle)
   
    engfunc(EngFunc_AngleVectors, vAngle, vForward, vRight, vUp)
   
    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(pEntity, pev_classname, classname, charsmax(classname))
    return equal(classname, "hostage_entity")
}
 
stock IsAlive(pEntity)
{
    if (pEntity < 1) return 0
    return (pev(pEntity, pev_deadflag) == DEAD_NO && pev(pEntity, pev_health) > 0)
}
 
stock CheckBack(iEnemy,id)
{
    new Float:anglea[3], Float:anglev[3]
    pev(iEnemy, pev_v_angle, anglea)
    pev(id, pev_v_angle, anglev)
    new Float:angle = anglea[1] - anglev[1]
    if (angle < -180.0) angle += 360.0
    if (angle <= 45.0 && angle >= -45.0) return 1
    return 0
}
 
stock CheckAngle(iAttacker, iVictim, Float:fAngle)  return(Stock_CheckAngle(iAttacker, iVictim) > 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(id, vId_ori)
    Stock_Get_Origin(iTarget, vTar_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(id, Float:origin[3])
{
    new Float:maxs[3],Float:mins[3]
    if (pev(id, pev_solid) == SOLID_BSP)
    {
        pev(id,pev_maxs,maxs)
        pev(id,pev_mins,mins)
        origin[0] = (maxs[0] - mins[0]) / 2 + mins[0]
        origin[1] = (maxs[1] - mins[1]) / 2 + mins[1]
        origin[2] = (maxs[2] - mins[2]) / 2 + mins[2]
    } else pev(id, pev_origin, origin)
}
 
public Stock_Fake_KnockBack(id, iVic, Float:iKb)
{
    if(iVic > 32) return
   
    new Float:vAttacker[3], Float:vVictim[3], Float:vVelocity[3], flags
    pev(id, pev_origin, vAttacker)
    pev(iVic, pev_origin, vVictim)
    vAttacker[2] = vVictim[2] = 0.0
    flags = pev(id, pev_flags)
   
    xs_vec_sub(vVictim, vAttacker, vVictim)
    new Float:fDistance
    fDistance = xs_vec_len(vVictim)
    xs_vec_mul_scalar(vVictim, 1 / fDistance, vVictim)
   
    pev(iVic, pev_velocity, vVelocity)
    xs_vec_mul_scalar(vVictim, iKb, vVictim)
    xs_vec_mul_scalar(vVictim, 50.0, vVictim)
    vVictim[2] = xs_vec_len(vVictim) * 0.15
   
    if(flags &~ FL_ONGROUND)
    {
        xs_vec_mul_scalar(vVictim, 1.2, vVictim)
        vVictim[2] *= 0.4
    }
    if(xs_vec_len(vVictim) > xs_vec_len(vVelocity)) set_pev(iVic, pev_velocity, vVictim)
}  
 
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(id, Float:vecOri[3])
{
    engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vecOri)
    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(id1, id2)
{
    if(id1 <= 0 || id1 >= 33 || id2 <= 0 || id2 >= 33)
        return 1
       
    // Check team
    return(get_pdata_int(id1, 114) != get_pdata_int(id2, 114))
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
.::Kaya Gaming || Never Give Up || Zombie Escape::. [Server is Under The Work]
https://kaya-gaming.ga/

I just believe in two things, First thing is who i see in the mirror, second thing is who i don't see in the sky.

Mystic Viper
Senior Member
Senior Member
Romania
Posts: 104
Joined: 11 Months Ago
Has thanked: 1 time
Been thanked: 3 times
Contact:

#3

Post by Mystic Viper » 2 Months Ago

Not working

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#4

Post by Raheem » 2 Months Ago

This code should work safely with linux:

  1. #pragma compress 1
  2.  
  3. #include <amxmodx>
  4. #include <engine>
  5. #include <fakemeta>
  6. #include <fakemeta_util>
  7. #include <hamsandwich>
  8. #include <xs>
  9. #include <zombie_escape>
  10. #include <ze_vip>
  11.  
  12. #define PLUGIN "CSO Dual Sword Phantom Slayer"
  13. #define VERSION "1.0"
  14. #define AUTHOR "Natasha aka Asdian"
  15.  
  16. #define CSW_DPS CSW_KNIFE
  17. #define weapon_dps "weapon_knife"
  18.  
  19. #define v_model "models/v_dualsword.mdl"
  20. #define p_model "models/p_dualsword_a.mdl"
  21. #define p_model2 "models/p_dualsword_b.mdl"
  22. #define spr_wpn "knife_dualsword"
  23.  
  24. new const weapon_sound[][] =
  25. {
  26.     "weapons/dualsword_stab1.wav",              // 0
  27.     "weapons/dualsword_stab2.wav",              // 1
  28.     "weapons/dualsword_stab1_hit.wav",          // 2
  29.     "weapons/dualsword_stab2_hit.wav",          // 3
  30.     "weapons/katanad_hitwall.wav",              // 4
  31.    
  32.     "weapons/dualsword_slash_1.wav",            // 5
  33.     "weapons/dualsword_slash_2.wav",            // 6
  34.     "weapons/dualsword_slash_3.wav",            // 7
  35.     "weapons/dualsword_slash_4.wav",            // 8
  36.     "weapons/dualsword_hit1.wav",               // 9
  37.     "weapons/dualsword_hit2.wav",               // 10
  38.     "weapons/dualsword_hit3.wav",               // 11
  39.     "weapons/dualsword_slash_4_1.wav",          // 12
  40.     "weapons/dualsword_slash_4_2.wav",          // 13
  41.     "weapons/dualsword_skill_end.wav",          // 14
  42.    
  43.     "weapons/dualsword_fly1.wav",               // 15
  44.     "weapons/dualsword_fly2.wav",               // 16
  45.     "weapons/dualsword_fly3.wav",               // 17
  46.     "weapons/dualsword_fly4.wav",               // 18
  47.     "weapons/dualsword_fly5.wav",               // 19
  48.     "weapons/dualsword_skill_start.wav"
  49. }
  50.  
  51. //Hit
  52. #define RESULT_HIT_NONE             0
  53. #define RESULT_HIT_PLAYER           1
  54. #define RESULT_HIT_WORLD            2
  55.  
  56. enum _:WpnAnim
  57. {
  58.     ANIM_IDLEA = 0,
  59.     ANIM_SLASH1,
  60.     ANIM_SLASH2,
  61.     ANIM_SLASH3,
  62.     ANIM_SLASH4,
  63.     ANIM_SLASHEND,
  64.     ANIM_DRAWA,
  65.     ANIM_IDLEB,
  66.     ANIM_STAB1,
  67.     ANIM_STAB2,
  68.     ANIM_STABEND,
  69.     ANIM_DRAWB
  70. }
  71.  
  72. new g_had_dps[33], g_mode[33], g_slashend[33], g_check[33], g_dps, g_soundmode[33]
  73. new ef_sakura[4]
  74. new Float:g_Sound[33]
  75.  
  76. new cvar_damage_slash[4], cvar_slash_radius, cvar_slash_range
  77. new cvar_damage_stab[2], cvar_stab_radius, cvar_stab_range
  78. new cvar_damage_special, cvar_special_range
  79. new cvar_knockback[3], cvar_fast_attack, cvar_remove, cvar_spr
  80.  
  81. public plugin_init()
  82. {
  83.     register_plugin(PLUGIN, VERSION, AUTHOR)
  84.    
  85.     register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
  86.     register_message(get_user_msgid("DeathMsg"), "message_DeathMsg")
  87.     register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0")
  88.     register_forward(FM_AddToFullPack, "Fw_AddToFullPack_Post", 1);
  89.  
  90.     register_think("dps_entytyd", "Fw_DPSEnt_Think")
  91.    
  92.     RegisterHam(Ham_Item_PostFrame, weapon_dps, "fw_Item_PostFrame")
  93.    
  94.     register_clcmd(spr_wpn, "hook_rb")
  95.    
  96.     cvar_damage_slash[0] = register_cvar("dps_slashdamage_4","486.0")
  97.     cvar_damage_slash[1] = register_cvar("dps_slashdamage_1","120.0")
  98.     cvar_damage_slash[2] = register_cvar("dps_slashdamage_2","140.0")
  99.     cvar_damage_slash[3] = register_cvar("dps_slashdamage_3","360.0")
  100.     cvar_slash_radius = register_cvar("dps_slashradius","120.0")
  101.     cvar_slash_range = register_cvar("dps_slashrange","95.0")
  102.    
  103.     cvar_damage_stab[0] = register_cvar("dps_stabdamage_2","1200.0")
  104.     cvar_damage_stab[1] = register_cvar("dps_stabdamage_1","350.0")
  105.     cvar_stab_radius = register_cvar("dps_stabradius","90.0")
  106.     cvar_stab_range = register_cvar("dps_stabrange","150.0")
  107.    
  108.     cvar_damage_special = register_cvar("dps_specialdamage","95.0")
  109.     cvar_special_range = register_cvar("dps_specialrange","120.0")
  110.    
  111.     cvar_knockback[0] = register_cvar("dps_slashknockback","0.0")
  112.     cvar_knockback[1] = register_cvar("dps_stabknockback","0.0")
  113.     cvar_knockback[2] = register_cvar("dps_specialknockback","0.0")
  114.    
  115.     cvar_fast_attack = register_cvar("dps_fast_attack_enabled", "0")
  116.     cvar_remove = register_cvar("dps_remove_onnewround", "0")
  117.     cvar_spr = register_cvar("dps_enable_sprites", "1")
  118.    
  119.     g_dps = ze_register_item("Dual Sword Phantom Slayer \r(VIP)", 50, 0)
  120. }
  121.  
  122. public plugin_precache()
  123. {
  124.     precache_model(v_model)
  125.     precache_model(p_model)
  126.     precache_model(p_model2)
  127.    
  128.     for(new i = 0; i < sizeof(weapon_sound); i++)
  129.         precache_sound(weapon_sound[i])
  130.    
  131.     precache_model("models/dualswordfx.mdl")
  132.     precache_model("models/dualsword_skill.mdl")
  133.     precache_model("models/dualsword_skillfx1.mdl")
  134.     precache_model("models/dualsword_skillfx2.mdl")
  135.    
  136.     ef_sakura[0] = precache_model("sprites/leaf01_dualsword.spr")
  137.     ef_sakura[1] = precache_model("sprites/leaf02_dualsword.spr")
  138.     ef_sakura[2] = precache_model("sprites/petal01_dualsword.spr")
  139.     ef_sakura[3] = precache_model("sprites/petal02_dualsword.spr")
  140.    
  141.     new Txt[32]
  142.     format(Txt, 31, "sprites/%s.txt", spr_wpn)
  143.     engfunc(EngFunc_PrecacheGeneric, Txt)
  144. }
  145.  
  146. public ze_user_infected(id) remove_dps(id)
  147. public ze_user_humanized(id) remove_dps(id)
  148.  
  149. public hook_rb(id)
  150. {
  151.     engclient_cmd(id, weapon_dps)
  152.     return PLUGIN_HANDLED
  153. }
  154.  
  155. public get_dps(id)
  156. {
  157.     if (!is_user_alive(id))
  158.         return
  159.  
  160.     g_had_dps[id] = 1
  161.     g_mode[id] = 0
  162.     g_slashend[id] = 0
  163.     g_check[id] = 0
  164.     g_soundmode[id] = 0
  165.    
  166.     fm_give_item(id, weapon_dps)
  167.    
  168.     if (get_user_weapon(id) == CSW_DPS) Event_CurWeapon(id)
  169.     else engclient_cmd(id,weapon_dps)
  170. }
  171.  
  172. public client_connected(id) remove_dps(id)
  173. public client_disconnected(id) remove_dps(id)
  174.  
  175. public Event_NewRound()
  176. {
  177.     if(!get_pcvar_num(cvar_remove))
  178.         return
  179.    
  180.     for(new i = 0; i < get_maxplayers(); i++)
  181.         remove_dps(i)
  182. }
  183.  
  184. public remove_dps(id)
  185. {
  186.     g_had_dps[id] = 0
  187.     g_slashend[id] = 0
  188.     g_check[id] = 0
  189.    
  190.     static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)
  191.     if(!pev_valid(iEnt)) return
  192.    
  193.     set_pev(iEnt, pev_iuser1, 0)
  194.     set_pev(iEnt, pev_iuser2, 0)
  195.     set_pev(iEnt, pev_iuser3, 0)
  196.     set_pev(iEnt, pev_iuser4, 0)
  197.     set_pev(iEnt, pev_fuser1, 0.0)
  198. }
  199.  
  200. public ze_select_item_pre(id, itemid)
  201. {  
  202.     if (itemid != g_dps)
  203.         return ZE_ITEM_AVAILABLE
  204.            
  205.     if (ze_is_user_zombie(id))
  206.         return ZE_ITEM_DONT_SHOW
  207.  
  208.         if (!(ze_get_vip_flags(id) & VIP_A))
  209.         return ZE_ITEM_DONT_SHOW
  210.        
  211.     return ZE_ITEM_AVAILABLE
  212. }
  213.  
  214. public ze_select_item_post(id, itemid)
  215. {
  216.     if (itemid != g_dps)
  217.         return
  218.    
  219.     get_dps(id)
  220. }
  221.  
  222. public Event_CurWeapon(id)
  223. {
  224.     if(!is_user_alive(id))
  225.         return 1
  226.     if(get_user_weapon(id) != CSW_DPS)
  227.         return 1
  228.     if(!g_had_dps[id])
  229.         return 1
  230.     if(ze_is_user_zombie(id))
  231.         return 1
  232.        
  233.     set_pev(id, pev_viewmodel2, v_model)
  234.     set_pev(id, pev_weaponmodel2, g_mode[id] ? p_model2:p_model)
  235.    
  236.     Set_WeaponAnim(id, g_mode[id]?ANIM_DRAWA:ANIM_DRAWB)
  237.    
  238.     static iEnt; iEnt = fm_get_user_weapon_entity(id, CSW_DPS)
  239.     if(!pev_valid(iEnt)) return 1
  240.    
  241.     set_pev(iEnt, pev_iuser1, 0)
  242.     set_pev(iEnt, pev_iuser2, 0)
  243.     set_pev(iEnt, pev_iuser3, 0)
  244.     set_pev(iEnt, pev_iuser4, 0)
  245.     set_pev(iEnt, pev_fuser1, 0.0)
  246.        
  247.     g_slashend[id] = 0
  248.     g_check[id] = 0
  249.    
  250.     set_pdata_float(id, 83, 0.23)
  251.     set_pdata_float(iEnt, 46, 0.25, 4);
  252.     set_pdata_float(iEnt, 47, 0.25, 4);
  253.     set_pdata_float(iEnt, 48, 0.25, 4);
  254.    
  255.     if(get_pcvar_num(cvar_spr))
  256.     {
  257.         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("WeaponList"), _, id)
  258.         write_string(g_had_dps[id] == 1 ? spr_wpn : weapon_dps)
  259.         write_byte(-1)
  260.         write_byte(-1)
  261.         write_byte(-1)
  262.         write_byte(-1)
  263.         write_byte(2)
  264.         write_byte(1)
  265.         write_byte(CSW_DPS)
  266.         write_byte(0)
  267.         message_end()
  268.     }
  269.    
  270.     return 0
  271. }
  272.  
  273. public message_DeathMsg(msg_id, msg_dest, msg_ent)
  274. {
  275.     new szWeapon[64]
  276.     get_msg_arg_string(4, szWeapon, charsmax(szWeapon))
  277.    
  278.     if (strcmp(szWeapon, "knife"))
  279.         return PLUGIN_CONTINUE
  280.  
  281.     new iEntity = get_pdata_cbase(get_msg_arg_int(1), 373)
  282.     if (!pev_valid(iEntity) || get_pdata_int(iEntity, 43, 4) != CSW_DPS || !g_had_dps[get_msg_arg_int(1)])
  283.         return PLUGIN_CONTINUE
  284.  
  285.     set_msg_arg_string(4, "dualsword")
  286.     return PLUGIN_CONTINUE
  287. }
  288.  
  289. public Fw_AddToFullPack_Post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
  290. {
  291.     if (!pev_valid(iEnt))
  292.         return;
  293.     if (pev(iEnt, pev_flags) & FL_KILLME)
  294.         return;
  295.  
  296.     new classname[32];
  297.     pev(iEnt, pev_classname, classname, 31);
  298.  
  299.     if (equal(classname,"dps_entytyd") && pev(iEnt, pev_iuser4))
  300.     {
  301.         if (iHost != pev(iEnt, pev_owner))
  302.             set_es(esState, ES_Effects, (get_es(esState, ES_Effects) | EF_NODRAW));
  303.     }
  304. }
  305.  
  306. public Fw_DPSEnt_Think(iEnt)
  307. {
  308.     if(!pev_valid(iEnt))
  309.         return
  310.    
  311.     new iOwner
  312.     iOwner = pev(iEnt, pev_owner)
  313.    
  314.     if(!is_user_alive(iOwner) || !is_user_connected(iOwner) || ze_is_user_zombie(iOwner))
  315.     {
  316.         remove_entity(iEnt)
  317.         g_soundmode[iOwner] = 0
  318.         return
  319.     }
  320.    
  321.     if(!Get_Entity_Mode(iEnt))
  322.     {
  323.         new iWpn,iState,Float:vecOrigin[3], Float:vecAngle[3];
  324.         iWpn = pev(iEnt, pev_iuser1)
  325.         iState = pev(iWpn, pev_iuser4)
  326.         Stock_Get_Postion(iOwner, 0.0, 0.0, 0.0, vecOrigin);
  327.        
  328.         pev(iOwner, pev_v_angle, vecAngle);
  329.         vecAngle[0] = -vecAngle[0];
  330.        
  331.         set_pev(iEnt, pev_origin, vecOrigin);
  332.         set_pev(iEnt, pev_angles, vecAngle);
  333.        
  334.         if(!iState || get_user_weapon(iOwner) != CSW_DPS)
  335.         {
  336.             new Float:fRenderAmount;
  337.             pev(iEnt, pev_renderamt, fRenderAmount);
  338.  
  339.             fRenderAmount -= 4.5;
  340.  
  341.             if (fRenderAmount <= 5.0)
  342.             {
  343.                 remove_entity(iEnt);
  344.                 return;
  345.             }
  346.             set_pev(iEnt, pev_renderamt, fRenderAmount);
  347.         }
  348.     }
  349.    
  350.     if(Get_Entity_Mode(iEnt) == 1)
  351.     {
  352.         set_pev(iEnt, pev_movetype, MOVETYPE_FLY)
  353.    
  354.         static Float:Origin[3]; pev(iOwner, pev_origin, Origin)
  355.         Origin[2] -= 25.0
  356.        
  357.         Stock_Hook_Ent(iEnt, Origin, 0.01)
  358.        
  359.         if(pev(iEnt, pev_fuser1) < get_gametime() || !IsAlive(iOwner))
  360.         {
  361.             set_pev(iEnt, pev_flags, pev(iEnt, pev_flags) | FL_KILLME)
  362.             return
  363.         }
  364.            
  365.         set_pev(iEnt, pev_velocity, Float:{1.0,1.0,1.0});
  366.         set_pev(iEnt, pev_origin, Origin);
  367.     }
  368.    
  369.     if(Get_Entity_Mode(iEnt) == 2)
  370.     {
  371.         new Float:vecOrigin[3]
  372.         GetGunPosition(iOwner, vecOrigin);
  373.        
  374.         new Float:fOldOrigin[3];
  375.         pev(iEnt, pev_oldorigin, fOldOrigin);
  376.        
  377.         new Float:vecNewOrigin[3];
  378.         pev(iEnt, pev_origin, vecNewOrigin);
  379.        
  380.         new Float:vecfff[3];
  381.         xs_vec_sub(vecOrigin, fOldOrigin, vecfff);
  382.         xs_vec_add(vecNewOrigin, vecfff, vecNewOrigin);
  383.        
  384.         set_pev(iEnt, pev_origin, vecNewOrigin);
  385.         set_pev(iEnt, pev_oldorigin, vecOrigin);
  386.        
  387.         if (pev(iEnt, pev_iuser1) == 2)
  388.         {
  389.             new Float:fDist = get_distance_f(vecOrigin, vecNewOrigin);
  390.             if (fDist > 175.0 * 0.5)
  391.             {
  392.                 remove_entity(iEnt);
  393.                 return;
  394.             }
  395.         }
  396.        
  397.         if(g_Sound[iOwner] < get_gametime())
  398.         {
  399.             if(!g_soundmode[iOwner]) emit_sound(iOwner, CHAN_ITEM, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  400.             if(g_soundmode[iOwner] == 1) emit_sound(iOwner, CHAN_BODY, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  401.             if(g_soundmode[iOwner] == 2) emit_sound(iOwner, CHAN_VOICE, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  402.             if(g_soundmode[iOwner] == 3) emit_sound(iOwner, CHAN_WEAPON, weapon_sound[random_num(15,19)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  403.            
  404.             g_soundmode[iOwner]++
  405.             if(g_soundmode[iOwner] > 3) g_soundmode[iOwner] = 0
  406.            
  407.             g_Sound[iOwner] = get_gametime()+0.088;
  408.         }
  409.     }
  410.     set_pev(iEnt, pev_nextthink, get_gametime() + 0.01)
  411.    
  412.     if(Get_Entity_Mode(iEnt) == 2)
  413.     {
  414.         new Float:fTimeLast;
  415.         pev(iEnt, pev_fuser1, fTimeLast);
  416.        
  417.         if (fTimeLast < get_gametime() || pev(pev(iEnt, pev_iuser2), pev_fuser1) < get_gametime())
  418.         {
  419.             if (pev(iEnt, pev_iuser1) == 1)
  420.             {
  421.                 new Float:fRenderAmount;
  422.                 pev(iEnt, pev_renderamt, fRenderAmount);
  423.                 fRenderAmount -= 7.5;
  424.                
  425.                 if (fRenderAmount <= 5.0)
  426.                 {
  427.                     remove_entity(iEnt);
  428.                     return;
  429.                 }
  430.                 set_pev(iEnt, pev_renderamt, fRenderAmount);
  431.             } else remove_entity(iEnt);
  432.            
  433.             g_soundmode[iOwner] = 0
  434.         }
  435.     }
  436. }
  437.  
  438. public fw_Item_PostFrame(ent)
  439. {
  440.     new id = pev(ent, pev_owner)
  441.    
  442.     if(!is_user_connected(id))
  443.         return HAM_IGNORED
  444.     if(get_user_weapon(id) != CSW_DPS || !g_had_dps[id])
  445.         return HAM_IGNORED
  446.  
  447.     if(get_pdata_float(ent, 48, 4) <= 0.01 && (!pev(ent, pev_iuser2) || !g_slashend[id]))
  448.     {
  449.         if(g_check[id] < 6) g_check[id] = 0
  450.         set_pev(ent, pev_iuser3, 0)
  451.         Set_WeaponAnim(id, g_mode[id]?ANIM_IDLEA:ANIM_IDLEB)
  452.         set_pdata_float(ent, 48, 4.03, 4)
  453.     }
  454.    
  455.     new iButton = pev(id,pev_button)
  456.     return AurezBotac(id, ent, iButton)
  457. }
  458.  
  459. public AurezBotac(id, iEnt, iButton)
  460. {
  461.     new iState = pev(iEnt, pev_iuser3)
  462.     new iState2 = pev(iEnt, pev_iuser2)
  463.     new iSlash = pev(iEnt, pev_iuser4)
  464.     new Float:fSound; pev(iEnt, pev_fuser1, fSound)
  465.     new Float:fRange = get_pcvar_float(g_mode[id] ? cvar_slash_range : cvar_stab_range)
  466.    
  467.     if(!(iButton & IN_ATTACK) && get_pdata_float(iEnt, 46,4) <= 0.0 && iState2)
  468.     {
  469.         if(!iState || iState == 1)
  470.         {
  471.             Set_WeaponAnim(id, ANIM_STABEND)
  472.             set_pev(iEnt, pev_iuser2, 0)
  473.             set_pdata_float(iEnt, 48, 1.45,4)
  474.         }
  475.     }
  476.    
  477.     if(!(iButton & IN_ATTACK2) && get_pdata_float(iEnt, 47,4) <= 0.0 && g_slashend[id])
  478.     {
  479.         Set_WeaponAnim(id, ANIM_SLASHEND)
  480.         set_pdata_float(iEnt, 48, 2.03,4)
  481.         g_slashend[id] = 0
  482.     }
  483.    
  484.     if (get_pdata_float(id, 83) <= 0.0 && pev(iEnt, pev_iuser1))
  485.     {
  486.         new Float:fAngle = get_pcvar_float(g_mode[id] ? cvar_slash_radius : cvar_stab_radius)
  487.         new Float:fDamage = get_pcvar_float(g_mode[id] ? cvar_damage_slash[iSlash] : cvar_damage_stab[iState])
  488.        
  489.         new iHitResult = KnifeAttack_Global(id, true, fRange, fAngle, fDamage, get_pcvar_float(cvar_knockback[1+g_mode[id]]))
  490.         switch (iHitResult)
  491.         {
  492.             case RESULT_HIT_PLAYER : client_cmd(id, "spk %s", weapon_sound[g_mode[id]?random_num(9,11):iState+2])
  493.             case RESULT_HIT_WORLD : client_cmd(id, "spk %s", weapon_sound[4])
  494.         }
  495.         set_pev(iEnt, pev_iuser1, 0);
  496.     }
  497.    
  498.     if(get_pdata_float(iEnt, 47,4) <= 0.0 && iSlash && iSlash <= 4)
  499.     {
  500.         set_pev(iEnt, pev_iuser4, 1 + iSlash)
  501.         Set_WeaponAnim(id, 1 + iSlash)
  502.        
  503.         set_pdata_float(id, 83, 0.06)
  504.        
  505.         if(!get_pcvar_num(cvar_fast_attack))
  506.             set_pdata_float(iEnt, 46, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);
  507.        
  508.         set_pdata_float(iEnt, 47, iSlash == 3 ? (g_check[id] == 5 ? 0.43 : 0.7) : 0.13,4);
  509.         set_pdata_float(iEnt, 48, iSlash == 3 ? 1.4 : 1.0,4);
  510.          
  511.         set_pev(iEnt, pev_iuser1, 1)
  512.         set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  513.         SendSound(id, CHAN_WEAPON, weapon_sound[5 + iSlash])
  514.         Create_Slash(id,iEnt,iSlash)
  515.        
  516.         if(iSlash == 3)
  517.         {
  518.             g_slashend[id] = 1
  519.            
  520.             set_pev(iEnt, pev_fuser1, get_gametime() + (g_check[id] == 5 ? 0.43 : 0.5))
  521.             set_pev(iEnt, pev_iuser4, 0)
  522.         }
  523.     }
  524.    
  525.     if(fSound && fSound < get_gametime())
  526.     {
  527.         SendSound(id,CHAN_VOICE,weapon_sound[g_check[id] == 5 ? 13 : 12])
  528.         set_pev(iEnt, pev_fuser1, 0.0)
  529.        
  530.         if(g_check[id] == 5)
  531.         {
  532.             Set_WeaponAnim(id, 14)
  533.             SendSound(id,CHAN_ITEM,weapon_sound[20])
  534.             g_check[id] = 6
  535.            
  536.             set_pdata_float(iEnt, 46, 1.03,4)
  537.             set_pdata_float(iEnt, 47, 1.03,4)
  538.             set_pdata_float(iEnt, 48, 1.03,4)
  539.            
  540.             set_pev(iEnt, pev_fuser4, get_gametime()+1.7);
  541.             DPS_Special(id, 0, 2.0)
  542.         }
  543.     }
  544.    
  545.     if(g_check[id] == 6 && get_pdata_float(iEnt, 46,4) <= 0.0)
  546.     {
  547.         set_pdata_float(iEnt, 46, 11.36,4)
  548.         set_pdata_float(iEnt, 47, 11.36,4)
  549.         set_pdata_float(iEnt, 48, 11.36,4)
  550.        
  551.         g_check[id] = 7
  552.         set_pev(iEnt, pev_fuser1, get_gametime() + 10.6)
  553.         Set_WeaponAnim(id, 15)
  554.     }
  555.    
  556.     // NANI?!
  557.     if(g_check[id] == 7 && fSound && fSound < get_gametime())
  558.     {
  559.         SendSound(id,CHAN_VOICE,weapon_sound[14])
  560.         set_pev(iEnt, pev_fuser1, 0.0)
  561.         g_check[id] = 0
  562.        
  563.         DPS_Special(id, 1, 1.46)
  564.     }
  565.    
  566.     DPS_RealSpecial(id, iEnt, fRange)
  567.    
  568.     if(iButton & IN_ATTACK && get_pdata_float(iEnt, 46,4) <= 0.0)
  569.     {
  570.         g_mode[id] = 0
  571.         g_slashend[id] = 0
  572.        
  573.         set_pev(iEnt, pev_iuser2, 1)
  574.         set_pev(iEnt, pev_iuser4, 0)
  575.        
  576.         switch(iState)
  577.         {
  578.             case 0:
  579.             {
  580.                 set_pdata_float(id, 83, 0.16)
  581.                 set_pdata_float(iEnt, 46, 0.4,4);
  582.                
  583.                 if(!get_pcvar_num(cvar_fast_attack))
  584.                     set_pdata_float(iEnt, 47, 0.4,4);
  585.                    
  586.                 set_pdata_float(iEnt, 48, 1.0,4);
  587.                
  588.                 set_pev(iEnt, pev_iuser1, 1)
  589.                 set_pev(iEnt, pev_iuser3, 1)
  590.                 set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  591.                
  592.                 Set_WeaponAnim(id, ANIM_STAB1)
  593.                 SendSound(id, CHAN_WEAPON, weapon_sound[0])
  594.                
  595.                 if(!g_check[id]) g_check[id] = 1
  596.                 else if(g_check[id] == 2) g_check[id] = 3
  597.                 else g_check[id] = 0
  598.             }
  599.             case 1:
  600.             {
  601.                 set_pdata_float(id, 83, 0.16)
  602.                 set_pdata_float(iEnt, 46, 0.83,4);
  603.                
  604.                 if(!get_pcvar_num(cvar_fast_attack))
  605.                     set_pdata_float(iEnt, 47, 0.83,4);
  606.                
  607.                 set_pdata_float(iEnt, 48, 1.5,4);
  608.                
  609.                 set_pev(iEnt, pev_iuser1, 1)
  610.                 set_pev(iEnt, pev_iuser3, 0)
  611.                 set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  612.                
  613.                 Set_WeaponAnim(id, ANIM_STAB2)
  614.                 SendSound(id, CHAN_WEAPON, weapon_sound[1])
  615.                
  616.                 if(g_check[id] == 3) g_check[id] = 4
  617.                 else g_check[id] = 0
  618.             }
  619.         }
  620.     }
  621.    
  622.     if(iButton & IN_ATTACK2 && get_pdata_float(iEnt, 47) <= 0.0 && !iSlash)
  623.     {
  624.         g_mode[id] = 1
  625.        
  626.         set_pdata_float(id, 83, 0.04)
  627.        
  628.         if(!get_pcvar_num(cvar_fast_attack))
  629.             set_pdata_float(iEnt, 46, 0.13,4);
  630.        
  631.         set_pdata_float(iEnt, 47, 0.13,4);
  632.         set_pdata_float(iEnt, 48, 0.5,4);
  633.        
  634.         set_pev(iEnt, pev_iuser1, 1)
  635.         set_pev(iEnt, pev_iuser2, 0)
  636.         set_pev(iEnt, pev_iuser3, 0)
  637.         set_pev(iEnt, pev_iuser4, 1)
  638.         set_pev(iEnt, pev_fuser4, get_gametime() + get_pdata_float(id, 83))
  639.        
  640.         Set_WeaponAnim(id, ANIM_SLASH1)
  641.         SendSound(id, CHAN_WEAPON, weapon_sound[5])
  642.        
  643.         Create_Slash(id,iEnt,0)
  644.        
  645.         if(g_check[id] == 1) g_check[id] = 2
  646.         else if(g_check[id] == 4) g_check[id] = 5
  647.         else g_check[id] = 0
  648.     }
  649.    
  650.     iButton &= ~IN_ATTACK;
  651.     iButton &= ~IN_ATTACK2;
  652.     set_pev(id, pev_button, iButton);
  653.     return HAM_IGNORED
  654. }
  655.  
  656. stock Create_Slash(id,iEnt,seq)
  657. {
  658.     new Float:vecOrigin[3], Float:vecAngle[3];
  659.     GetGunPosition(id, vecOrigin);
  660.     pev(id, pev_v_angle, vecAngle);
  661.     vecAngle[0] = -vecAngle[0];
  662.    
  663.     new pEntity = DPS_Entites(id,"models/dualswordfx.mdl",vecOrigin,vecOrigin,0.01,SOLID_NOT,seq)
  664.        
  665.     // Set info for ent
  666.     Set_Entity_Mode(pEntity, 0)
  667.     set_pev(pEntity, pev_scale, 0.1);
  668.     set_pev(pEntity, pev_iuser1, iEnt);
  669.     set_pev(pEntity, pev_velocity, Float:{0.01,0.01,0.01});
  670.     set_pev(pEntity, pev_angles, vecAngle);
  671.     set_pev(pEntity, pev_nextthink, get_gametime()+0.01);
  672. }
  673.  
  674. stock DPS_Special(id, seq, Float:fTime)
  675. {
  676.     new Float:VecOrig[3], Float:VecAng[3]
  677.     pev(id, pev_origin, VecOrig)
  678.     pev(id, pev_angles, VecAng)
  679.    
  680.     new iEfx = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
  681.     set_pev(iEfx, pev_classname, "dps_entytyd");
  682.     set_pev(iEfx, pev_origin, VecOrig)
  683.     set_pev(iEfx, pev_frame, 0.0)
  684.     set_pev(iEfx, pev_animtime, get_gametime())
  685.     set_pev(iEfx, pev_framerate, 1.0)
  686.     set_pev(iEfx, pev_sequence, seq)
  687.     engfunc(EngFunc_SetModel, iEfx, "models/dualsword_skill.mdl")
  688.     dllfunc(DLLFunc_Spawn, iEfx)
  689.     Set_Entity_Mode(iEfx, 1)
  690.     set_pev(iEfx, pev_angles, VecAng)
  691.     set_pev(iEfx, pev_solid, SOLID_NOT)
  692.     set_pev(iEfx, pev_owner, id)
  693.     set_pev(iEfx, pev_velocity, Float:{0.01,0.01,0.01});
  694.     set_pev(iEfx, pev_fuser1, get_gametime() + fTime)
  695.     set_pev(iEfx, pev_nextthink, get_gametime() + 0.01)
  696. }
  697.  
  698. stock DPS_RealSpecial(id, iEnt, Float:fRange)
  699. {
  700.     new Float:fTimeEffect;
  701.     pev(iEnt, pev_fuser4, fTimeEffect);
  702.    
  703.     if (g_check[id] == 7 && fTimeEffect && fTimeEffect <= get_gametime())
  704.     {
  705.         KnifeAttack_Global(id, false, get_pcvar_float(cvar_special_range)*2.0, 180.0, get_pcvar_float(cvar_damage_special), get_pcvar_float(cvar_knockback[2]))
  706.            
  707.         new Float:vecOrigin3[2][3], Float:vecOrigin[3];
  708.         pev(id, pev_origin, vecOrigin3[0]);
  709.         pev(id, pev_origin, vecOrigin);
  710.         xs_vec_copy(vecOrigin3[0], vecOrigin3[1]);
  711.        
  712.         new Float:fFloat = random_float(fRange * -0.85, fRange * 0.85);
  713.         vecOrigin3[0][2] = vecOrigin3[1][2] = vecOrigin3[0][2] + random_float(-5.0, 65.0);
  714.        
  715.         switch (random(3))
  716.         {
  717.             case 0:
  718.             {
  719.                 vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);
  720.                 vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);
  721.                
  722.                 vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);
  723.                 vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);
  724.             }
  725.             case 1:
  726.             {
  727.                 vecOrigin3[0][0] += fFloat*random_float(-1.0, 1.0);
  728.                 vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);
  729.                
  730.                 vecOrigin3[1][0] -= fFloat*random_float(-1.0, 1.0);
  731.                 vecOrigin3[1][1] += fFloat*random_float(-1.0, 1.0);
  732.             }
  733.             case 2:
  734.             {
  735.                 vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);
  736.                 vecOrigin3[0][1] += fFloat*random_float(-1.0, 1.0);
  737.                
  738.                 vecOrigin3[1][0] += fFloat*random_float(-1.0, 1.0);
  739.                 vecOrigin3[1][1] -= fFloat*random_float(-1.0, 1.0);
  740.             }
  741.             case 3:
  742.             {
  743.                 vecOrigin3[0][0] -= fFloat*random_float(-1.0, 1.0);
  744.                 vecOrigin3[0][1] -= fFloat*random_float(-1.0, 1.0);
  745.                
  746.                 vecOrigin3[