Resolved Skin Menu with VIP

Coding Help/Re-API Supported
User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 3 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

Re: Skin Menu with VIP

#31

Post by Mark » 3 Months Ago

if you want to join my server you can 192.223.26.205:27050 pass is getsome

If i switch to nade speed is set to 400 then if i switch back to knife its set to 270 then if i switch to pistol its 400 again its strange lol

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#32

Post by Raheem » 3 Months Ago

Delay needed:

  1. #include <zombie_escape>
  2. #include <engine>
  3. #include <fun>
  4. #include <ze_vip>
  5.  
  6. // Models
  7. new const Compat_Models[][] =
  8. {
  9.     "models/zombie_escape/v_combat_knife.mdl",
  10.     "models/zombie_escape/p_combat_knife.mdl"
  11. }
  12.  
  13. new const Strong_Models[][] =
  14. {
  15.     "models/zombie_escape/v_strong_knife.mdl",
  16.     "models/zombie_escape/p_strong_knife.mdl"
  17. }
  18.  
  19. new const Katana_Models[][] =
  20. {
  21.     "models/zombie_escape/v_katana_knife.mdl",
  22.     "models/zombie_escape/p_katana_knife.mdl"
  23. }
  24.  
  25. new const Hammer_Models[][] =
  26. {
  27.     "models/zombie_escape/v_hammer_knife.mdl",
  28.     "models/zombie_escape/p_hammer_knife.mdl"
  29. }
  30.  
  31. new const Turbulent9_Models[][] =
  32. {
  33.     "models/zombie_escape/v_turbulent9_knife.mdl",
  34.     "models/zombie_escape/p_turbulent9_knife.mdl"
  35. }
  36.  
  37. new const Bio_Models[][] =
  38. {
  39.     "models/zombie_escape/v_bio_knife.mdl",
  40.     "models/zombie_escape/p_bio_knife.mdl"
  41. }
  42.  
  43. new const Sabers_Models[][] =
  44. {
  45.     "models/zombie_escape/v_laser_knife.mdl",
  46.     "models/zombie_escape/p_laser_knife.mdl"
  47. }
  48.  
  49. new const Plasma_Models[][] =
  50. {
  51.     "models/zombie_escape/v_plasma_knife.mdl",
  52.     "models/zombie_escape/p_plasma_knife.mdl"
  53. }
  54.  
  55. new const Storm_Models[][] =
  56. {
  57.     "models/zombie_escape/v_storm_sword_knife.mdl",
  58.     "models/zombie_escape/p_storm_sword_knife.mdl"
  59. }
  60.  
  61. new const Laevateinn_Models[][] =
  62. {
  63.     "models/zombie_escape/v_laevateinn_knife.mdl",
  64.     "models/zombie_escape/p_laevateinn_knife.mdl"
  65. }
  66.  
  67. new const WarHammer_Dark_Knight_Models[][] =
  68. {
  69.     "models/zombie_escape/v_WarHammer_dark_knight_knife.mdl",
  70.     "models/zombie_escape/p_WarHammer_dark_knight_knife.mdl"
  71. }
  72.  
  73. new const Balrog_Kosa_Models[][] =
  74. {
  75.     "models/zombie_escape/v_balrog_kosa_knife.mdl",
  76.     "models/zombie_escape/p_balrog_kosa_knife.mdl"
  77. }
  78.  
  79. // Sounds
  80. new const g_sound_knife[] = "items/gunpickup2.wav"
  81.  
  82. new const combat_sounds[][] =
  83. {
  84.     "zombie_escape/knife_menu/combat_deploy.wav",
  85.     "zombie_escape/knife_menu/combat_hit.wav",
  86.     "zombie_escape/knife_menu/combat_hit.wav",
  87.     "zombie_escape/knife_menu/combat_hit.wav",
  88.     "zombie_escape/knife_menu/combat_hit.wav",
  89.     "zombie_escape/knife_menu/combat_hitwall.wav",
  90.     "zombie_escape/knife_menu/combat_slash.wav",
  91.     "zombie_escape/knife_menu/combat_slash.wav",
  92.     "zombie_escape/knife_menu/combat_stab.wav"
  93. }
  94.  
  95. new const strong_sounds[][] =
  96. {
  97.     "zombie_escape/knife_menu/strong_deploy.wav",
  98.     "zombie_escape/knife_menu/strong_hit.wav",
  99.     "zombie_escape/knife_menu/strong_hit.wav",
  100.     "zombie_escape/knife_menu/strong_hit.wav",
  101.     "zombie_escape/knife_menu/strong_hit.wav",
  102.     "zombie_escape/knife_menu/strong_hitwall.wav",
  103.     "zombie_escape/knife_menu/strong_slash.wav",
  104.     "zombie_escape/knife_menu/strong_slash.wav",
  105.     "zombie_escape/knife_menu/strong_stab.wav"
  106. }
  107.  
  108. new const katana_sounds[][] =
  109. {
  110.     "zombie_escape/knife_menu/katana_deploy.wav",
  111.     "zombie_escape/knife_menu/katana_hit.wav",
  112.     "zombie_escape/knife_menu/katana_hit.wav",
  113.     "zombie_escape/knife_menu/katana_hit.wav",
  114.     "zombie_escape/knife_menu/katana_hit.wav",
  115.     "zombie_escape/knife_menu/katana_hitwall.wav",
  116.     "zombie_escape/knife_menu/katana_slash.wav",
  117.     "zombie_escape/knife_menu/katana_slash.wav",
  118.     "zombie_escape/knife_menu/katana_stab.wav"
  119. }
  120.  
  121. new const hammer_sounds[][] =
  122. {
  123.     "zombie_escape/knife_menu/hammer_deploy.wav",
  124.     "zombie_escape/knife_menu/hammer_hit.wav",
  125.     "zombie_escape/knife_menu/hammer_hit.wav",
  126.     "zombie_escape/knife_menu/hammer_hit.wav",
  127.     "zombie_escape/knife_menu/hammer_hit.wav",
  128.     "zombie_escape/knife_menu/hammer_hitwall.wav",
  129.     "zombie_escape/knife_menu/hammer_slash.wav",
  130.     "zombie_escape/knife_menu/hammer_slash.wav",
  131.     "zombie_escape/knife_menu/hammer_stab.wav"
  132. }
  133.  
  134. new const turbulent9_sounds[][] =
  135. {
  136.     "zombie_escape/knife_menu/turbulent9_deploy.wav",
  137.     "zombie_escape/knife_menu/turbulent9_hit.wav",
  138.     "zombie_escape/knife_menu/turbulent9_hit.wav",
  139.     "zombie_escape/knife_menu/turbulent9_hit.wav",
  140.     "zombie_escape/knife_menu/turbulent9_hit.wav",
  141.     "zombie_escape/knife_menu/turbulent9_hitwall.wav",
  142.     "zombie_escape/knife_menu/turbulent9_slash.wav",
  143.     "zombie_escape/knife_menu/turbulent9_slash.wav",
  144.     "zombie_escape/knife_menu/turbulent9_stab.wav"
  145. }
  146.  
  147. new const bio_sounds[][] =
  148. {
  149.     "zombie_escape/knife_menu/bio_deploy.wav",
  150.     "zombie_escape/knife_menu/bio_hit.wav",
  151.     "zombie_escape/knife_menu/bio_hit.wav",
  152.     "zombie_escape/knife_menu/bio_hit.wav",
  153.     "zombie_escape/knife_menu/bio_hit.wav",
  154.     "zombie_escape/knife_menu/bio_hitwall.wav",
  155.     "zombie_escape/knife_menu/bio_slash.wav",
  156.     "zombie_escape/knife_menu/bio_slash.wav",
  157.     "zombie_escape/knife_menu/bio_stab.wav"
  158. }
  159.  
  160. new const sabers_sounds[][] =
  161. {
  162.     "zombie_escape/knife_menu/laser_deploy.wav",
  163.     "zombie_escape/knife_menu/laser_hit.wav",
  164.     "zombie_escape/knife_menu/laser_hit.wav",
  165.     "zombie_escape/knife_menu/laser_hit.wav",
  166.     "zombie_escape/knife_menu/laser_hit.wav",
  167.     "zombie_escape/knife_menu/laser_hitwall.wav",
  168.     "zombie_escape/knife_menu/laser_slash1.wav",
  169.     "zombie_escape/knife_menu/laser_slash2.wav",
  170.     "zombie_escape/knife_menu/laser_stab.wav"
  171. }
  172.  
  173. new const plasma_sounds[][] =
  174. {
  175.     "zombie_escape/knife_menu/plasma_deploy.wav",
  176.     "zombie_escape/knife_menu/plasma_hit.wav",
  177.     "zombie_escape/knife_menu/plasma_hit.wav",
  178.     "zombie_escape/knife_menu/plasma_hit.wav",
  179.     "zombie_escape/knife_menu/plasma_hit.wav",
  180.     "zombie_escape/knife_menu/plasma_hitwall.wav",
  181.     "zombie_escape/knife_menu/plasma_slash.wav",
  182.     "zombie_escape/knife_menu/plasma_slash.wav",
  183.     "zombie_escape/knife_menu/plasma_stab.wav"
  184. }
  185.  
  186. new const storm_sounds[][] =
  187. {
  188.     "zombie_escape/knife_menu/storm_sword_deploy.wav",
  189.     "zombie_escape/knife_menu/storm_sword_hit.wav",
  190.     "zombie_escape/knife_menu/storm_sword_hit.wav",
  191.     "zombie_escape/knife_menu/storm_sword_hit.wav",
  192.     "zombie_escape/knife_menu/storm_sword_hit.wav",
  193.     "zombie_escape/knife_menu/storm_sword_hitwall.wav",
  194.     "zombie_escape/knife_menu/storm_sword_slash.wav",
  195.     "zombie_escape/knife_menu/storm_sword_slash.wav",
  196.     "zombie_escape/knife_menu/storm_sword_stab.wav"
  197. }
  198.  
  199. new const laevateinn_sounds[][] =
  200. {
  201.     "zombie_escape/knife_menu/laevateinn_deploy.wav",
  202.     "zombie_escape/knife_menu/laevateinn_hit.wav",
  203.     "zombie_escape/knife_menu/laevateinn_hit.wav",
  204.     "zombie_escape/knife_menu/laevateinn_hit.wav",
  205.     "zombie_escape/knife_menu/laevateinn_hit.wav",
  206.     "zombie_escape/knife_menu/laevateinn_hitwall.wav",
  207.     "zombie_escape/knife_menu/laevateinn_slash.wav",
  208.     "zombie_escape/knife_menu/laevateinn_slash.wav",
  209.     "zombie_escape/knife_menu/laevateinn_stab.wav"
  210. }
  211.  
  212. new const warhammer_dark_knight_sounds[][] =
  213. {
  214.     "zombie_escape/knife_menu/WarHammer_dark_knight_deploy.wav",
  215.     "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
  216.     "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
  217.     "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
  218.     "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
  219.     "zombie_escape/knife_menu/WarHammer_dark_knight_hitwall.wav",
  220.     "zombie_escape/knife_menu/WarHammer_dark_knight_slash.wav",
  221.     "zombie_escape/knife_menu/WarHammer_dark_knight_slash.wav",
  222.     "zombie_escape/knife_menu/WarHammer_dark_knight_stab.wav"
  223. }
  224.  
  225. new const balrog_kosa_sounds[][] =
  226. {
  227.     "zombie_escape/knife_menu/balrog_kosa_deploy.wav",
  228.     "zombie_escape/knife_menu/balrog_kosa_hit.wav",
  229.     "zombie_escape/knife_menu/balrog_kosa_hit.wav",
  230.     "zombie_escape/knife_menu/balrog_kosa_hit.wav",
  231.     "zombie_escape/knife_menu/balrog_kosa_hit.wav",
  232.     "zombie_escape/knife_menu/balrog_kosa_hitwall.wav",
  233.     "zombie_escape/knife_menu/balrog_kosa_slash.wav",
  234.     "zombie_escape/knife_menu/balrog_kosa_slash.wav",
  235.     "zombie_escape/knife_menu/balrog_kosa_stab.wav"
  236. }
  237.  
  238. new const oldknife_sounds[][] =
  239. {
  240.     "weapons/knife_deploy1.wav",
  241.     "weapons/knife_hit1.wav",
  242.     "weapons/knife_hit2.wav",
  243.     "weapons/knife_hit3.wav",
  244.     "weapons/knife_hit4.wav",
  245.     "weapons/knife_hitwall1.wav",
  246.     "weapons/knife_slash1.wav",
  247.     "weapons/knife_slash2.wav",
  248.     "weapons/knife_stab.wav"
  249. }
  250.  
  251. new bool:g_bCompat[33], bool:g_bStrong[33], bool:g_bKatana[33], bool:g_bHammer[33], bool:g_bTurbulent9[33], bool:g_bBio[33], bool:g_bSabers[33], bool:g_bPlasma[33],
  252. bool:g_bStorm[33], bool:g_bLaevateinn[33], bool:g_bWarHammer_Dark_Knight[33], bool:g_bBalrog_Kosa[33], bool:g_bNoSpeed, g_iUsedTimes[33], g_pCvarUseTimes
  253.  
  254. new cvar_speed_compat
  255. new cvar_speed_strong
  256. new cvar_speed_katana
  257. new cvar_speed_hammer
  258. new cvar_speed_turb
  259. new cvar_speed_bio
  260. new cvar_speed_sabers
  261. new cvar_speed_plasma
  262. new cvar_speed_storm
  263. new cvar_speed_laevat
  264. new cvar_speed_darknight
  265. new cvar_speed_kosa
  266.  
  267. public plugin_precache()
  268. {
  269.     new i
  270.  
  271.     for (i = 0; i <= charsmax(Compat_Models); i++)
  272.         precache_model(Compat_Models[i])
  273.  
  274.     for (i = 0; i <= charsmax(Hammer_Models); i++)
  275.         precache_model(Hammer_Models[i])
  276.  
  277.     for (i = 0; i <= charsmax(Katana_Models); i++)
  278.         precache_model(Katana_Models[i])
  279.  
  280.     for (i = 0; i <= charsmax(Strong_Models); i++)
  281.         precache_model(Strong_Models[i])
  282.  
  283.     for (i = 0; i <= charsmax(Turbulent9_Models); i++)
  284.         precache_model(Turbulent9_Models[i])
  285.  
  286.     for (i = 0; i <= charsmax(Bio_Models); i++)
  287.         precache_model(Bio_Models[i])
  288.  
  289.     for (i = 0; i <= charsmax(Sabers_Models); i++)
  290.         precache_model(Sabers_Models[i])
  291.  
  292.     for (i = 0; i <= charsmax(Plasma_Models); i++)
  293.         precache_model(Plasma_Models[i])
  294.  
  295.     for (i = 0; i <= charsmax(Storm_Models); i++)
  296.         precache_model(Storm_Models[i])
  297.  
  298.     for (i = 0; i <= charsmax(Laevateinn_Models); i++)
  299.         precache_model(Laevateinn_Models[i])
  300.  
  301.     for (i = 0; i <= charsmax(WarHammer_Dark_Knight_Models); i++)
  302.         precache_model(WarHammer_Dark_Knight_Models[i])
  303.  
  304.     for (i = 0; i <= charsmax(Balrog_Kosa_Models); i++)
  305.         precache_model(Balrog_Kosa_Models[i])
  306.  
  307.     for (i = 0; i <= charsmax(combat_sounds); i++)
  308.         precache_sound(combat_sounds[i])
  309.  
  310.     for (i = 0; i <= charsmax(strong_sounds); i++)
  311.         precache_sound(strong_sounds[i])
  312.  
  313.     for (i = 0; i <= charsmax(katana_sounds); i++)
  314.         precache_sound(katana_sounds[i])
  315.  
  316.     for (i = 0; i <= charsmax(hammer_sounds); i++)
  317.         precache_sound(hammer_sounds[i])
  318.  
  319.     for (i = 0; i <= charsmax(turbulent9_sounds); i++)
  320.         precache_sound(turbulent9_sounds[i])
  321.  
  322.     for (i = 0; i <= charsmax(bio_sounds); i++)
  323.         precache_sound(bio_sounds[i])
  324.  
  325.     for (i = 0; i <= charsmax(sabers_sounds); i++)
  326.         precache_sound(sabers_sounds[i])
  327.  
  328.     for (i = 0; i <= charsmax(plasma_sounds); i++)
  329.         precache_sound(plasma_sounds[i])
  330.  
  331.     for (i = 0; i <= charsmax(storm_sounds); i++)
  332.         precache_sound(storm_sounds[i])
  333.  
  334.     for (i = 0; i <= charsmax(laevateinn_sounds); i++)
  335.         precache_sound(laevateinn_sounds[i])
  336.  
  337.     for (i = 0; i <= charsmax(warhammer_dark_knight_sounds); i++)
  338.         precache_sound(warhammer_dark_knight_sounds[i])
  339.  
  340.     for (i = 0; i <= charsmax(balrog_kosa_sounds); i++)
  341.         precache_sound(balrog_kosa_sounds[i])
  342.  
  343.     precache_sound(g_sound_knife)
  344. }
  345.  
  346. public plugin_natives()
  347. {
  348.     register_native("ze_open_knife_menu", "native_ze_open_knife_menu", 1)
  349. }
  350.  
  351. public plugin_init()
  352. {
  353.     register_plugin("[ZE] Addon: Knife Menu", "1.2", "Jack GamePlay")
  354.  
  355.     register_forward(FM_EmitSound, "fw_EmitSound")
  356.     register_forward(FM_PlayerPreThink, "fw_PlayerPreThink");
  357.  
  358.     register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
  359.     RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "Fw_RestMaxSpeed_Post", 1)
  360.    
  361.     g_pCvarUseTimes = register_cvar("ze_knife_menu_use_times", "1")
  362.  
  363.     register_message(get_user_msgid("DeathMsg"), "DeathMsg")
  364.  
  365.     register_clcmd("say /k", "Show_Knife_Menu")
  366.    
  367.     cvar_speed_compat = register_cvar("ze_compat_speed", "400.0")
  368.     cvar_speed_strong = register_cvar("ze_strong_speed", "270.0")
  369.     cvar_speed_katana = register_cvar("ze_katana_speed", "270.0")
  370.     cvar_speed_hammer = register_cvar("ze_hammer_speed", "270.0")
  371.     cvar_speed_turb = register_cvar("ze_turb_speed", "275.0")    
  372.     cvar_speed_bio = register_cvar("ze_bio_speed", "275.0")
  373.     cvar_speed_sabers = register_cvar("ze_sabers_speed", "275.0")
  374.     cvar_speed_plasma = register_cvar("ze_plasma_speed", "275.0")
  375.     cvar_speed_storm = register_cvar("ze_storm_speed", "280.0")    
  376.     cvar_speed_laevat = register_cvar("ze_laevat_speed", "280.0")  
  377.     cvar_speed_darknight = register_cvar("ze_darknight_speed", "280.0")
  378.     cvar_speed_kosa = register_cvar("ze_kosa_speed", "280.0")
  379. }
  380.  
  381. public ze_user_humanized(id)
  382. {
  383.     g_iUsedTimes[id] = 0
  384. }
  385.  
  386. public ze_user_infected(Victim)
  387. {
  388.     g_bCompat[Victim] = false
  389.     g_bStrong[Victim] = false
  390.     g_bKatana[Victim] = false
  391.     g_bHammer[Victim] = false
  392.     g_bTurbulent9[Victim] = false
  393.     g_bBio[Victim] = false
  394.     g_bSabers[Victim] = false
  395.     g_bPlasma[Victim] = false
  396.     g_bStorm[Victim] = false
  397.     g_bLaevateinn[Victim] = false
  398.     g_bWarHammer_Dark_Knight[Victim] = false
  399.     g_bBalrog_Kosa[Victim] = false
  400.     g_iUsedTimes[Victim] = 0
  401. }
  402.  
  403. public client_putinserver(id)
  404. {
  405.     g_bCompat[id] = false
  406.     g_bStrong[id] = false
  407.     g_bKatana[id] = false
  408.     g_bHammer[id] = false
  409.     g_bTurbulent9[id] = false
  410.     g_bBio[id] = false
  411.     g_bSabers[id] = false
  412.     g_bPlasma[id] = false
  413.     g_bStorm[id] = false
  414.     g_bLaevateinn[id] = false
  415.     g_bWarHammer_Dark_Knight[id] = false
  416.     g_bBalrog_Kosa[id] = false
  417.     g_iUsedTimes[id] = 0
  418. }
  419.  
  420. public client_disconnected(id)
  421. {
  422.     g_bCompat[id] = false
  423.     g_bStrong[id] = false
  424.     g_bKatana[id] = false
  425.     g_bHammer[id] = false
  426.     g_bTurbulent9[id] = false
  427.     g_bBio[id] = false
  428.     g_bSabers[id] = false
  429.     g_bPlasma[id] = false
  430.     g_bStorm[id] = false
  431.     g_bLaevateinn[id] = false
  432.     g_bWarHammer_Dark_Knight[id] = false
  433.     g_bBalrog_Kosa[id] = false
  434.     g_iUsedTimes[id] = 0
  435. }
  436.  
  437. public Show_Knife_Menu(id)
  438. {
  439.     if (!is_user_connected(id))
  440.         return PLUGIN_CONTINUE
  441.  
  442.     if (ze_is_user_zombie(id))
  443.     {
  444.         ze_colored_print(id, "!tZombies can't open knife menu!y.")
  445.         return PLUGIN_HANDLED
  446.     }
  447.  
  448.     if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
  449.     {
  450.         ze_colored_print(id, "!tYou can only open knife menu !y[!g%dx!y] per round!", get_pcvar_num(g_pCvarUseTimes))
  451.         return PLUGIN_HANDLED
  452.     }
  453.  
  454.     if (!is_user_alive(id))
  455.     {
  456.         ze_colored_print(id, "!tDead can't open knife menu!y.")
  457.         return PLUGIN_HANDLED
  458.     }
  459.  
  460.     Knife_Menu(id)
  461.     return PLUGIN_CONTINUE
  462. }
  463.  
  464. public Knife_Menu(id)
  465. {
  466.     new iMenu = menu_create("\rChoose Your Knife\w:", "Menu_Handler")
  467.     menu_additem(iMenu, "\yCombat", "", 0)
  468.     menu_additem(iMenu, "\yStrong", "", 0)
  469.     menu_additem(iMenu, "\yKatana", "", 0)
  470.     menu_additem(iMenu, "\yHammer", "", 0)
  471.  
  472.     if (ze_get_vip_flags(id) & VIP_A)
  473.     {
  474.         menu_additem(iMenu, "\yTurbulent9 \r[VIP]", "", 0)
  475.         menu_additem(iMenu, "\yBio Hazard \r[VIP]", "", 0)
  476.     }
  477.    
  478.     if (ze_get_vip_flags(id) & VIP_B)
  479.     {
  480.         menu_additem(iMenu, "\ySabers \r[VIP+]", "", 0)
  481.         menu_additem(iMenu, "\yPlasma \r[VIP+]", "", 0)
  482.     }
  483.  
  484.     if (ze_get_vip_flags(id) & VIP_C)
  485.     {
  486.         menu_additem(iMenu, "\yStorm \r[VIP++]", "", 0)
  487.         menu_additem(iMenu, "\yLaevateinn \r[VIP++]", "", 0)
  488.         menu_additem(iMenu, "\yWarHammer Dark Night \r[VIP++]", "", 0)
  489.         menu_additem(iMenu, "\yBalrog Kosa \r[VIP++]", "", 0)
  490.     }
  491.  
  492.     menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  493.     menu_display(id, iMenu, 0)
  494. }
  495.  
  496. public Menu_Handler(id, iMenu, iKey)
  497. {
  498.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  499.         return PLUGIN_HANDLED
  500.        
  501.     switch(iKey)
  502.     {
  503.         case 0: // Compat
  504.         {
  505.             g_bCompat[id] = true
  506.             g_bStrong[id] = false
  507.             g_bKatana[id] = false
  508.             g_bHammer[id] = false
  509.             g_bTurbulent9[id] = false
  510.             g_bBio[id] = false
  511.             g_bSabers[id] = false
  512.             g_bPlasma[id] = false
  513.             g_bStorm[id] = false
  514.             g_bLaevateinn[id] = false
  515.             g_bWarHammer_Dark_Knight[id] = false
  516.             g_bBalrog_Kosa[id] = false
  517.             g_iUsedTimes[id]++
  518.             /*rg_remove_item(id, "weapon_knife")
  519.             rg_give_item(id, "weapon_knife", GT_APPEND)
  520.             engclient_cmd(id, "weapon_knife")
  521.             g_iUsedTimes[id]++
  522.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  523.         }
  524.         case 1: // Strong
  525.         {
  526.             g_bCompat[id] = false
  527.             g_bStrong[id] = true
  528.             g_bKatana[id] = false
  529.             g_bHammer[id] = false
  530.             g_bTurbulent9[id] = false
  531.             g_bBio[id] = false
  532.             g_bSabers[id] = false
  533.             g_bPlasma[id] = false
  534.             g_bStorm[id] = false
  535.             g_bLaevateinn[id] = false
  536.             g_bWarHammer_Dark_Knight[id] = false
  537.             g_bBalrog_Kosa[id] = false
  538.             g_iUsedTimes[id]++
  539.             /*rg_remove_item(id, "weapon_knife")
  540.             rg_give_item(id, "weapon_knife", GT_APPEND)
  541.             engclient_cmd(id, "weapon_knife")
  542.             g_iUsedTimes[id]++
  543.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  544.         }
  545.         case 2: // Katana
  546.         {
  547.             g_bCompat[id] = false
  548.             g_bStrong[id] = false
  549.             g_bKatana[id] = true
  550.             g_bHammer[id] = false
  551.             g_bTurbulent9[id] = false
  552.             g_bBio[id] = false
  553.             g_bSabers[id] = false
  554.             g_bPlasma[id] = false
  555.             g_bStorm[id] = false
  556.             g_bLaevateinn[id] = false
  557.             g_bWarHammer_Dark_Knight[id] = false
  558.             g_bBalrog_Kosa[id] = false
  559.             g_iUsedTimes[id]++
  560.             /*rg_remove_item(id, "weapon_knife")
  561.             rg_give_item(id, "weapon_knife", GT_APPEND)
  562.             engclient_cmd(id, "weapon_knife")
  563.             g_iUsedTimes[id]++
  564.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  565.         }
  566.         case 3: // Hammer
  567.         {
  568.             g_bCompat[id] = false
  569.             g_bStrong[id] = false
  570.             g_bKatana[id] = false
  571.             g_bHammer[id] = true
  572.             g_bTurbulent9[id] = false
  573.             g_bBio[id] = false
  574.             g_bSabers[id] = false
  575.             g_bPlasma[id] = false
  576.             g_bStorm[id] = false
  577.             g_bLaevateinn[id] = false
  578.             g_bWarHammer_Dark_Knight[id] = false
  579.             g_bBalrog_Kosa[id] = false
  580.             g_iUsedTimes[id]++
  581.             /*rg_remove_item(id, "weapon_knife")
  582.             rg_give_item(id, "weapon_knife", GT_APPEND)
  583.             engclient_cmd(id, "weapon_knife")
  584.             g_iUsedTimes[id]++
  585.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  586.         }
  587.         case 4: // Turbulent
  588.         {
  589.             if (ze_get_vip_flags(id) & VIP_A)
  590.             {
  591.                 g_bCompat[id] = false
  592.                 g_bStrong[id] = false
  593.                 g_bKatana[id] = false
  594.                 g_bHammer[id] = false
  595.                 g_bTurbulent9[id] = true
  596.                 g_bBio[id] = false
  597.                 g_bSabers[id] = false
  598.                 g_bPlasma[id] = false
  599.                 g_bStorm[id] = false
  600.                 g_bLaevateinn[id] = false
  601.                 g_bWarHammer_Dark_Knight[id] = false
  602.                 g_bBalrog_Kosa[id] = false
  603.                 g_iUsedTimes[id]++
  604.                 /*rg_remove_item(id, "weapon_knife")
  605.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  606.                 engclient_cmd(id, "weapon_knife")
  607.                 g_iUsedTimes[id]++
  608.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  609.             }
  610.         }
  611.         case 5: // Bio
  612.         {
  613.             if (ze_get_vip_flags(id) & VIP_A)
  614.             {
  615.                 g_bCompat[id] = false
  616.                 g_bStrong[id] = false
  617.                 g_bKatana[id] = false
  618.                 g_bHammer[id] = false
  619.                 g_bTurbulent9[id] = false
  620.                 g_bBio[id] = true
  621.                 g_bSabers[id] = false
  622.                 g_bPlasma[id] = false
  623.                 g_bStorm[id] = false
  624.                 g_bLaevateinn[id] = false
  625.                 g_bWarHammer_Dark_Knight[id] = false
  626.                 g_bBalrog_Kosa[id] = false
  627.                 g_iUsedTimes[id]++
  628.                 /*rg_remove_item(id, "weapon_knife")
  629.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  630.                 engclient_cmd(id, "weapon_knife")
  631.                 g_iUsedTimes[id]++
  632.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  633.             }
  634.         }
  635.         case 6: // Sabers
  636.         {
  637.             if (ze_get_vip_flags(id) & VIP_B)
  638.             {
  639.                 g_bCompat[id] = false
  640.                 g_bStrong[id] = false
  641.                 g_bKatana[id] = false
  642.                 g_bHammer[id] = false
  643.                 g_bTurbulent9[id] = false
  644.                 g_bBio[id] = false
  645.                 g_bSabers[id] = true
  646.                 g_bPlasma[id] = false
  647.                 g_bStorm[id] = false
  648.                 g_bLaevateinn[id] = false
  649.                 g_bWarHammer_Dark_Knight[id] = false
  650.                 g_bBalrog_Kosa[id] = false
  651.                 g_iUsedTimes[id]++
  652.                 /*rg_remove_item(id, "weapon_knife")
  653.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  654.                 engclient_cmd(id, "weapon_knife")
  655.                 g_iUsedTimes[id]++
  656.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  657.             }
  658.         }
  659.         case 7: // Plasma
  660.         {
  661.             if (ze_get_vip_flags(id) & VIP_B)
  662.             {
  663.                 g_bCompat[id] = false
  664.                 g_bStrong[id] = false
  665.                 g_bKatana[id] = false
  666.                 g_bHammer[id] = false
  667.                 g_bTurbulent9[id] = false
  668.                 g_bBio[id] = false
  669.                 g_bSabers[id] = false
  670.                 g_bPlasma[id] = true
  671.                 g_bStorm[id] = false
  672.                 g_bLaevateinn[id] = false
  673.                 g_bWarHammer_Dark_Knight[id] = false
  674.                 g_bBalrog_Kosa[id] = false
  675.                 g_iUsedTimes[id]++
  676.                 /*rg_remove_item(id, "weapon_knife")
  677.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  678.                 engclient_cmd(id, "weapon_knife")
  679.                 g_iUsedTimes[id]++
  680.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  681.             }
  682.         }
  683.         case 8: // Storm
  684.         {
  685.             if (ze_get_vip_flags(id) & VIP_C)
  686.             {
  687.                 g_bCompat[id] = false
  688.                 g_bStrong[id] = false
  689.                 g_bKatana[id] = false
  690.                 g_bHammer[id] = false
  691.                 g_bTurbulent9[id] = false
  692.                 g_bBio[id] = false
  693.                 g_bSabers[id] = false
  694.                 g_bPlasma[id] = false
  695.                 g_bStorm[id] = true
  696.                 g_bLaevateinn[id] = false
  697.                 g_bWarHammer_Dark_Knight[id] = false
  698.                 g_bBalrog_Kosa[id] = false
  699.                 g_iUsedTimes[id]++
  700.                 /*rg_remove_item(id, "weapon_knife")
  701.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  702.                 engclient_cmd(id, "weapon_knife")
  703.                 g_iUsedTimes[id]++
  704.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  705.             }
  706.         }
  707.         case 9: // Laevateinn
  708.         {
  709.             if (ze_get_vip_flags(id) & VIP_C)
  710.             {
  711.                 g_bCompat[id] = false
  712.                 g_bStrong[id] = false
  713.                 g_bKatana[id] = false
  714.                 g_bHammer[id] = false
  715.                 g_bTurbulent9[id] = false
  716.                 g_bBio[id] = false
  717.                 g_bSabers[id] = false
  718.                 g_bPlasma[id] = false
  719.                 g_bStorm[id] = false
  720.                 g_bLaevateinn[id] = true
  721.                 g_bWarHammer_Dark_Knight[id] = false
  722.                 g_bBalrog_Kosa[id] = false
  723.                 g_iUsedTimes[id]++
  724.                 /*rg_remove_item(id, "weapon_knife")
  725.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  726.                 engclient_cmd(id, "weapon_knife")
  727.                 g_iUsedTimes[id]++
  728.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  729.             }
  730.         }
  731.         case 10: // Warhammer Dark Night
  732.         {
  733.             if (ze_get_vip_flags(id) & VIP_C)
  734.             {
  735.                 g_bCompat[id] = false
  736.                 g_bStrong[id] = false
  737.                 g_bKatana[id] = false
  738.                 g_bHammer[id] = false
  739.                 g_bTurbulent9[id] = false
  740.                 g_bBio[id] = false
  741.                 g_bSabers[id] = false
  742.                 g_bPlasma[id] = false
  743.                 g_bStorm[id] = false
  744.                 g_bLaevateinn[id] = false
  745.                 g_bWarHammer_Dark_Knight[id] = true
  746.                 g_bBalrog_Kosa[id] = false
  747.                 g_iUsedTimes[id]++
  748.                 /*rg_remove_item(id, "weapon_knife")
  749.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  750.                 engclient_cmd(id, "weapon_knife")
  751.                 g_iUsedTimes[id]++
  752.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  753.             }
  754.         }
  755.         case 11: // Balrog Kosa
  756.         {
  757.             if (ze_get_vip_flags(id) & VIP_C)
  758.             {
  759.                 g_bCompat[id] = false
  760.                 g_bStrong[id] = false
  761.                 g_bKatana[id] = false
  762.                 g_bHammer[id] = false
  763.                 g_bTurbulent9[id] = false
  764.                 g_bBio[id] = false
  765.                 g_bSabers[id] = false
  766.                 g_bPlasma[id] = false
  767.                 g_bStorm[id] = false
  768.                 g_bLaevateinn[id] = false
  769.                 g_bWarHammer_Dark_Knight[id] = false
  770.                 g_bBalrog_Kosa[id] = true
  771.                 g_iUsedTimes[id]++
  772.                 /*rg_remove_item(id, "weapon_knife")
  773.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  774.                 engclient_cmd(id, "weapon_knife")
  775.                 g_iUsedTimes[id]++
  776.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  777.             }
  778.         }
  779.     }
  780.  
  781.     rg_remove_item(id, "weapon_knife")
  782.     rg_give_item(id, "weapon_knife", GT_APPEND)
  783.     engclient_cmd(id, "weapon_knife")
  784.     emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  785.     menu_destroy(iMenu)
  786.     return PLUGIN_HANDLED
  787. }
  788.  
  789. public fw_EmitSound(id, channel, const sound[])
  790. {
  791.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  792.         return FMRES_IGNORED
  793.        
  794.     new i
  795.     for (i = 0; i <= charsmax(combat_sounds); i++)
  796.     for (i = 0; i <= charsmax(strong_sounds); i++)
  797.     for (i = 0; i <= charsmax(katana_sounds); i++)
  798.     for (i = 0; i <= charsmax(hammer_sounds); i++)
  799.     for (i = 0; i <= charsmax(turbulent9_sounds); i++)
  800.     for (i = 0; i <= charsmax(bio_sounds); i++)
  801.     for (i = 0; i <= charsmax(sabers_sounds); i++)
  802.     for (i = 0; i <= charsmax(plasma_sounds); i++)
  803.     for (i = 0; i <= charsmax(storm_sounds); i++)
  804.     for (i = 0; i <= charsmax(laevateinn_sounds); i++)
  805.     for (i = 0; i <= charsmax(warhammer_dark_knight_sounds); i++)
  806.     for (i = 0; i <= charsmax(balrog_kosa_sounds); i++)
  807.     {
  808.         if(equal(sound, oldknife_sounds[i]))
  809.         {
  810.             if (g_bCompat[id])
  811.             {
  812.                 emit_sound(id, channel, combat_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  813.                 return FMRES_SUPERCEDE
  814.             }
  815.             else if (g_bStrong[id])
  816.             {
  817.                 emit_sound(id, channel, strong_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  818.                 return FMRES_SUPERCEDE
  819.             }
  820.             else if (g_bKatana[id])
  821.             {
  822.                 emit_sound(id, channel, katana_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  823.                 return FMRES_SUPERCEDE
  824.             }
  825.             else if (g_bHammer[id])
  826.             {
  827.                 emit_sound(id, channel, hammer_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  828.                 return FMRES_SUPERCEDE
  829.             }
  830.             else if ((g_bTurbulent9[id]) && (ze_get_vip_flags(id) & VIP_A))
  831.             {
  832.                 emit_sound(id, channel, turbulent9_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  833.                 return FMRES_SUPERCEDE
  834.             }
  835.             else if ((g_bBio[id]) && (ze_get_vip_flags(id) & VIP_A))
  836.             {
  837.                 emit_sound(id, channel, bio_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  838.                 return FMRES_SUPERCEDE
  839.             }
  840.             else if ((g_bSabers[id]) && (ze_get_vip_flags(id) & VIP_B))
  841.             {
  842.                 emit_sound(id, channel, sabers_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  843.                 return FMRES_SUPERCEDE
  844.             }
  845.             else if ((g_bPlasma[id]) && (ze_get_vip_flags(id) & VIP_B))
  846.             {
  847.                 emit_sound(id, channel, plasma_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  848.                 return FMRES_SUPERCEDE
  849.             }
  850.             else if ((g_bStorm[id]) && (ze_get_vip_flags(id) & VIP_C))
  851.             {
  852.                 emit_sound(id, channel, storm_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  853.                 return FMRES_SUPERCEDE
  854.             }
  855.             else if ((g_bLaevateinn[id]) && (ze_get_vip_flags(id) & VIP_C))
  856.             {
  857.                 emit_sound(id, channel, laevateinn_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  858.                 return FMRES_SUPERCEDE
  859.             }
  860.             else if ((g_bWarHammer_Dark_Knight[id]) && (ze_get_vip_flags(id) & VIP_C))
  861.             {
  862.                 emit_sound(id, channel, warhammer_dark_knight_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  863.                 return FMRES_SUPERCEDE
  864.             }
  865.             else if ((g_bBalrog_Kosa[id]) && (ze_get_vip_flags(id) & VIP_C))
  866.             {
  867.                 emit_sound(id, channel, balrog_kosa_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  868.                 return FMRES_SUPERCEDE
  869.             }
  870.             else if (!g_bCompat[id] || !g_bStrong[id] || !g_bKatana[id] || !g_bHammer[id] || !g_bTurbulent9[id] || !g_bBio[id] || !g_bSabers[id] || !g_bPlasma[id] || !g_bStorm[id] || !g_bLaevateinn[id] || !g_bWarHammer_Dark_Knight[id] || !g_bBalrog_Kosa[id])
  871.             {
  872.                 emit_sound(id, channel, oldknife_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  873.                 return FMRES_SUPERCEDE
  874.             }
  875.         }
  876.     }
  877.     return FMRES_IGNORED
  878. }
  879.  
  880. public CurrentWeapon(id)
  881. {
  882.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  883.         return
  884.        
  885.     if(get_user_weapon(id) & CSW_KNIFE)
  886.     {
  887.         if(g_bCompat[id])
  888.         {
  889.             cs_set_player_view_model(id, CSW_KNIFE, Compat_Models[0])
  890.             cs_set_player_weap_model(id, CSW_KNIFE, Compat_Models[1])
  891.         }
  892.         else if(g_bStrong[id])
  893.         {
  894.             cs_set_player_view_model(id, CSW_KNIFE, Strong_Models[0])
  895.             cs_set_player_weap_model(id, CSW_KNIFE, Strong_Models[1])
  896.         }
  897.         else if(g_bKatana[id])
  898.         {
  899.             cs_set_player_view_model(id, CSW_KNIFE, Katana_Models[0])
  900.             cs_set_player_weap_model(id, CSW_KNIFE, Katana_Models[1])
  901.         }
  902.         else if(g_bHammer[id])
  903.         {
  904.             cs_set_player_view_model(id, CSW_KNIFE, Hammer_Models[0])
  905.             cs_set_player_weap_model(id, CSW_KNIFE, Hammer_Models[1])
  906.         }
  907.         else if((g_bTurbulent9[id]) && (ze_get_vip_flags(id) & VIP_A))
  908.         {
  909.             cs_set_player_view_model(id, CSW_KNIFE, Turbulent9_Models[0])
  910.             cs_set_player_weap_model(id, CSW_KNIFE, Turbulent9_Models[1])
  911.         }
  912.         else if((g_bBio[id]) && (ze_get_vip_flags(id) & VIP_A))
  913.         {
  914.             cs_set_player_view_model(id, CSW_KNIFE, Bio_Models[0])
  915.             cs_set_player_weap_model(id, CSW_KNIFE, Bio_Models[1])
  916.         }
  917.         else if((g_bSabers[id]) && (ze_get_vip_flags(id) & VIP_B))
  918.         {
  919.             cs_set_player_view_model(id, CSW_KNIFE, Sabers_Models[0])
  920.             cs_set_player_weap_model(id, CSW_KNIFE, Sabers_Models[1])
  921.         }
  922.         else if((g_bPlasma[id]) && (ze_get_vip_flags(id) & VIP_B))
  923.         {
  924.             cs_set_player_view_model(id, CSW_KNIFE, Plasma_Models[0])
  925.             cs_set_player_weap_model(id, CSW_KNIFE, Plasma_Models[1])
  926.         }
  927.         else if((g_bStorm[id]) && (ze_get_vip_flags(id) & VIP_C))
  928.         {
  929.             cs_set_player_view_model(id, CSW_KNIFE, Storm_Models[0])
  930.             cs_set_player_weap_model(id, CSW_KNIFE, Storm_Models[1])
  931.         }
  932.         else if((g_bLaevateinn[id]) && (ze_get_vip_flags(id) & VIP_C))
  933.         {
  934.             cs_set_player_view_model(id, CSW_KNIFE, Laevateinn_Models[0])
  935.             cs_set_player_weap_model(id, CSW_KNIFE, Laevateinn_Models[1])
  936.         }
  937.         else if((g_bWarHammer_Dark_Knight[id]) && (ze_get_vip_flags(id) & VIP_C))
  938.         {
  939.             cs_set_player_view_model(id, CSW_KNIFE, WarHammer_Dark_Knight_Models[0])
  940.             cs_set_player_weap_model(id, CSW_KNIFE, WarHammer_Dark_Knight_Models[1])
  941.         }
  942.         else if((g_bBalrog_Kosa[id]) && (ze_get_vip_flags(id) & VIP_C))
  943.         {
  944.             cs_set_player_view_model(id, CSW_KNIFE, Balrog_Kosa_Models[0])
  945.             cs_set_player_weap_model(id, CSW_KNIFE, Balrog_Kosa_Models[1])
  946.         }
  947.         else
  948.         {
  949.             cs_reset_player_view_model(id, CSW_KNIFE)
  950.             cs_reset_player_weap_model(id, CSW_KNIFE)
  951.         }
  952.     }
  953. }
  954.  
  955. public Fw_RestMaxSpeed_Post(id)
  956. {
  957.     set_task(0.1, "DelaySettingSpeed", id)
  958. }
  959.  
  960. public DelaySettingSpeed(id)
  961. {
  962.     new iWpnId = get_user_weapon(id)
  963.    
  964.     if (iWpnId == CSW_KNIFE && g_bCompat[id])
  965.     {
  966.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  967.         {
  968.             new iFlags = get_entvar(id, var_flags);
  969.             new iWaterlvl = get_entvar(id, var_waterlevel)
  970.            
  971.             if (!(iFlags & FL_ONGROUND))
  972.                 return
  973.  
  974.             if (iFlags & FL_WATERJUMP)
  975.                 return
  976.  
  977.             if (iWaterlvl > 1)
  978.                 return
  979.            
  980.             new Float:flVelocity[3]
  981.             get_entvar(id , var_velocity , flVelocity)
  982.  
  983.             flVelocity[2] += 325
  984.  
  985.             set_entvar(id , var_velocity , flVelocity)
  986.  
  987.             set_entvar(id, var_gaitsequence, 6)
  988.         }
  989.        
  990.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_compat))
  991.     }
  992.     else if (iWpnId == CSW_KNIFE && g_bStrong[id])
  993.     {
  994.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  995.         {
  996.             new iFlags = get_entvar(id, var_flags);
  997.             new iWaterlvl = get_entvar(id, var_waterlevel)
  998.            
  999.             if (!(iFlags & FL_ONGROUND))
  1000.                 return
  1001.  
  1002.             if (iFlags & FL_WATERJUMP)
  1003.                 return
  1004.  
  1005.             if (iWaterlvl > 1)
  1006.                 return
  1007.            
  1008.             new Float:flVelocity[3]
  1009.             get_entvar(id , var_velocity , flVelocity)
  1010.  
  1011.             flVelocity[2] += 325
  1012.  
  1013.             set_entvar(id , var_velocity , flVelocity)
  1014.  
  1015.             set_entvar(id, var_gaitsequence, 6)
  1016.         }
  1017.        
  1018.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_strong))
  1019.     }
  1020.     else if (iWpnId == CSW_KNIFE && g_bKatana[id])
  1021.     {
  1022.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1023.         {
  1024.             new iFlags = get_entvar(id, var_flags);
  1025.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1026.            
  1027.             if (!(iFlags & FL_ONGROUND))
  1028.                 return
  1029.  
  1030.             if (iFlags & FL_WATERJUMP)
  1031.                 return
  1032.  
  1033.             if (iWaterlvl > 1)
  1034.                 return
  1035.            
  1036.             new Float:flVelocity[3]
  1037.             get_entvar(id , var_velocity , flVelocity)
  1038.  
  1039.             flVelocity[2] += 325
  1040.  
  1041.             set_entvar(id , var_velocity , flVelocity)
  1042.  
  1043.             set_entvar(id, var_gaitsequence, 6)
  1044.         }
  1045.        
  1046.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_katana))
  1047.     }
  1048.     else if (iWpnId == CSW_KNIFE && g_bHammer[id])
  1049.     {
  1050.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1051.         {
  1052.             new iFlags = get_entvar(id, var_flags);
  1053.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1054.            
  1055.             if (!(iFlags & FL_ONGROUND))
  1056.                 return
  1057.  
  1058.             if (iFlags & FL_WATERJUMP)
  1059.                 return
  1060.  
  1061.             if (iWaterlvl > 1)
  1062.                 return
  1063.            
  1064.             new Float:flVelocity[3]
  1065.             get_entvar(id , var_velocity , flVelocity)
  1066.  
  1067.             flVelocity[2] += 325
  1068.  
  1069.             set_entvar(id , var_velocity , flVelocity)
  1070.  
  1071.             set_entvar(id, var_gaitsequence, 6)
  1072.         }
  1073.        
  1074.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_hammer))
  1075.     }
  1076.     else if (iWpnId == CSW_KNIFE && g_bTurbulent9[id])
  1077.     {
  1078.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1079.         {
  1080.             new iFlags = get_entvar(id, var_flags);
  1081.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1082.            
  1083.             if (!(iFlags & FL_ONGROUND))
  1084.                 return
  1085.  
  1086.             if (iFlags & FL_WATERJUMP)
  1087.                 return
  1088.  
  1089.             if (iWaterlvl > 1)
  1090.                 return
  1091.            
  1092.             new Float:flVelocity[3]
  1093.             get_entvar(id , var_velocity , flVelocity)
  1094.  
  1095.             flVelocity[2] += 325
  1096.  
  1097.             set_entvar(id , var_velocity , flVelocity)
  1098.  
  1099.             set_entvar(id, var_gaitsequence, 6)
  1100.         }
  1101.        
  1102.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_turb))
  1103.     }
  1104.     else if (iWpnId == CSW_KNIFE && g_bBio[id])
  1105.     {
  1106.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1107.         {
  1108.             new iFlags = get_entvar(id, var_flags);
  1109.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1110.            
  1111.             if (!(iFlags & FL_ONGROUND))
  1112.                 return
  1113.  
  1114.             if (iFlags & FL_WATERJUMP)
  1115.                 return
  1116.  
  1117.             if (iWaterlvl > 1)
  1118.                 return
  1119.            
  1120.             new Float:flVelocity[3]
  1121.             get_entvar(id , var_velocity , flVelocity)
  1122.  
  1123.             flVelocity[2] += 325
  1124.  
  1125.             set_entvar(id , var_velocity , flVelocity)
  1126.  
  1127.             set_entvar(id, var_gaitsequence, 6)
  1128.         }
  1129.        
  1130.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_bio))
  1131.     }
  1132.     else if (iWpnId == CSW_KNIFE && g_bSabers[id])
  1133.     {
  1134.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1135.         {
  1136.             new iFlags = get_entvar(id, var_flags);
  1137.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1138.            
  1139.             if (!(iFlags & FL_ONGROUND))
  1140.                 return
  1141.  
  1142.             if (iFlags & FL_WATERJUMP)
  1143.                 return
  1144.  
  1145.             if (iWaterlvl > 1)
  1146.                 return
  1147.            
  1148.             new Float:flVelocity[3]
  1149.             get_entvar(id , var_velocity , flVelocity)
  1150.  
  1151.             flVelocity[2] += 325
  1152.  
  1153.             set_entvar(id , var_velocity , flVelocity)
  1154.  
  1155.             set_entvar(id, var_gaitsequence, 6)
  1156.         }
  1157.        
  1158.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_sabers))
  1159.     }
  1160.     else if (iWpnId == CSW_KNIFE && g_bPlasma[id])
  1161.     {
  1162.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1163.         {
  1164.             new iFlags = get_entvar(id, var_flags);
  1165.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1166.            
  1167.             if (!(iFlags & FL_ONGROUND))
  1168.                 return
  1169.  
  1170.             if (iFlags & FL_WATERJUMP)
  1171.                 return
  1172.  
  1173.             if (iWaterlvl > 1)
  1174.                 return
  1175.            
  1176.             new Float:flVelocity[3]
  1177.             get_entvar(id , var_velocity , flVelocity)
  1178.  
  1179.             flVelocity[2] += 325
  1180.  
  1181.             set_entvar(id , var_velocity , flVelocity)
  1182.  
  1183.             set_entvar(id, var_gaitsequence, 6)
  1184.         }
  1185.        
  1186.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_plasma))
  1187.     }
  1188.     else if (iWpnId == CSW_KNIFE && g_bStorm[id])
  1189.     {
  1190.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1191.         {
  1192.             new iFlags = get_entvar(id, var_flags);
  1193.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1194.            
  1195.             if (!(iFlags & FL_ONGROUND))
  1196.                 return
  1197.  
  1198.             if (iFlags & FL_WATERJUMP)
  1199.                 return
  1200.  
  1201.             if (iWaterlvl > 1)
  1202.                 return
  1203.            
  1204.             new Float:flVelocity[3]
  1205.             get_entvar(id , var_velocity , flVelocity)
  1206.  
  1207.             flVelocity[2] += 325
  1208.  
  1209.             set_entvar(id , var_velocity , flVelocity)
  1210.  
  1211.             set_entvar(id, var_gaitsequence, 6)
  1212.         }
  1213.        
  1214.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_storm))
  1215.     }
  1216.     else if (iWpnId == CSW_KNIFE && g_bLaevateinn[id])
  1217.     {
  1218.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1219.         {
  1220.             new iFlags = get_entvar(id, var_flags);
  1221.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1222.            
  1223.             if (!(iFlags & FL_ONGROUND))
  1224.                 return
  1225.  
  1226.             if (iFlags & FL_WATERJUMP)
  1227.                 return
  1228.  
  1229.             if (iWaterlvl > 1)
  1230.                 return
  1231.            
  1232.             new Float:flVelocity[3]
  1233.             get_entvar(id , var_velocity , flVelocity)
  1234.  
  1235.             flVelocity[2] += 325
  1236.  
  1237.             set_entvar(id , var_velocity , flVelocity)
  1238.  
  1239.             set_entvar(id, var_gaitsequence, 6)
  1240.         }
  1241.        
  1242.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_laevat))
  1243.     }
  1244.     else if (iWpnId == CSW_KNIFE && g_bWarHammer_Dark_Knight[id])
  1245.     {
  1246.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1247.         {
  1248.             new iFlags = get_entvar(id, var_flags);
  1249.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1250.            
  1251.             if (!(iFlags & FL_ONGROUND))
  1252.                 return
  1253.  
  1254.             if (iFlags & FL_WATERJUMP)
  1255.                 return
  1256.  
  1257.             if (iWaterlvl > 1)
  1258.                 return
  1259.            
  1260.             new Float:flVelocity[3]
  1261.             get_entvar(id , var_velocity , flVelocity)
  1262.  
  1263.             flVelocity[2] += 325
  1264.  
  1265.             set_entvar(id , var_velocity , flVelocity)
  1266.  
  1267.             set_entvar(id, var_gaitsequence, 6)
  1268.         }
  1269.        
  1270.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_darknight))
  1271.     }
  1272.     else if (iWpnId == CSW_KNIFE && g_bBalrog_Kosa[id])
  1273.     {
  1274.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1275.         {
  1276.             new iFlags = get_entvar(id, var_flags);
  1277.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1278.            
  1279.             if (!(iFlags & FL_ONGROUND))
  1280.                 return
  1281.  
  1282.             if (iFlags & FL_WATERJUMP)
  1283.                 return
  1284.  
  1285.             if (iWaterlvl > 1)
  1286.                 return
  1287.            
  1288.             new Float:flVelocity[3]
  1289.             get_entvar(id , var_velocity , flVelocity)
  1290.  
  1291.             flVelocity[2] += 325
  1292.  
  1293.             set_entvar(id , var_velocity , flVelocity)
  1294.  
  1295.             set_entvar(id, var_gaitsequence, 6)
  1296.         }
  1297.        
  1298.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_kosa))
  1299.     }
  1300. }
  1301.  
  1302. public DeathMsg(msg_id, msg_dest, id)
  1303. {
  1304.     static szTruncatedWeapon[33], iAttacker
  1305.     get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  1306.     iAttacker = get_msg_arg_int(1)
  1307.    
  1308.     if(!is_user_alive(iAttacker) || iAttacker == get_msg_arg_int(2) || !is_user_alive(get_msg_arg_int(2))) // get_msg_arg_int(2) = iVictim
  1309.         return
  1310.    
  1311.     if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iAttacker) & CSW_KNIFE)
  1312.     {
  1313.         if(g_bCompat[id])
  1314.         {
  1315.             set_msg_arg_string(4, "Combat knife")
  1316.         }
  1317.         else if(g_bStrong[id])
  1318.         {
  1319.             set_msg_arg_string(4, "Strong knife")
  1320.         }
  1321.         else if(g_bKatana[id])
  1322.         {
  1323.             set_msg_arg_string(4, "Katana knife")
  1324.         }
  1325.         else if(g_bHammer[id])
  1326.         {
  1327.             set_msg_arg_string(4, "Ice knife")
  1328.         }
  1329.         else if(g_bTurbulent9[id])
  1330.         {
  1331.             set_msg_arg_string(4, "Turbulent9 knife")
  1332.         }
  1333.         else if(g_bBio[id])
  1334.         {
  1335.             set_msg_arg_string(4, "Biohazard knife")
  1336.         }
  1337.         else if(g_bSabers[id])
  1338.         {
  1339.             set_msg_arg_string(4, "Sabers knife")
  1340.         }
  1341.         else if(g_bPlasma[id])
  1342.         {
  1343.             set_msg_arg_string(4, "Plasma knife")
  1344.         }
  1345.         else if(g_bStorm[id])
  1346.         {
  1347.             set_msg_arg_string(4, "Storm knife")
  1348.         }
  1349.         else if(g_bLaevateinn[id])
  1350.         {
  1351.             set_msg_arg_string(4, "Laevateinn knife")
  1352.         }
  1353.         else if(g_bWarHammer_Dark_Knight[id])
  1354.         {
  1355.             set_msg_arg_string(4, "WarHammer Dark Knight knife")
  1356.         }
  1357.         else if(g_bBalrog_Kosa[id])
  1358.         {
  1359.             set_msg_arg_string(4, "Balrog Kosa Knife")
  1360.         }
  1361.     }
  1362. }
  1363.  
  1364. stock fm_set_user_maxspeed(index, Float:speed = -1.0)
  1365. {
  1366.         engfunc(EngFunc_SetClientMaxspeed, index, speed);
  1367.         set_pev(index, pev_maxspeed, speed);
  1368.  
  1369.         return 1;
  1370. }  
  1371.  
  1372. public native_ze_open_knife_menu(id)
  1373. {
  1374.     Show_Knife_Menu(id)
  1375. }

The right approach is:

  1. public plugin_init()
  2. {
  3.     // Hook max speed reset (When user change his weapon)
  4.     RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "Fw_RestMaxSpeed_Post", 1)
  5. }
  6.  
  7. public Fw_RestMaxSpeed_Post(id)
  8. {
  9.     // Delay setting your speed
  10.     set_task(0.1, "DelaySettingSpeed", id)
  11. }
  12.  
  13. public DelaySettingSpeed(id)
  14. {
  15.     new iWpnId = get_user_weapon(id)
  16.    
  17.     if (iWpnId == ANYTHING)
  18.     {
  19.         set_entvar(id, var_maxspeed, speed_as_float)
  20.     }
  21. }
You don't know? Learn and you will know.

User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 3 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

#33

Post by Mark » 3 Months Ago

Raheem wrote:
3 Months Ago
Delay needed:

  1. #include <zombie_escape>
  2. #include <engine>
  3. #include <fun>
  4. #include <ze_vip>
  5.  
  6. // Models
  7. new const Compat_Models[][] =
  8. {
  9.     "models/zombie_escape/v_combat_knife.mdl",
  10.     "models/zombie_escape/p_combat_knife.mdl"
  11. }
  12.  
  13. new const Strong_Models[][] =
  14. {
  15.     "models/zombie_escape/v_strong_knife.mdl",
  16.     "models/zombie_escape/p_strong_knife.mdl"
  17. }
  18.  
  19. new const Katana_Models[][] =
  20. {
  21.     "models/zombie_escape/v_katana_knife.mdl",
  22.     "models/zombie_escape/p_katana_knife.mdl"
  23. }
  24.  
  25. new const Hammer_Models[][] =
  26. {
  27.     "models/zombie_escape/v_hammer_knife.mdl",
  28.     "models/zombie_escape/p_hammer_knife.mdl"
  29. }
  30.  
  31. new const Turbulent9_Models[][] =
  32. {
  33.     "models/zombie_escape/v_turbulent9_knife.mdl",
  34.     "models/zombie_escape/p_turbulent9_knife.mdl"
  35. }
  36.  
  37. new const Bio_Models[][] =
  38. {
  39.     "models/zombie_escape/v_bio_knife.mdl",
  40.     "models/zombie_escape/p_bio_knife.mdl"
  41. }
  42.  
  43. new const Sabers_Models[][] =
  44. {
  45.     "models/zombie_escape/v_laser_knife.mdl",
  46.     "models/zombie_escape/p_laser_knife.mdl"
  47. }
  48.  
  49. new const Plasma_Models[][] =
  50. {
  51.     "models/zombie_escape/v_plasma_knife.mdl",
  52.     "models/zombie_escape/p_plasma_knife.mdl"
  53. }
  54.  
  55. new const Storm_Models[][] =
  56. {
  57.     "models/zombie_escape/v_storm_sword_knife.mdl",
  58.     "models/zombie_escape/p_storm_sword_knife.mdl"
  59. }
  60.  
  61. new const Laevateinn_Models[][] =
  62. {
  63.     "models/zombie_escape/v_laevateinn_knife.mdl",
  64.     "models/zombie_escape/p_laevateinn_knife.mdl"
  65. }
  66.  
  67. new const WarHammer_Dark_Knight_Models[][] =
  68. {
  69.     "models/zombie_escape/v_WarHammer_dark_knight_knife.mdl",
  70.     "models/zombie_escape/p_WarHammer_dark_knight_knife.mdl"
  71. }
  72.  
  73. new const Balrog_Kosa_Models[][] =
  74. {
  75.     "models/zombie_escape/v_balrog_kosa_knife.mdl",
  76.     "models/zombie_escape/p_balrog_kosa_knife.mdl"
  77. }
  78.  
  79. // Sounds
  80. new const g_sound_knife[] = "items/gunpickup2.wav"
  81.  
  82. new const combat_sounds[][] =
  83. {
  84.     "zombie_escape/knife_menu/combat_deploy.wav",
  85.     "zombie_escape/knife_menu/combat_hit.wav",
  86.     "zombie_escape/knife_menu/combat_hit.wav",
  87.     "zombie_escape/knife_menu/combat_hit.wav",
  88.     "zombie_escape/knife_menu/combat_hit.wav",
  89.     "zombie_escape/knife_menu/combat_hitwall.wav",
  90.     "zombie_escape/knife_menu/combat_slash.wav",
  91.     "zombie_escape/knife_menu/combat_slash.wav",
  92.     "zombie_escape/knife_menu/combat_stab.wav"
  93. }
  94.  
  95. new const strong_sounds[][] =
  96. {
  97.     "zombie_escape/knife_menu/strong_deploy.wav",
  98.     "zombie_escape/knife_menu/strong_hit.wav",
  99.     "zombie_escape/knife_menu/strong_hit.wav",
  100.     "zombie_escape/knife_menu/strong_hit.wav",
  101.     "zombie_escape/knife_menu/strong_hit.wav",
  102.     "zombie_escape/knife_menu/strong_hitwall.wav",
  103.     "zombie_escape/knife_menu/strong_slash.wav",
  104.     "zombie_escape/knife_menu/strong_slash.wav",
  105.     "zombie_escape/knife_menu/strong_stab.wav"
  106. }
  107.  
  108. new const katana_sounds[][] =
  109. {
  110.     "zombie_escape/knife_menu/katana_deploy.wav",
  111.     "zombie_escape/knife_menu/katana_hit.wav",
  112.     "zombie_escape/knife_menu/katana_hit.wav",
  113.     "zombie_escape/knife_menu/katana_hit.wav",
  114.     "zombie_escape/knife_menu/katana_hit.wav",
  115.     "zombie_escape/knife_menu/katana_hitwall.wav",
  116.     "zombie_escape/knife_menu/katana_slash.wav",
  117.     "zombie_escape/knife_menu/katana_slash.wav",
  118.     "zombie_escape/knife_menu/katana_stab.wav"
  119. }
  120.  
  121. new const hammer_sounds[][] =
  122. {
  123.     "zombie_escape/knife_menu/hammer_deploy.wav",
  124.     "zombie_escape/knife_menu/hammer_hit.wav",
  125.     "zombie_escape/knife_menu/hammer_hit.wav",
  126.     "zombie_escape/knife_menu/hammer_hit.wav",
  127.     "zombie_escape/knife_menu/hammer_hit.wav",
  128.     "zombie_escape/knife_menu/hammer_hitwall.wav",
  129.     "zombie_escape/knife_menu/hammer_slash.wav",
  130.     "zombie_escape/knife_menu/hammer_slash.wav",
  131.     "zombie_escape/knife_menu/hammer_stab.wav"
  132. }
  133.  
  134. new const turbulent9_sounds[][] =
  135. {
  136.     "zombie_escape/knife_menu/turbulent9_deploy.wav",
  137.     "zombie_escape/knife_menu/turbulent9_hit.wav",
  138.     "zombie_escape/knife_menu/turbulent9_hit.wav",
  139.     "zombie_escape/knife_menu/turbulent9_hit.wav",
  140.     "zombie_escape/knife_menu/turbulent9_hit.wav",
  141.     "zombie_escape/knife_menu/turbulent9_hitwall.wav",
  142.     "zombie_escape/knife_menu/turbulent9_slash.wav",
  143.     "zombie_escape/knife_menu/turbulent9_slash.wav",
  144.     "zombie_escape/knife_menu/turbulent9_stab.wav"
  145. }
  146.  
  147. new const bio_sounds[][] =
  148. {
  149.     "zombie_escape/knife_menu/bio_deploy.wav",
  150.     "zombie_escape/knife_menu/bio_hit.wav",
  151.     "zombie_escape/knife_menu/bio_hit.wav",
  152.     "zombie_escape/knife_menu/bio_hit.wav",
  153.     "zombie_escape/knife_menu/bio_hit.wav",
  154.     "zombie_escape/knife_menu/bio_hitwall.wav",
  155.     "zombie_escape/knife_menu/bio_slash.wav",
  156.     "zombie_escape/knife_menu/bio_slash.wav",
  157.     "zombie_escape/knife_menu/bio_stab.wav"
  158. }
  159.  
  160. new const sabers_sounds[][] =
  161. {
  162.     "zombie_escape/knife_menu/laser_deploy.wav",
  163.     "zombie_escape/knife_menu/laser_hit.wav",
  164.     "zombie_escape/knife_menu/laser_hit.wav",
  165.     "zombie_escape/knife_menu/laser_hit.wav",
  166.     "zombie_escape/knife_menu/laser_hit.wav",
  167.     "zombie_escape/knife_menu/laser_hitwall.wav",
  168.     "zombie_escape/knife_menu/laser_slash1.wav",
  169.     "zombie_escape/knife_menu/laser_slash2.wav",
  170.     "zombie_escape/knife_menu/laser_stab.wav"
  171. }
  172.  
  173. new const plasma_sounds[][] =
  174. {
  175.     "zombie_escape/knife_menu/plasma_deploy.wav",
  176.     "zombie_escape/knife_menu/plasma_hit.wav",
  177.     "zombie_escape/knife_menu/plasma_hit.wav",
  178.     "zombie_escape/knife_menu/plasma_hit.wav",
  179.     "zombie_escape/knife_menu/plasma_hit.wav",
  180.     "zombie_escape/knife_menu/plasma_hitwall.wav",
  181.     "zombie_escape/knife_menu/plasma_slash.wav",
  182.     "zombie_escape/knife_menu/plasma_slash.wav",
  183.     "zombie_escape/knife_menu/plasma_stab.wav"
  184. }
  185.  
  186. new const storm_sounds[][] =
  187. {
  188.     "zombie_escape/knife_menu/storm_sword_deploy.wav",
  189.     "zombie_escape/knife_menu/storm_sword_hit.wav",
  190.     "zombie_escape/knife_menu/storm_sword_hit.wav",
  191.     "zombie_escape/knife_menu/storm_sword_hit.wav",
  192.     "zombie_escape/knife_menu/storm_sword_hit.wav",
  193.     "zombie_escape/knife_menu/storm_sword_hitwall.wav",
  194.     "zombie_escape/knife_menu/storm_sword_slash.wav",
  195.     "zombie_escape/knife_menu/storm_sword_slash.wav",
  196.     "zombie_escape/knife_menu/storm_sword_stab.wav"
  197. }
  198.  
  199. new const laevateinn_sounds[][] =
  200. {
  201.     "zombie_escape/knife_menu/laevateinn_deploy.wav",
  202.     "zombie_escape/knife_menu/laevateinn_hit.wav",
  203.     "zombie_escape/knife_menu/laevateinn_hit.wav",
  204.     "zombie_escape/knife_menu/laevateinn_hit.wav",
  205.     "zombie_escape/knife_menu/laevateinn_hit.wav",
  206.     "zombie_escape/knife_menu/laevateinn_hitwall.wav",
  207.     "zombie_escape/knife_menu/laevateinn_slash.wav",
  208.     "zombie_escape/knife_menu/laevateinn_slash.wav",
  209.     "zombie_escape/knife_menu/laevateinn_stab.wav"
  210. }
  211.  
  212. new const warhammer_dark_knight_sounds[][] =
  213. {
  214.     "zombie_escape/knife_menu/WarHammer_dark_knight_deploy.wav",
  215.     "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
  216.     "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
  217.     "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
  218.     "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
  219.     "zombie_escape/knife_menu/WarHammer_dark_knight_hitwall.wav",
  220.     "zombie_escape/knife_menu/WarHammer_dark_knight_slash.wav",
  221.     "zombie_escape/knife_menu/WarHammer_dark_knight_slash.wav",
  222.     "zombie_escape/knife_menu/WarHammer_dark_knight_stab.wav"
  223. }
  224.  
  225. new const balrog_kosa_sounds[][] =
  226. {
  227.     "zombie_escape/knife_menu/balrog_kosa_deploy.wav",
  228.     "zombie_escape/knife_menu/balrog_kosa_hit.wav",
  229.     "zombie_escape/knife_menu/balrog_kosa_hit.wav",
  230.     "zombie_escape/knife_menu/balrog_kosa_hit.wav",
  231.     "zombie_escape/knife_menu/balrog_kosa_hit.wav",
  232.     "zombie_escape/knife_menu/balrog_kosa_hitwall.wav",
  233.     "zombie_escape/knife_menu/balrog_kosa_slash.wav",
  234.     "zombie_escape/knife_menu/balrog_kosa_slash.wav",
  235.     "zombie_escape/knife_menu/balrog_kosa_stab.wav"
  236. }
  237.  
  238. new const oldknife_sounds[][] =
  239. {
  240.     "weapons/knife_deploy1.wav",
  241.     "weapons/knife_hit1.wav",
  242.     "weapons/knife_hit2.wav",
  243.     "weapons/knife_hit3.wav",
  244.     "weapons/knife_hit4.wav",
  245.     "weapons/knife_hitwall1.wav",
  246.     "weapons/knife_slash1.wav",
  247.     "weapons/knife_slash2.wav",
  248.     "weapons/knife_stab.wav"
  249. }
  250.  
  251. new bool:g_bCompat[33], bool:g_bStrong[33], bool:g_bKatana[33], bool:g_bHammer[33], bool:g_bTurbulent9[33], bool:g_bBio[33], bool:g_bSabers[33], bool:g_bPlasma[33],
  252. bool:g_bStorm[33], bool:g_bLaevateinn[33], bool:g_bWarHammer_Dark_Knight[33], bool:g_bBalrog_Kosa[33], bool:g_bNoSpeed, g_iUsedTimes[33], g_pCvarUseTimes
  253.  
  254. new cvar_speed_compat
  255. new cvar_speed_strong
  256. new cvar_speed_katana
  257. new cvar_speed_hammer
  258. new cvar_speed_turb
  259. new cvar_speed_bio
  260. new cvar_speed_sabers
  261. new cvar_speed_plasma
  262. new cvar_speed_storm
  263. new cvar_speed_laevat
  264. new cvar_speed_darknight
  265. new cvar_speed_kosa
  266.  
  267. public plugin_precache()
  268. {
  269.     new i
  270.  
  271.     for (i = 0; i <= charsmax(Compat_Models); i++)
  272.         precache_model(Compat_Models[i])
  273.  
  274.     for (i = 0; i <= charsmax(Hammer_Models); i++)
  275.         precache_model(Hammer_Models[i])
  276.  
  277.     for (i = 0; i <= charsmax(Katana_Models); i++)
  278.         precache_model(Katana_Models[i])
  279.  
  280.     for (i = 0; i <= charsmax(Strong_Models); i++)
  281.         precache_model(Strong_Models[i])
  282.  
  283.     for (i = 0; i <= charsmax(Turbulent9_Models); i++)
  284.         precache_model(Turbulent9_Models[i])
  285.  
  286.     for (i = 0; i <= charsmax(Bio_Models); i++)
  287.         precache_model(Bio_Models[i])
  288.  
  289.     for (i = 0; i <= charsmax(Sabers_Models); i++)
  290.         precache_model(Sabers_Models[i])
  291.  
  292.     for (i = 0; i <= charsmax(Plasma_Models); i++)
  293.         precache_model(Plasma_Models[i])
  294.  
  295.     for (i = 0; i <= charsmax(Storm_Models); i++)
  296.         precache_model(Storm_Models[i])
  297.  
  298.     for (i = 0; i <= charsmax(Laevateinn_Models); i++)
  299.         precache_model(Laevateinn_Models[i])
  300.  
  301.     for (i = 0; i <= charsmax(WarHammer_Dark_Knight_Models); i++)
  302.         precache_model(WarHammer_Dark_Knight_Models[i])
  303.  
  304.     for (i = 0; i <= charsmax(Balrog_Kosa_Models); i++)
  305.         precache_model(Balrog_Kosa_Models[i])
  306.  
  307.     for (i = 0; i <= charsmax(combat_sounds); i++)
  308.         precache_sound(combat_sounds[i])
  309.  
  310.     for (i = 0; i <= charsmax(strong_sounds); i++)
  311.         precache_sound(strong_sounds[i])
  312.  
  313.     for (i = 0; i <= charsmax(katana_sounds); i++)
  314.         precache_sound(katana_sounds[i])
  315.  
  316.     for (i = 0; i <= charsmax(hammer_sounds); i++)
  317.         precache_sound(hammer_sounds[i])
  318.  
  319.     for (i = 0; i <= charsmax(turbulent9_sounds); i++)
  320.         precache_sound(turbulent9_sounds[i])
  321.  
  322.     for (i = 0; i <= charsmax(bio_sounds); i++)
  323.         precache_sound(bio_sounds[i])
  324.  
  325.     for (i = 0; i <= charsmax(sabers_sounds); i++)
  326.         precache_sound(sabers_sounds[i])
  327.  
  328.     for (i = 0; i <= charsmax(plasma_sounds); i++)
  329.         precache_sound(plasma_sounds[i])
  330.  
  331.     for (i = 0; i <= charsmax(storm_sounds); i++)
  332.         precache_sound(storm_sounds[i])
  333.  
  334.     for (i = 0; i <= charsmax(laevateinn_sounds); i++)
  335.         precache_sound(laevateinn_sounds[i])
  336.  
  337.     for (i = 0; i <= charsmax(warhammer_dark_knight_sounds); i++)
  338.         precache_sound(warhammer_dark_knight_sounds[i])
  339.  
  340.     for (i = 0; i <= charsmax(balrog_kosa_sounds); i++)
  341.         precache_sound(balrog_kosa_sounds[i])
  342.  
  343.     precache_sound(g_sound_knife)
  344. }
  345.  
  346. public plugin_natives()
  347. {
  348.     register_native("ze_open_knife_menu", "native_ze_open_knife_menu", 1)
  349. }
  350.  
  351. public plugin_init()
  352. {
  353.     register_plugin("[ZE] Addon: Knife Menu", "1.2", "Jack GamePlay")
  354.  
  355.     register_forward(FM_EmitSound, "fw_EmitSound")
  356.     register_forward(FM_PlayerPreThink, "fw_PlayerPreThink");
  357.  
  358.     register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
  359.     RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "Fw_RestMaxSpeed_Post", 1)
  360.    
  361.     g_pCvarUseTimes = register_cvar("ze_knife_menu_use_times", "1")
  362.  
  363.     register_message(get_user_msgid("DeathMsg"), "DeathMsg")
  364.  
  365.     register_clcmd("say /k", "Show_Knife_Menu")
  366.    
  367.     cvar_speed_compat = register_cvar("ze_compat_speed", "400.0")
  368.     cvar_speed_strong = register_cvar("ze_strong_speed", "270.0")
  369.     cvar_speed_katana = register_cvar("ze_katana_speed", "270.0")
  370.     cvar_speed_hammer = register_cvar("ze_hammer_speed", "270.0")
  371.     cvar_speed_turb = register_cvar("ze_turb_speed", "275.0")    
  372.     cvar_speed_bio = register_cvar("ze_bio_speed", "275.0")
  373.     cvar_speed_sabers = register_cvar("ze_sabers_speed", "275.0")
  374.     cvar_speed_plasma = register_cvar("ze_plasma_speed", "275.0")
  375.     cvar_speed_storm = register_cvar("ze_storm_speed", "280.0")    
  376.     cvar_speed_laevat = register_cvar("ze_laevat_speed", "280.0")  
  377.     cvar_speed_darknight = register_cvar("ze_darknight_speed", "280.0")
  378.     cvar_speed_kosa = register_cvar("ze_kosa_speed", "280.0")
  379. }
  380.  
  381. public ze_user_humanized(id)
  382. {
  383.     g_iUsedTimes[id] = 0
  384. }
  385.  
  386. public ze_user_infected(Victim)
  387. {
  388.     g_bCompat[Victim] = false
  389.     g_bStrong[Victim] = false
  390.     g_bKatana[Victim] = false
  391.     g_bHammer[Victim] = false
  392.     g_bTurbulent9[Victim] = false
  393.     g_bBio[Victim] = false
  394.     g_bSabers[Victim] = false
  395.     g_bPlasma[Victim] = false
  396.     g_bStorm[Victim] = false
  397.     g_bLaevateinn[Victim] = false
  398.     g_bWarHammer_Dark_Knight[Victim] = false
  399.     g_bBalrog_Kosa[Victim] = false
  400.     g_iUsedTimes[Victim] = 0
  401. }
  402.  
  403. public client_putinserver(id)
  404. {
  405.     g_bCompat[id] = false
  406.     g_bStrong[id] = false
  407.     g_bKatana[id] = false
  408.     g_bHammer[id] = false
  409.     g_bTurbulent9[id] = false
  410.     g_bBio[id] = false
  411.     g_bSabers[id] = false
  412.     g_bPlasma[id] = false
  413.     g_bStorm[id] = false
  414.     g_bLaevateinn[id] = false
  415.     g_bWarHammer_Dark_Knight[id] = false
  416.     g_bBalrog_Kosa[id] = false
  417.     g_iUsedTimes[id] = 0
  418. }
  419.  
  420. public client_disconnected(id)
  421. {
  422.     g_bCompat[id] = false
  423.     g_bStrong[id] = false
  424.     g_bKatana[id] = false
  425.     g_bHammer[id] = false
  426.     g_bTurbulent9[id] = false
  427.     g_bBio[id] = false
  428.     g_bSabers[id] = false
  429.     g_bPlasma[id] = false
  430.     g_bStorm[id] = false
  431.     g_bLaevateinn[id] = false
  432.     g_bWarHammer_Dark_Knight[id] = false
  433.     g_bBalrog_Kosa[id] = false
  434.     g_iUsedTimes[id] = 0
  435. }
  436.  
  437. public Show_Knife_Menu(id)
  438. {
  439.     if (!is_user_connected(id))
  440.         return PLUGIN_CONTINUE
  441.  
  442.     if (ze_is_user_zombie(id))
  443.     {
  444.         ze_colored_print(id, "!tZombies can't open knife menu!y.")
  445.         return PLUGIN_HANDLED
  446.     }
  447.  
  448.     if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
  449.     {
  450.         ze_colored_print(id, "!tYou can only open knife menu !y[!g%dx!y] per round!", get_pcvar_num(g_pCvarUseTimes))
  451.         return PLUGIN_HANDLED
  452.     }
  453.  
  454.     if (!is_user_alive(id))
  455.     {
  456.         ze_colored_print(id, "!tDead can't open knife menu!y.")
  457.         return PLUGIN_HANDLED
  458.     }
  459.  
  460.     Knife_Menu(id)
  461.     return PLUGIN_CONTINUE
  462. }
  463.  
  464. public Knife_Menu(id)
  465. {
  466.     new iMenu = menu_create("\rChoose Your Knife\w:", "Menu_Handler")
  467.     menu_additem(iMenu, "\yCombat", "", 0)
  468.     menu_additem(iMenu, "\yStrong", "", 0)
  469.     menu_additem(iMenu, "\yKatana", "", 0)
  470.     menu_additem(iMenu, "\yHammer", "", 0)
  471.  
  472.     if (ze_get_vip_flags(id) & VIP_A)
  473.     {
  474.         menu_additem(iMenu, "\yTurbulent9 \r[VIP]", "", 0)
  475.         menu_additem(iMenu, "\yBio Hazard \r[VIP]", "", 0)
  476.     }
  477.    
  478.     if (ze_get_vip_flags(id) & VIP_B)
  479.     {
  480.         menu_additem(iMenu, "\ySabers \r[VIP+]", "", 0)
  481.         menu_additem(iMenu, "\yPlasma \r[VIP+]", "", 0)
  482.     }
  483.  
  484.     if (ze_get_vip_flags(id) & VIP_C)
  485.     {
  486.         menu_additem(iMenu, "\yStorm \r[VIP++]", "", 0)
  487.         menu_additem(iMenu, "\yLaevateinn \r[VIP++]", "", 0)
  488.         menu_additem(iMenu, "\yWarHammer Dark Night \r[VIP++]", "", 0)
  489.         menu_additem(iMenu, "\yBalrog Kosa \r[VIP++]", "", 0)
  490.     }
  491.  
  492.     menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  493.     menu_display(id, iMenu, 0)
  494. }
  495.  
  496. public Menu_Handler(id, iMenu, iKey)
  497. {
  498.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  499.         return PLUGIN_HANDLED
  500.        
  501.     switch(iKey)
  502.     {
  503.         case 0: // Compat
  504.         {
  505.             g_bCompat[id] = true
  506.             g_bStrong[id] = false
  507.             g_bKatana[id] = false
  508.             g_bHammer[id] = false
  509.             g_bTurbulent9[id] = false
  510.             g_bBio[id] = false
  511.             g_bSabers[id] = false
  512.             g_bPlasma[id] = false
  513.             g_bStorm[id] = false
  514.             g_bLaevateinn[id] = false
  515.             g_bWarHammer_Dark_Knight[id] = false
  516.             g_bBalrog_Kosa[id] = false
  517.             g_iUsedTimes[id]++
  518.             /*rg_remove_item(id, "weapon_knife")
  519.             rg_give_item(id, "weapon_knife", GT_APPEND)
  520.             engclient_cmd(id, "weapon_knife")
  521.             g_iUsedTimes[id]++
  522.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  523.         }
  524.         case 1: // Strong
  525.         {
  526.             g_bCompat[id] = false
  527.             g_bStrong[id] = true
  528.             g_bKatana[id] = false
  529.             g_bHammer[id] = false
  530.             g_bTurbulent9[id] = false
  531.             g_bBio[id] = false
  532.             g_bSabers[id] = false
  533.             g_bPlasma[id] = false
  534.             g_bStorm[id] = false
  535.             g_bLaevateinn[id] = false
  536.             g_bWarHammer_Dark_Knight[id] = false
  537.             g_bBalrog_Kosa[id] = false
  538.             g_iUsedTimes[id]++
  539.             /*rg_remove_item(id, "weapon_knife")
  540.             rg_give_item(id, "weapon_knife", GT_APPEND)
  541.             engclient_cmd(id, "weapon_knife")
  542.             g_iUsedTimes[id]++
  543.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  544.         }
  545.         case 2: // Katana
  546.         {
  547.             g_bCompat[id] = false
  548.             g_bStrong[id] = false
  549.             g_bKatana[id] = true
  550.             g_bHammer[id] = false
  551.             g_bTurbulent9[id] = false
  552.             g_bBio[id] = false
  553.             g_bSabers[id] = false
  554.             g_bPlasma[id] = false
  555.             g_bStorm[id] = false
  556.             g_bLaevateinn[id] = false
  557.             g_bWarHammer_Dark_Knight[id] = false
  558.             g_bBalrog_Kosa[id] = false
  559.             g_iUsedTimes[id]++
  560.             /*rg_remove_item(id, "weapon_knife")
  561.             rg_give_item(id, "weapon_knife", GT_APPEND)
  562.             engclient_cmd(id, "weapon_knife")
  563.             g_iUsedTimes[id]++
  564.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  565.         }
  566.         case 3: // Hammer
  567.         {
  568.             g_bCompat[id] = false
  569.             g_bStrong[id] = false
  570.             g_bKatana[id] = false
  571.             g_bHammer[id] = true
  572.             g_bTurbulent9[id] = false
  573.             g_bBio[id] = false
  574.             g_bSabers[id] = false
  575.             g_bPlasma[id] = false
  576.             g_bStorm[id] = false
  577.             g_bLaevateinn[id] = false
  578.             g_bWarHammer_Dark_Knight[id] = false
  579.             g_bBalrog_Kosa[id] = false
  580.             g_iUsedTimes[id]++
  581.             /*rg_remove_item(id, "weapon_knife")
  582.             rg_give_item(id, "weapon_knife", GT_APPEND)
  583.             engclient_cmd(id, "weapon_knife")
  584.             g_iUsedTimes[id]++
  585.             emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  586.         }
  587.         case 4: // Turbulent
  588.         {
  589.             if (ze_get_vip_flags(id) & VIP_A)
  590.             {
  591.                 g_bCompat[id] = false
  592.                 g_bStrong[id] = false
  593.                 g_bKatana[id] = false
  594.                 g_bHammer[id] = false
  595.                 g_bTurbulent9[id] = true
  596.                 g_bBio[id] = false
  597.                 g_bSabers[id] = false
  598.                 g_bPlasma[id] = false
  599.                 g_bStorm[id] = false
  600.                 g_bLaevateinn[id] = false
  601.                 g_bWarHammer_Dark_Knight[id] = false
  602.                 g_bBalrog_Kosa[id] = false
  603.                 g_iUsedTimes[id]++
  604.                 /*rg_remove_item(id, "weapon_knife")
  605.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  606.                 engclient_cmd(id, "weapon_knife")
  607.                 g_iUsedTimes[id]++
  608.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  609.             }
  610.         }
  611.         case 5: // Bio
  612.         {
  613.             if (ze_get_vip_flags(id) & VIP_A)
  614.             {
  615.                 g_bCompat[id] = false
  616.                 g_bStrong[id] = false
  617.                 g_bKatana[id] = false
  618.                 g_bHammer[id] = false
  619.                 g_bTurbulent9[id] = false
  620.                 g_bBio[id] = true
  621.                 g_bSabers[id] = false
  622.                 g_bPlasma[id] = false
  623.                 g_bStorm[id] = false
  624.                 g_bLaevateinn[id] = false
  625.                 g_bWarHammer_Dark_Knight[id] = false
  626.                 g_bBalrog_Kosa[id] = false
  627.                 g_iUsedTimes[id]++
  628.                 /*rg_remove_item(id, "weapon_knife")
  629.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  630.                 engclient_cmd(id, "weapon_knife")
  631.                 g_iUsedTimes[id]++
  632.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  633.             }
  634.         }
  635.         case 6: // Sabers
  636.         {
  637.             if (ze_get_vip_flags(id) & VIP_B)
  638.             {
  639.                 g_bCompat[id] = false
  640.                 g_bStrong[id] = false
  641.                 g_bKatana[id] = false
  642.                 g_bHammer[id] = false
  643.                 g_bTurbulent9[id] = false
  644.                 g_bBio[id] = false
  645.                 g_bSabers[id] = true
  646.                 g_bPlasma[id] = false
  647.                 g_bStorm[id] = false
  648.                 g_bLaevateinn[id] = false
  649.                 g_bWarHammer_Dark_Knight[id] = false
  650.                 g_bBalrog_Kosa[id] = false
  651.                 g_iUsedTimes[id]++
  652.                 /*rg_remove_item(id, "weapon_knife")
  653.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  654.                 engclient_cmd(id, "weapon_knife")
  655.                 g_iUsedTimes[id]++
  656.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  657.             }
  658.         }
  659.         case 7: // Plasma
  660.         {
  661.             if (ze_get_vip_flags(id) & VIP_B)
  662.             {
  663.                 g_bCompat[id] = false
  664.                 g_bStrong[id] = false
  665.                 g_bKatana[id] = false
  666.                 g_bHammer[id] = false
  667.                 g_bTurbulent9[id] = false
  668.                 g_bBio[id] = false
  669.                 g_bSabers[id] = false
  670.                 g_bPlasma[id] = true
  671.                 g_bStorm[id] = false
  672.                 g_bLaevateinn[id] = false
  673.                 g_bWarHammer_Dark_Knight[id] = false
  674.                 g_bBalrog_Kosa[id] = false
  675.                 g_iUsedTimes[id]++
  676.                 /*rg_remove_item(id, "weapon_knife")
  677.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  678.                 engclient_cmd(id, "weapon_knife")
  679.                 g_iUsedTimes[id]++
  680.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  681.             }
  682.         }
  683.         case 8: // Storm
  684.         {
  685.             if (ze_get_vip_flags(id) & VIP_C)
  686.             {
  687.                 g_bCompat[id] = false
  688.                 g_bStrong[id] = false
  689.                 g_bKatana[id] = false
  690.                 g_bHammer[id] = false
  691.                 g_bTurbulent9[id] = false
  692.                 g_bBio[id] = false
  693.                 g_bSabers[id] = false
  694.                 g_bPlasma[id] = false
  695.                 g_bStorm[id] = true
  696.                 g_bLaevateinn[id] = false
  697.                 g_bWarHammer_Dark_Knight[id] = false
  698.                 g_bBalrog_Kosa[id] = false
  699.                 g_iUsedTimes[id]++
  700.                 /*rg_remove_item(id, "weapon_knife")
  701.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  702.                 engclient_cmd(id, "weapon_knife")
  703.                 g_iUsedTimes[id]++
  704.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  705.             }
  706.         }
  707.         case 9: // Laevateinn
  708.         {
  709.             if (ze_get_vip_flags(id) & VIP_C)
  710.             {
  711.                 g_bCompat[id] = false
  712.                 g_bStrong[id] = false
  713.                 g_bKatana[id] = false
  714.                 g_bHammer[id] = false
  715.                 g_bTurbulent9[id] = false
  716.                 g_bBio[id] = false
  717.                 g_bSabers[id] = false
  718.                 g_bPlasma[id] = false
  719.                 g_bStorm[id] = false
  720.                 g_bLaevateinn[id] = true
  721.                 g_bWarHammer_Dark_Knight[id] = false
  722.                 g_bBalrog_Kosa[id] = false
  723.                 g_iUsedTimes[id]++
  724.                 /*rg_remove_item(id, "weapon_knife")
  725.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  726.                 engclient_cmd(id, "weapon_knife")
  727.                 g_iUsedTimes[id]++
  728.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  729.             }
  730.         }
  731.         case 10: // Warhammer Dark Night
  732.         {
  733.             if (ze_get_vip_flags(id) & VIP_C)
  734.             {
  735.                 g_bCompat[id] = false
  736.                 g_bStrong[id] = false
  737.                 g_bKatana[id] = false
  738.                 g_bHammer[id] = false
  739.                 g_bTurbulent9[id] = false
  740.                 g_bBio[id] = false
  741.                 g_bSabers[id] = false
  742.                 g_bPlasma[id] = false
  743.                 g_bStorm[id] = false
  744.                 g_bLaevateinn[id] = false
  745.                 g_bWarHammer_Dark_Knight[id] = true
  746.                 g_bBalrog_Kosa[id] = false
  747.                 g_iUsedTimes[id]++
  748.                 /*rg_remove_item(id, "weapon_knife")
  749.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  750.                 engclient_cmd(id, "weapon_knife")
  751.                 g_iUsedTimes[id]++
  752.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  753.             }
  754.         }
  755.         case 11: // Balrog Kosa
  756.         {
  757.             if (ze_get_vip_flags(id) & VIP_C)
  758.             {
  759.                 g_bCompat[id] = false
  760.                 g_bStrong[id] = false
  761.                 g_bKatana[id] = false
  762.                 g_bHammer[id] = false
  763.                 g_bTurbulent9[id] = false
  764.                 g_bBio[id] = false
  765.                 g_bSabers[id] = false
  766.                 g_bPlasma[id] = false
  767.                 g_bStorm[id] = false
  768.                 g_bLaevateinn[id] = false
  769.                 g_bWarHammer_Dark_Knight[id] = false
  770.                 g_bBalrog_Kosa[id] = true
  771.                 g_iUsedTimes[id]++
  772.                 /*rg_remove_item(id, "weapon_knife")
  773.                 rg_give_item(id, "weapon_knife", GT_APPEND)
  774.                 engclient_cmd(id, "weapon_knife")
  775.                 g_iUsedTimes[id]++
  776.                 emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
  777.             }
  778.         }
  779.     }
  780.  
  781.     rg_remove_item(id, "weapon_knife")
  782.     rg_give_item(id, "weapon_knife", GT_APPEND)
  783.     engclient_cmd(id, "weapon_knife")
  784.     emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  785.     menu_destroy(iMenu)
  786.     return PLUGIN_HANDLED
  787. }
  788.  
  789. public fw_EmitSound(id, channel, const sound[])
  790. {
  791.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  792.         return FMRES_IGNORED
  793.        
  794.     new i
  795.     for (i = 0; i <= charsmax(combat_sounds); i++)
  796.     for (i = 0; i <= charsmax(strong_sounds); i++)
  797.     for (i = 0; i <= charsmax(katana_sounds); i++)
  798.     for (i = 0; i <= charsmax(hammer_sounds); i++)
  799.     for (i = 0; i <= charsmax(turbulent9_sounds); i++)
  800.     for (i = 0; i <= charsmax(bio_sounds); i++)
  801.     for (i = 0; i <= charsmax(sabers_sounds); i++)
  802.     for (i = 0; i <= charsmax(plasma_sounds); i++)
  803.     for (i = 0; i <= charsmax(storm_sounds); i++)
  804.     for (i = 0; i <= charsmax(laevateinn_sounds); i++)
  805.     for (i = 0; i <= charsmax(warhammer_dark_knight_sounds); i++)
  806.     for (i = 0; i <= charsmax(balrog_kosa_sounds); i++)
  807.     {
  808.         if(equal(sound, oldknife_sounds[i]))
  809.         {
  810.             if (g_bCompat[id])
  811.             {
  812.                 emit_sound(id, channel, combat_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  813.                 return FMRES_SUPERCEDE
  814.             }
  815.             else if (g_bStrong[id])
  816.             {
  817.                 emit_sound(id, channel, strong_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  818.                 return FMRES_SUPERCEDE
  819.             }
  820.             else if (g_bKatana[id])
  821.             {
  822.                 emit_sound(id, channel, katana_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  823.                 return FMRES_SUPERCEDE
  824.             }
  825.             else if (g_bHammer[id])
  826.             {
  827.                 emit_sound(id, channel, hammer_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  828.                 return FMRES_SUPERCEDE
  829.             }
  830.             else if ((g_bTurbulent9[id]) && (ze_get_vip_flags(id) & VIP_A))
  831.             {
  832.                 emit_sound(id, channel, turbulent9_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  833.                 return FMRES_SUPERCEDE
  834.             }
  835.             else if ((g_bBio[id]) && (ze_get_vip_flags(id) & VIP_A))
  836.             {
  837.                 emit_sound(id, channel, bio_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  838.                 return FMRES_SUPERCEDE
  839.             }
  840.             else if ((g_bSabers[id]) && (ze_get_vip_flags(id) & VIP_B))
  841.             {
  842.                 emit_sound(id, channel, sabers_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  843.                 return FMRES_SUPERCEDE
  844.             }
  845.             else if ((g_bPlasma[id]) && (ze_get_vip_flags(id) & VIP_B))
  846.             {
  847.                 emit_sound(id, channel, plasma_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  848.                 return FMRES_SUPERCEDE
  849.             }
  850.             else if ((g_bStorm[id]) && (ze_get_vip_flags(id) & VIP_C))
  851.             {
  852.                 emit_sound(id, channel, storm_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  853.                 return FMRES_SUPERCEDE
  854.             }
  855.             else if ((g_bLaevateinn[id]) && (ze_get_vip_flags(id) & VIP_C))
  856.             {
  857.                 emit_sound(id, channel, laevateinn_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  858.                 return FMRES_SUPERCEDE
  859.             }
  860.             else if ((g_bWarHammer_Dark_Knight[id]) && (ze_get_vip_flags(id) & VIP_C))
  861.             {
  862.                 emit_sound(id, channel, warhammer_dark_knight_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  863.                 return FMRES_SUPERCEDE
  864.             }
  865.             else if ((g_bBalrog_Kosa[id]) && (ze_get_vip_flags(id) & VIP_C))
  866.             {
  867.                 emit_sound(id, channel, balrog_kosa_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  868.                 return FMRES_SUPERCEDE
  869.             }
  870.             else if (!g_bCompat[id] || !g_bStrong[id] || !g_bKatana[id] || !g_bHammer[id] || !g_bTurbulent9[id] || !g_bBio[id] || !g_bSabers[id] || !g_bPlasma[id] || !g_bStorm[id] || !g_bLaevateinn[id] || !g_bWarHammer_Dark_Knight[id] || !g_bBalrog_Kosa[id])
  871.             {
  872.                 emit_sound(id, channel, oldknife_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  873.                 return FMRES_SUPERCEDE
  874.             }
  875.         }
  876.     }
  877.     return FMRES_IGNORED
  878. }
  879.  
  880. public CurrentWeapon(id)
  881. {
  882.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  883.         return
  884.        
  885.     if(get_user_weapon(id) & CSW_KNIFE)
  886.     {
  887.         if(g_bCompat[id])
  888.         {
  889.             cs_set_player_view_model(id, CSW_KNIFE, Compat_Models[0])
  890.             cs_set_player_weap_model(id, CSW_KNIFE, Compat_Models[1])
  891.         }
  892.         else if(g_bStrong[id])
  893.         {
  894.             cs_set_player_view_model(id, CSW_KNIFE, Strong_Models[0])
  895.             cs_set_player_weap_model(id, CSW_KNIFE, Strong_Models[1])
  896.         }
  897.         else if(g_bKatana[id])
  898.         {
  899.             cs_set_player_view_model(id, CSW_KNIFE, Katana_Models[0])
  900.             cs_set_player_weap_model(id, CSW_KNIFE, Katana_Models[1])
  901.         }
  902.         else if(g_bHammer[id])
  903.         {
  904.             cs_set_player_view_model(id, CSW_KNIFE, Hammer_Models[0])
  905.             cs_set_player_weap_model(id, CSW_KNIFE, Hammer_Models[1])
  906.         }
  907.         else if((g_bTurbulent9[id]) && (ze_get_vip_flags(id) & VIP_A))
  908.         {
  909.             cs_set_player_view_model(id, CSW_KNIFE, Turbulent9_Models[0])
  910.             cs_set_player_weap_model(id, CSW_KNIFE, Turbulent9_Models[1])
  911.         }
  912.         else if((g_bBio[id]) && (ze_get_vip_flags(id) & VIP_A))
  913.         {
  914.             cs_set_player_view_model(id, CSW_KNIFE, Bio_Models[0])
  915.             cs_set_player_weap_model(id, CSW_KNIFE, Bio_Models[1])
  916.         }
  917.         else if((g_bSabers[id]) && (ze_get_vip_flags(id) & VIP_B))
  918.         {
  919.             cs_set_player_view_model(id, CSW_KNIFE, Sabers_Models[0])
  920.             cs_set_player_weap_model(id, CSW_KNIFE, Sabers_Models[1])
  921.         }
  922.         else if((g_bPlasma[id]) && (ze_get_vip_flags(id) & VIP_B))
  923.         {
  924.             cs_set_player_view_model(id, CSW_KNIFE, Plasma_Models[0])
  925.             cs_set_player_weap_model(id, CSW_KNIFE, Plasma_Models[1])
  926.         }
  927.         else if((g_bStorm[id]) && (ze_get_vip_flags(id) & VIP_C))
  928.         {
  929.             cs_set_player_view_model(id, CSW_KNIFE, Storm_Models[0])
  930.             cs_set_player_weap_model(id, CSW_KNIFE, Storm_Models[1])
  931.         }
  932.         else if((g_bLaevateinn[id]) && (ze_get_vip_flags(id) & VIP_C))
  933.         {
  934.             cs_set_player_view_model(id, CSW_KNIFE, Laevateinn_Models[0])
  935.             cs_set_player_weap_model(id, CSW_KNIFE, Laevateinn_Models[1])
  936.         }
  937.         else if((g_bWarHammer_Dark_Knight[id]) && (ze_get_vip_flags(id) & VIP_C))
  938.         {
  939.             cs_set_player_view_model(id, CSW_KNIFE, WarHammer_Dark_Knight_Models[0])
  940.             cs_set_player_weap_model(id, CSW_KNIFE, WarHammer_Dark_Knight_Models[1])
  941.         }
  942.         else if((g_bBalrog_Kosa[id]) && (ze_get_vip_flags(id) & VIP_C))
  943.         {
  944.             cs_set_player_view_model(id, CSW_KNIFE, Balrog_Kosa_Models[0])
  945.             cs_set_player_weap_model(id, CSW_KNIFE, Balrog_Kosa_Models[1])
  946.         }
  947.         else
  948.         {
  949.             cs_reset_player_view_model(id, CSW_KNIFE)
  950.             cs_reset_player_weap_model(id, CSW_KNIFE)
  951.         }
  952.     }
  953. }
  954.  
  955. public Fw_RestMaxSpeed_Post(id)
  956. {
  957.     set_task(0.1, "DelaySettingSpeed", id)
  958. }
  959.  
  960. public DelaySettingSpeed(id)
  961. {
  962.     new iWpnId = get_user_weapon(id)
  963.    
  964.     if (iWpnId == CSW_KNIFE && g_bCompat[id])
  965.     {
  966.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  967.         {
  968.             new iFlags = get_entvar(id, var_flags);
  969.             new iWaterlvl = get_entvar(id, var_waterlevel)
  970.            
  971.             if (!(iFlags & FL_ONGROUND))
  972.                 return
  973.  
  974.             if (iFlags & FL_WATERJUMP)
  975.                 return
  976.  
  977.             if (iWaterlvl > 1)
  978.                 return
  979.            
  980.             new Float:flVelocity[3]
  981.             get_entvar(id , var_velocity , flVelocity)
  982.  
  983.             flVelocity[2] += 325
  984.  
  985.             set_entvar(id , var_velocity , flVelocity)
  986.  
  987.             set_entvar(id, var_gaitsequence, 6)
  988.         }
  989.        
  990.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_compat))
  991.     }
  992.     else if (iWpnId == CSW_KNIFE && g_bStrong[id])
  993.     {
  994.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  995.         {
  996.             new iFlags = get_entvar(id, var_flags);
  997.             new iWaterlvl = get_entvar(id, var_waterlevel)
  998.            
  999.             if (!(iFlags & FL_ONGROUND))
  1000.                 return
  1001.  
  1002.             if (iFlags & FL_WATERJUMP)
  1003.                 return
  1004.  
  1005.             if (iWaterlvl > 1)
  1006.                 return
  1007.            
  1008.             new Float:flVelocity[3]
  1009.             get_entvar(id , var_velocity , flVelocity)
  1010.  
  1011.             flVelocity[2] += 325
  1012.  
  1013.             set_entvar(id , var_velocity , flVelocity)
  1014.  
  1015.             set_entvar(id, var_gaitsequence, 6)
  1016.         }
  1017.        
  1018.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_strong))
  1019.     }
  1020.     else if (iWpnId == CSW_KNIFE && g_bKatana[id])
  1021.     {
  1022.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1023.         {
  1024.             new iFlags = get_entvar(id, var_flags);
  1025.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1026.            
  1027.             if (!(iFlags & FL_ONGROUND))
  1028.                 return
  1029.  
  1030.             if (iFlags & FL_WATERJUMP)
  1031.                 return
  1032.  
  1033.             if (iWaterlvl > 1)
  1034.                 return
  1035.            
  1036.             new Float:flVelocity[3]
  1037.             get_entvar(id , var_velocity , flVelocity)
  1038.  
  1039.             flVelocity[2] += 325
  1040.  
  1041.             set_entvar(id , var_velocity , flVelocity)
  1042.  
  1043.             set_entvar(id, var_gaitsequence, 6)
  1044.         }
  1045.        
  1046.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_katana))
  1047.     }
  1048.     else if (iWpnId == CSW_KNIFE && g_bHammer[id])
  1049.     {
  1050.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1051.         {
  1052.             new iFlags = get_entvar(id, var_flags);
  1053.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1054.            
  1055.             if (!(iFlags & FL_ONGROUND))
  1056.                 return
  1057.  
  1058.             if (iFlags & FL_WATERJUMP)
  1059.                 return
  1060.  
  1061.             if (iWaterlvl > 1)
  1062.                 return
  1063.            
  1064.             new Float:flVelocity[3]
  1065.             get_entvar(id , var_velocity , flVelocity)
  1066.  
  1067.             flVelocity[2] += 325
  1068.  
  1069.             set_entvar(id , var_velocity , flVelocity)
  1070.  
  1071.             set_entvar(id, var_gaitsequence, 6)
  1072.         }
  1073.        
  1074.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_hammer))
  1075.     }
  1076.     else if (iWpnId == CSW_KNIFE && g_bTurbulent9[id])
  1077.     {
  1078.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1079.         {
  1080.             new iFlags = get_entvar(id, var_flags);
  1081.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1082.            
  1083.             if (!(iFlags & FL_ONGROUND))
  1084.                 return
  1085.  
  1086.             if (iFlags & FL_WATERJUMP)
  1087.                 return
  1088.  
  1089.             if (iWaterlvl > 1)
  1090.                 return
  1091.            
  1092.             new Float:flVelocity[3]
  1093.             get_entvar(id , var_velocity , flVelocity)
  1094.  
  1095.             flVelocity[2] += 325
  1096.  
  1097.             set_entvar(id , var_velocity , flVelocity)
  1098.  
  1099.             set_entvar(id, var_gaitsequence, 6)
  1100.         }
  1101.        
  1102.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_turb))
  1103.     }
  1104.     else if (iWpnId == CSW_KNIFE && g_bBio[id])
  1105.     {
  1106.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1107.         {
  1108.             new iFlags = get_entvar(id, var_flags);
  1109.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1110.            
  1111.             if (!(iFlags & FL_ONGROUND))
  1112.                 return
  1113.  
  1114.             if (iFlags & FL_WATERJUMP)
  1115.                 return
  1116.  
  1117.             if (iWaterlvl > 1)
  1118.                 return
  1119.            
  1120.             new Float:flVelocity[3]
  1121.             get_entvar(id , var_velocity , flVelocity)
  1122.  
  1123.             flVelocity[2] += 325
  1124.  
  1125.             set_entvar(id , var_velocity , flVelocity)
  1126.  
  1127.             set_entvar(id, var_gaitsequence, 6)
  1128.         }
  1129.        
  1130.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_bio))
  1131.     }
  1132.     else if (iWpnId == CSW_KNIFE && g_bSabers[id])
  1133.     {
  1134.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1135.         {
  1136.             new iFlags = get_entvar(id, var_flags);
  1137.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1138.            
  1139.             if (!(iFlags & FL_ONGROUND))
  1140.                 return
  1141.  
  1142.             if (iFlags & FL_WATERJUMP)
  1143.                 return
  1144.  
  1145.             if (iWaterlvl > 1)
  1146.                 return
  1147.            
  1148.             new Float:flVelocity[3]
  1149.             get_entvar(id , var_velocity , flVelocity)
  1150.  
  1151.             flVelocity[2] += 325
  1152.  
  1153.             set_entvar(id , var_velocity , flVelocity)
  1154.  
  1155.             set_entvar(id, var_gaitsequence, 6)
  1156.         }
  1157.        
  1158.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_sabers))
  1159.     }
  1160.     else if (iWpnId == CSW_KNIFE && g_bPlasma[id])
  1161.     {
  1162.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1163.         {
  1164.             new iFlags = get_entvar(id, var_flags);
  1165.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1166.            
  1167.             if (!(iFlags & FL_ONGROUND))
  1168.                 return
  1169.  
  1170.             if (iFlags & FL_WATERJUMP)
  1171.                 return
  1172.  
  1173.             if (iWaterlvl > 1)
  1174.                 return
  1175.            
  1176.             new Float:flVelocity[3]
  1177.             get_entvar(id , var_velocity , flVelocity)
  1178.  
  1179.             flVelocity[2] += 325
  1180.  
  1181.             set_entvar(id , var_velocity , flVelocity)
  1182.  
  1183.             set_entvar(id, var_gaitsequence, 6)
  1184.         }
  1185.        
  1186.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_plasma))
  1187.     }
  1188.     else if (iWpnId == CSW_KNIFE && g_bStorm[id])
  1189.     {
  1190.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1191.         {
  1192.             new iFlags = get_entvar(id, var_flags);
  1193.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1194.            
  1195.             if (!(iFlags & FL_ONGROUND))
  1196.                 return
  1197.  
  1198.             if (iFlags & FL_WATERJUMP)
  1199.                 return
  1200.  
  1201.             if (iWaterlvl > 1)
  1202.                 return
  1203.            
  1204.             new Float:flVelocity[3]
  1205.             get_entvar(id , var_velocity , flVelocity)
  1206.  
  1207.             flVelocity[2] += 325
  1208.  
  1209.             set_entvar(id , var_velocity , flVelocity)
  1210.  
  1211.             set_entvar(id, var_gaitsequence, 6)
  1212.         }
  1213.        
  1214.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_storm))
  1215.     }
  1216.     else if (iWpnId == CSW_KNIFE && g_bLaevateinn[id])
  1217.     {
  1218.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1219.         {
  1220.             new iFlags = get_entvar(id, var_flags);
  1221.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1222.            
  1223.             if (!(iFlags & FL_ONGROUND))
  1224.                 return
  1225.  
  1226.             if (iFlags & FL_WATERJUMP)
  1227.                 return
  1228.  
  1229.             if (iWaterlvl > 1)
  1230.                 return
  1231.            
  1232.             new Float:flVelocity[3]
  1233.             get_entvar(id , var_velocity , flVelocity)
  1234.  
  1235.             flVelocity[2] += 325
  1236.  
  1237.             set_entvar(id , var_velocity , flVelocity)
  1238.  
  1239.             set_entvar(id, var_gaitsequence, 6)
  1240.         }
  1241.        
  1242.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_laevat))
  1243.     }
  1244.     else if (iWpnId == CSW_KNIFE && g_bWarHammer_Dark_Knight[id])
  1245.     {
  1246.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1247.         {
  1248.             new iFlags = get_entvar(id, var_flags);
  1249.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1250.            
  1251.             if (!(iFlags & FL_ONGROUND))
  1252.                 return
  1253.  
  1254.             if (iFlags & FL_WATERJUMP)
  1255.                 return
  1256.  
  1257.             if (iWaterlvl > 1)
  1258.                 return
  1259.            
  1260.             new Float:flVelocity[3]
  1261.             get_entvar(id , var_velocity , flVelocity)
  1262.  
  1263.             flVelocity[2] += 325
  1264.  
  1265.             set_entvar(id , var_velocity , flVelocity)
  1266.  
  1267.             set_entvar(id, var_gaitsequence, 6)
  1268.         }
  1269.        
  1270.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_darknight))
  1271.     }
  1272.     else if (iWpnId == CSW_KNIFE && g_bBalrog_Kosa[id])
  1273.     {
  1274.         if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
  1275.         {
  1276.             new iFlags = get_entvar(id, var_flags);
  1277.             new iWaterlvl = get_entvar(id, var_waterlevel)
  1278.            
  1279.             if (!(iFlags & FL_ONGROUND))
  1280.                 return
  1281.  
  1282.             if (iFlags & FL_WATERJUMP)
  1283.                 return
  1284.  
  1285.             if (iWaterlvl > 1)
  1286.                 return
  1287.            
  1288.             new Float:flVelocity[3]
  1289.             get_entvar(id , var_velocity , flVelocity)
  1290.  
  1291.             flVelocity[2] += 325
  1292.  
  1293.             set_entvar(id , var_velocity , flVelocity)
  1294.  
  1295.             set_entvar(id, var_gaitsequence, 6)
  1296.         }
  1297.        
  1298.         set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_kosa))
  1299.     }
  1300. }
  1301.  
  1302. public DeathMsg(msg_id, msg_dest, id)
  1303. {
  1304.     static szTruncatedWeapon[33], iAttacker
  1305.     get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  1306.     iAttacker = get_msg_arg_int(1)
  1307.    
  1308.     if(!is_user_alive(iAttacker) || iAttacker == get_msg_arg_int(2) || !is_user_alive(get_msg_arg_int(2))) // get_msg_arg_int(2) = iVictim
  1309.         return
  1310.    
  1311.     if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iAttacker) & CSW_KNIFE)
  1312.     {
  1313.         if(g_bCompat[id])
  1314.         {
  1315.             set_msg_arg_string(4, "Combat knife")
  1316.         }
  1317.         else if(g_bStrong[id])
  1318.         {
  1319.             set_msg_arg_string(4, "Strong knife")
  1320.         }
  1321.         else if(g_bKatana[id])
  1322.         {
  1323.             set_msg_arg_string(4, "Katana knife")
  1324.         }
  1325.         else if(g_bHammer[id])
  1326.         {
  1327.             set_msg_arg_string(4, "Ice knife")
  1328.         }
  1329.         else if(g_bTurbulent9[id])
  1330.         {
  1331.             set_msg_arg_string(4, "Turbulent9 knife")
  1332.         }
  1333.         else if(g_bBio[id])
  1334.         {
  1335.             set_msg_arg_string(4, "Biohazard knife")
  1336.         }
  1337.         else if(g_bSabers[id])
  1338.         {
  1339.             set_msg_arg_string(4, "Sabers knife")
  1340.         }
  1341.         else if(g_bPlasma[id])
  1342.         {
  1343.             set_msg_arg_string(4, "Plasma knife")
  1344.         }
  1345.         else if(g_bStorm[id])
  1346.         {
  1347.             set_msg_arg_string(4, "Storm knife")
  1348.         }
  1349.         else if(g_bLaevateinn[id])
  1350.         {
  1351.             set_msg_arg_string(4, "Laevateinn knife")
  1352.         }
  1353.         else if(g_bWarHammer_Dark_Knight[id])
  1354.         {
  1355.             set_msg_arg_string(4, "WarHammer Dark Knight knife")
  1356.         }
  1357.         else if(g_bBalrog_Kosa[id])
  1358.         {
  1359.             set_msg_arg_string(4, "Balrog Kosa Knife")
  1360.         }
  1361.     }
  1362. }
  1363.  
  1364. stock fm_set_user_maxspeed(index, Float:speed = -1.0)
  1365. {
  1366.         engfunc(EngFunc_SetClientMaxspeed, index, speed);
  1367.         set_pev(index, pev_maxspeed, speed);
  1368.  
  1369.         return 1;
  1370. }  
  1371.  
  1372. public native_ze_open_knife_menu(id)
  1373. {
  1374.     Show_Knife_Menu(id)
  1375. }

The right approach is:

  1. public plugin_init()
  2. {
  3.     // Hook max speed reset (When user change his weapon)
  4.     RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "Fw_RestMaxSpeed_Post", 1)
  5. }
  6.  
  7. public Fw_RestMaxSpeed_Post(id)
  8. {
  9.     // Delay setting your speed
  10.     set_task(0.1, "DelaySettingSpeed", id)
  11. }
  12.  
  13. public DelaySettingSpeed(id)
  14. {
  15.     new iWpnId = get_user_weapon(id)
  16.    
  17.     if (iWpnId == ANYTHING)
  18.     {
  19.         set_entvar(id, var_maxspeed, speed_as_float)
  20.     }
  21. }
You sure still same problem?

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1717
Joined: 1 Year Ago
Location: Egypt
Has thanked: 28 times
Been thanked: 78 times
Age: 21
Contact:

#34

Post by Raheem » 3 Months Ago

Yes this approach working without problems, code i tested here:

Code: Select all

#include <zombie_escape>
#include <engine>
#include <fun>
 
// Models
new const Compat_Models[][] =
{
    "models/zombie_escape/v_combat_knife.mdl",
    "models/zombie_escape/p_combat_knife.mdl"
}
 
new const Strong_Models[][] =
{
    "models/zombie_escape/v_strong_knife.mdl",
    "models/zombie_escape/p_strong_knife.mdl"
}
 
new const Katana_Models[][] =
{
    "models/zombie_escape/v_katana_knife.mdl",
    "models/zombie_escape/p_katana_knife.mdl"
}
 
new const Hammer_Models[][] =
{
    "models/zombie_escape/v_hammer_knife.mdl",
    "models/zombie_escape/p_hammer_knife.mdl"
}
 
new const Turbulent9_Models[][] =
{
    "models/zombie_escape/v_turbulent9_knife.mdl",
    "models/zombie_escape/p_turbulent9_knife.mdl"
}
 
new const Bio_Models[][] =
{
    "models/zombie_escape/v_bio_knife.mdl",
    "models/zombie_escape/p_bio_knife.mdl"
}
 
new const Sabers_Models[][] =
{
    "models/zombie_escape/v_laser_knife.mdl",
    "models/zombie_escape/p_laser_knife.mdl"
}
 
new const Plasma_Models[][] =
{
    "models/zombie_escape/v_plasma_knife.mdl",
    "models/zombie_escape/p_plasma_knife.mdl"
}
 
new const Storm_Models[][] =
{
    "models/zombie_escape/v_storm_sword_knife.mdl",
    "models/zombie_escape/p_storm_sword_knife.mdl"
}
 
new const Laevateinn_Models[][] =
{
    "models/zombie_escape/v_laevateinn_knife.mdl",
    "models/zombie_escape/p_laevateinn_knife.mdl"
}
 
new const WarHammer_Dark_Knight_Models[][] =
{
    "models/zombie_escape/v_WarHammer_dark_knight_knife.mdl",
    "models/zombie_escape/p_WarHammer_dark_knight_knife.mdl"
}
 
new const Balrog_Kosa_Models[][] =
{
    "models/zombie_escape/v_balrog_kosa_knife.mdl",
    "models/zombie_escape/p_balrog_kosa_knife.mdl"
}
 
// Sounds
new const g_sound_knife[] = "items/gunpickup2.wav"
 
new const combat_sounds[][] =
{
    "zombie_escape/knife_menu/combat_deploy.wav",
    "zombie_escape/knife_menu/combat_hit.wav",
    "zombie_escape/knife_menu/combat_hit.wav",
    "zombie_escape/knife_menu/combat_hit.wav",
    "zombie_escape/knife_menu/combat_hit.wav",
    "zombie_escape/knife_menu/combat_hitwall.wav",
    "zombie_escape/knife_menu/combat_slash.wav",
    "zombie_escape/knife_menu/combat_slash.wav",
    "zombie_escape/knife_menu/combat_stab.wav"
}
 
new const strong_sounds[][] =
{
    "zombie_escape/knife_menu/strong_deploy.wav",
    "zombie_escape/knife_menu/strong_hit.wav",
    "zombie_escape/knife_menu/strong_hit.wav",
    "zombie_escape/knife_menu/strong_hit.wav",
    "zombie_escape/knife_menu/strong_hit.wav",
    "zombie_escape/knife_menu/strong_hitwall.wav",
    "zombie_escape/knife_menu/strong_slash.wav",
    "zombie_escape/knife_menu/strong_slash.wav",
    "zombie_escape/knife_menu/strong_stab.wav"
}
 
new const katana_sounds[][] =
{
    "zombie_escape/knife_menu/katana_deploy.wav",
    "zombie_escape/knife_menu/katana_hit.wav",
    "zombie_escape/knife_menu/katana_hit.wav",
    "zombie_escape/knife_menu/katana_hit.wav",
    "zombie_escape/knife_menu/katana_hit.wav",
    "zombie_escape/knife_menu/katana_hitwall.wav",
    "zombie_escape/knife_menu/katana_slash.wav",
    "zombie_escape/knife_menu/katana_slash.wav",
    "zombie_escape/knife_menu/katana_stab.wav"
}
 
new const hammer_sounds[][] =
{
    "zombie_escape/knife_menu/hammer_deploy.wav",
    "zombie_escape/knife_menu/hammer_hit.wav",
    "zombie_escape/knife_menu/hammer_hit.wav",
    "zombie_escape/knife_menu/hammer_hit.wav",
    "zombie_escape/knife_menu/hammer_hit.wav",
    "zombie_escape/knife_menu/hammer_hitwall.wav",
    "zombie_escape/knife_menu/hammer_slash.wav",
    "zombie_escape/knife_menu/hammer_slash.wav",
    "zombie_escape/knife_menu/hammer_stab.wav"
}
 
new const turbulent9_sounds[][] =
{
    "zombie_escape/knife_menu/turbulent9_deploy.wav",
    "zombie_escape/knife_menu/turbulent9_hit.wav",
    "zombie_escape/knife_menu/turbulent9_hit.wav",
    "zombie_escape/knife_menu/turbulent9_hit.wav",
    "zombie_escape/knife_menu/turbulent9_hit.wav",
    "zombie_escape/knife_menu/turbulent9_hitwall.wav",
    "zombie_escape/knife_menu/turbulent9_slash.wav",
    "zombie_escape/knife_menu/turbulent9_slash.wav",
    "zombie_escape/knife_menu/turbulent9_stab.wav"
}
 
new const bio_sounds[][] =
{
    "zombie_escape/knife_menu/bio_deploy.wav",
    "zombie_escape/knife_menu/bio_hit.wav",
    "zombie_escape/knife_menu/bio_hit.wav",
    "zombie_escape/knife_menu/bio_hit.wav",
    "zombie_escape/knife_menu/bio_hit.wav",
    "zombie_escape/knife_menu/bio_hitwall.wav",
    "zombie_escape/knife_menu/bio_slash.wav",
    "zombie_escape/knife_menu/bio_slash.wav",
    "zombie_escape/knife_menu/bio_stab.wav"
}
 
new const sabers_sounds[][] =
{
    "zombie_escape/knife_menu/laser_deploy.wav",
    "zombie_escape/knife_menu/laser_hit.wav",
    "zombie_escape/knife_menu/laser_hit.wav",
    "zombie_escape/knife_menu/laser_hit.wav",
    "zombie_escape/knife_menu/laser_hit.wav",
    "zombie_escape/knife_menu/laser_hitwall.wav",
    "zombie_escape/knife_menu/laser_slash1.wav",
    "zombie_escape/knife_menu/laser_slash2.wav",
    "zombie_escape/knife_menu/laser_stab.wav"
}
 
new const plasma_sounds[][] =
{
    "zombie_escape/knife_menu/plasma_deploy.wav",
    "zombie_escape/knife_menu/plasma_hit.wav",
    "zombie_escape/knife_menu/plasma_hit.wav",
    "zombie_escape/knife_menu/plasma_hit.wav",
    "zombie_escape/knife_menu/plasma_hit.wav",
    "zombie_escape/knife_menu/plasma_hitwall.wav",
    "zombie_escape/knife_menu/plasma_slash.wav",
    "zombie_escape/knife_menu/plasma_slash.wav",
    "zombie_escape/knife_menu/plasma_stab.wav"
}
 
new const storm_sounds[][] =
{
    "zombie_escape/knife_menu/storm_sword_deploy.wav",
    "zombie_escape/knife_menu/storm_sword_hit.wav",
    "zombie_escape/knife_menu/storm_sword_hit.wav",
    "zombie_escape/knife_menu/storm_sword_hit.wav",
    "zombie_escape/knife_menu/storm_sword_hit.wav",
    "zombie_escape/knife_menu/storm_sword_hitwall.wav",
    "zombie_escape/knife_menu/storm_sword_slash.wav",
    "zombie_escape/knife_menu/storm_sword_slash.wav",
    "zombie_escape/knife_menu/storm_sword_stab.wav"
}
 
new const laevateinn_sounds[][] =
{
    "zombie_escape/knife_menu/laevateinn_deploy.wav",
    "zombie_escape/knife_menu/laevateinn_hit.wav",
    "zombie_escape/knife_menu/laevateinn_hit.wav",
    "zombie_escape/knife_menu/laevateinn_hit.wav",
    "zombie_escape/knife_menu/laevateinn_hit.wav",
    "zombie_escape/knife_menu/laevateinn_hitwall.wav",
    "zombie_escape/knife_menu/laevateinn_slash.wav",
    "zombie_escape/knife_menu/laevateinn_slash.wav",
    "zombie_escape/knife_menu/laevateinn_stab.wav"
}
 
new const warhammer_dark_knight_sounds[][] =
{
    "zombie_escape/knife_menu/WarHammer_dark_knight_deploy.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hitwall.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_slash.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_slash.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_stab.wav"
}
 
new const balrog_kosa_sounds[][] =
{
    "zombie_escape/knife_menu/balrog_kosa_deploy.wav",
    "zombie_escape/knife_menu/balrog_kosa_hit.wav",
    "zombie_escape/knife_menu/balrog_kosa_hit.wav",
    "zombie_escape/knife_menu/balrog_kosa_hit.wav",
    "zombie_escape/knife_menu/balrog_kosa_hit.wav",
    "zombie_escape/knife_menu/balrog_kosa_hitwall.wav",
    "zombie_escape/knife_menu/balrog_kosa_slash.wav",
    "zombie_escape/knife_menu/balrog_kosa_slash.wav",
    "zombie_escape/knife_menu/balrog_kosa_stab.wav"
}
 
new const oldknife_sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}
 
new bool:g_bCompat[33], bool:g_bStrong[33], bool:g_bKatana[33], bool:g_bHammer[33], bool:g_bTurbulent9[33], bool:g_bBio[33], bool:g_bSabers[33], bool:g_bPlasma[33],
bool:g_bStorm[33], bool:g_bLaevateinn[33], bool:g_bWarHammer_Dark_Knight[33], bool:g_bBalrog_Kosa[33], bool:g_bNoSpeed, g_iUsedTimes[33], g_pCvarUseTimes
 
new cvar_speed_compat
new cvar_speed_strong
new cvar_speed_katana
new cvar_speed_hammer
new cvar_speed_turb
new cvar_speed_bio
new cvar_speed_sabers
new cvar_speed_plasma
new cvar_speed_storm
new cvar_speed_laevat
new cvar_speed_darknight
new cvar_speed_kosa
 
/*public plugin_precache()
{
    new i
 
    for (i = 0; i <= charsmax(Compat_Models); i++)
        precache_model(Compat_Models[i])
 
    for (i = 0; i <= charsmax(Hammer_Models); i++)
        precache_model(Hammer_Models[i])
 
    for (i = 0; i <= charsmax(Katana_Models); i++)
        precache_model(Katana_Models[i])
 
    for (i = 0; i <= charsmax(Strong_Models); i++)
        precache_model(Strong_Models[i])
 
    for (i = 0; i <= charsmax(Turbulent9_Models); i++)
        precache_model(Turbulent9_Models[i])
 
    for (i = 0; i <= charsmax(Bio_Models); i++)
        precache_model(Bio_Models[i])
 
    for (i = 0; i <= charsmax(Sabers_Models); i++)
        precache_model(Sabers_Models[i])
 
    for (i = 0; i <= charsmax(Plasma_Models); i++)
        precache_model(Plasma_Models[i])
 
    for (i = 0; i <= charsmax(Storm_Models); i++)
        precache_model(Storm_Models[i])
 
    for (i = 0; i <= charsmax(Laevateinn_Models); i++)
        precache_model(Laevateinn_Models[i])
 
    for (i = 0; i <= charsmax(WarHammer_Dark_Knight_Models); i++)
        precache_model(WarHammer_Dark_Knight_Models[i])
 
    for (i = 0; i <= charsmax(Balrog_Kosa_Models); i++)
        precache_model(Balrog_Kosa_Models[i])
 
    for (i = 0; i <= charsmax(combat_sounds); i++)
        precache_sound(combat_sounds[i])
 
    for (i = 0; i <= charsmax(strong_sounds); i++)
        precache_sound(strong_sounds[i])
 
    for (i = 0; i <= charsmax(katana_sounds); i++)
        precache_sound(katana_sounds[i])
 
    for (i = 0; i <= charsmax(hammer_sounds); i++)
        precache_sound(hammer_sounds[i])
 
    for (i = 0; i <= charsmax(turbulent9_sounds); i++)
        precache_sound(turbulent9_sounds[i])
 
    for (i = 0; i <= charsmax(bio_sounds); i++)
        precache_sound(bio_sounds[i])
 
    for (i = 0; i <= charsmax(sabers_sounds); i++)
        precache_sound(sabers_sounds[i])
 
    for (i = 0; i <= charsmax(plasma_sounds); i++)
        precache_sound(plasma_sounds[i])
 
    for (i = 0; i <= charsmax(storm_sounds); i++)
        precache_sound(storm_sounds[i])
 
    for (i = 0; i <= charsmax(laevateinn_sounds); i++)
        precache_sound(laevateinn_sounds[i])
 
    for (i = 0; i <= charsmax(warhammer_dark_knight_sounds); i++)
        precache_sound(warhammer_dark_knight_sounds[i])
 
    for (i = 0; i <= charsmax(balrog_kosa_sounds); i++)
        precache_sound(balrog_kosa_sounds[i])
 
    precache_sound(g_sound_knife)
}*/
 
public plugin_natives()
{
    register_native("ze_open_knife_menu", "native_ze_open_knife_menu", 1)
}
 
public plugin_init()
{
    register_plugin("[ZE] Addon: Knife Menu", "1.2", "Jack GamePlay")
 
    //register_forward(FM_EmitSound, "fw_EmitSound")
    //register_forward(FM_PlayerPreThink, "fw_PlayerPreThink");
 
    //register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
    RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "Fw_RestMaxSpeed_Post", 1)
   
    g_pCvarUseTimes = register_cvar("ze_knife_menu_use_times", "1000")
 
    register_message(get_user_msgid("DeathMsg"), "DeathMsg")
 
    register_clcmd("say /k", "Show_Knife_Menu")
   
    cvar_speed_compat = register_cvar("ze_compat_speed", "400.0")
    cvar_speed_strong = register_cvar("ze_strong_speed", "270.0")
    cvar_speed_katana = register_cvar("ze_katana_speed", "270.0")
    cvar_speed_hammer = register_cvar("ze_hammer_speed", "270.0")
    cvar_speed_turb = register_cvar("ze_turb_speed", "275.0")    
    cvar_speed_bio = register_cvar("ze_bio_speed", "275.0")
    cvar_speed_sabers = register_cvar("ze_sabers_speed", "275.0")
    cvar_speed_plasma = register_cvar("ze_plasma_speed", "275.0")
    cvar_speed_storm = register_cvar("ze_storm_speed", "280.0")    
    cvar_speed_laevat = register_cvar("ze_laevat_speed", "280.0")  
    cvar_speed_darknight = register_cvar("ze_darknight_speed", "280.0")
    cvar_speed_kosa = register_cvar("ze_kosa_speed", "280.0")
}
 
public ze_user_humanized(id)
{
    g_iUsedTimes[id] = 0
}
 
public ze_user_infected(Victim)
{
    g_bCompat[Victim] = false
    g_bStrong[Victim] = false
    g_bKatana[Victim] = false
    g_bHammer[Victim] = false
    g_bTurbulent9[Victim] = false
    g_bBio[Victim] = false
    g_bSabers[Victim] = false
    g_bPlasma[Victim] = false
    g_bStorm[Victim] = false
    g_bLaevateinn[Victim] = false
    g_bWarHammer_Dark_Knight[Victim] = false
    g_bBalrog_Kosa[Victim] = false
    g_iUsedTimes[Victim] = 0
}
 
public client_putinserver(id)
{
    g_bCompat[id] = false
    g_bStrong[id] = false
    g_bKatana[id] = false
    g_bHammer[id] = false
    g_bTurbulent9[id] = false
    g_bBio[id] = false
    g_bSabers[id] = false
    g_bPlasma[id] = false
    g_bStorm[id] = false
    g_bLaevateinn[id] = false
    g_bWarHammer_Dark_Knight[id] = false
    g_bBalrog_Kosa[id] = false
    g_iUsedTimes[id] = 0
}
 
public client_disconnected(id)
{
    g_bCompat[id] = false
    g_bStrong[id] = false
    g_bKatana[id] = false
    g_bHammer[id] = false
    g_bTurbulent9[id] = false
    g_bBio[id] = false
    g_bSabers[id] = false
    g_bPlasma[id] = false
    g_bStorm[id] = false
    g_bLaevateinn[id] = false
    g_bWarHammer_Dark_Knight[id] = false
    g_bBalrog_Kosa[id] = false
    g_iUsedTimes[id] = 0
}
 
public Show_Knife_Menu(id)
{
    /*if (!is_user_connected(id))
        return PLUGIN_CONTINUE
 
    if (ze_is_user_zombie(id))
    {
        ze_colored_print(id, "!tZombies can't open knife menu!y.")
        return PLUGIN_HANDLED
    }
 
    if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
    {
        ze_colored_print(id, "!tYou can only open knife menu !y[!g%dx!y] per round!", get_pcvar_num(g_pCvarUseTimes))
        return PLUGIN_HANDLED
    }
 
    if (!is_user_alive(id))
    {
        ze_colored_print(id, "!tDead can't open knife menu!y.")
        return PLUGIN_HANDLED
    }*/
 
    Knife_Menu(id)
    return PLUGIN_CONTINUE
}
 
public Knife_Menu(id)
{
    new iMenu = menu_create("\rChoose Your Knife\w:", "Menu_Handler")
    menu_additem(iMenu, "\yCombat", "", 0)
    menu_additem(iMenu, "\yStrong", "", 0)
    menu_additem(iMenu, "\yKatana", "", 0)
    menu_additem(iMenu, "\yHammer", "", 0)
 
	menu_additem(iMenu, "\yTurbulent9 \r[VIP]", "", 0)
	menu_additem(iMenu, "\yBio Hazard \r[VIP]", "", 0)


	menu_additem(iMenu, "\ySabers \r[VIP+]", "", 0)
	menu_additem(iMenu, "\yPlasma \r[VIP+]", "", 0)


	menu_additem(iMenu, "\yStorm \r[VIP++]", "", 0)
	menu_additem(iMenu, "\yLaevateinn \r[VIP++]", "", 0)
	menu_additem(iMenu, "\yWarHammer Dark Night \r[VIP++]", "", 0)
	menu_additem(iMenu, "\yBalrog Kosa \r[VIP++]", "", 0)

    menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id, iMenu, 0)
}
 
public Menu_Handler(id, iMenu, iKey)
{
    if(!is_user_alive(id) || ze_is_user_zombie(id))
        return PLUGIN_HANDLED
       
    switch(iKey)
    {
        case 0: // Compat
        {
            g_bCompat[id] = true
            g_bStrong[id] = false
            g_bKatana[id] = false
            g_bHammer[id] = false
            g_bTurbulent9[id] = false
            g_bBio[id] = false
            g_bSabers[id] = false
            g_bPlasma[id] = false
            g_bStorm[id] = false
            g_bLaevateinn[id] = false
            g_bWarHammer_Dark_Knight[id] = false
            g_bBalrog_Kosa[id] = false
            g_iUsedTimes[id]++
            rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
			rg_reset_maxspeed(id)
            g_iUsedTimes[id]++
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
        case 1: // Strong
        {
            g_bCompat[id] = false
            g_bStrong[id] = true
            g_bKatana[id] = false
            g_bHammer[id] = false
            g_bTurbulent9[id] = false
            g_bBio[id] = false
            g_bSabers[id] = false
            g_bPlasma[id] = false
            g_bStorm[id] = false
            g_bLaevateinn[id] = false
            g_bWarHammer_Dark_Knight[id] = false
            g_bBalrog_Kosa[id] = false
            g_iUsedTimes[id]++
            rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            g_iUsedTimes[id]++
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
        case 2: // Katana
        {
            g_bCompat[id] = false
            g_bStrong[id] = false
            g_bKatana[id] = true
            g_bHammer[id] = false
            g_bTurbulent9[id] = false
            g_bBio[id] = false
            g_bSabers[id] = false
            g_bPlasma[id] = false
            g_bStorm[id] = false
            g_bLaevateinn[id] = false
            g_bWarHammer_Dark_Knight[id] = false
            g_bBalrog_Kosa[id] = false
            g_iUsedTimes[id]++
            /*rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            g_iUsedTimes[id]++
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
        }
        case 3: // Hammer
        {
            g_bCompat[id] = false
            g_bStrong[id] = false
            g_bKatana[id] = false
            g_bHammer[id] = true
            g_bTurbulent9[id] = false
            g_bBio[id] = false
            g_bSabers[id] = false
            g_bPlasma[id] = false
            g_bStorm[id] = false
            g_bLaevateinn[id] = false
            g_bWarHammer_Dark_Knight[id] = false
            g_bBalrog_Kosa[id] = false
            g_iUsedTimes[id]++
            /*rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            g_iUsedTimes[id]++
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
        }
        case 4: // Turbulent
        {

                g_bCompat[id] = false
                g_bStrong[id] = false
                g_bKatana[id] = false
                g_bHammer[id] = false
                g_bTurbulent9[id] = true
                g_bBio[id] = false
                g_bSabers[id] = false
                g_bPlasma[id] = false
                g_bStorm[id] = false
                g_bLaevateinn[id] = false
                g_bWarHammer_Dark_Knight[id] = false
                g_bBalrog_Kosa[id] = false
                g_iUsedTimes[id]++
                /*rg_remove_item(id, "weapon_knife")
                rg_give_item(id, "weapon_knife", GT_APPEND)
                engclient_cmd(id, "weapon_knife")
                g_iUsedTimes[id]++
                emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
            
        }
        case 5: // Bio
        {

                g_bCompat[id] = false
                g_bStrong[id] = false
                g_bKatana[id] = false
                g_bHammer[id] = false
                g_bTurbulent9[id] = false
                g_bBio[id] = true
                g_bSabers[id] = false
                g_bPlasma[id] = false
                g_bStorm[id] = false
                g_bLaevateinn[id] = false
                g_bWarHammer_Dark_Knight[id] = false
                g_bBalrog_Kosa[id] = false
                g_iUsedTimes[id]++
                /*rg_remove_item(id, "weapon_knife")
                rg_give_item(id, "weapon_knife", GT_APPEND)
                engclient_cmd(id, "weapon_knife")
                g_iUsedTimes[id]++
                emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
            
        }
        case 6: // Sabers
        {

                g_bCompat[id] = false
                g_bStrong[id] = false
                g_bKatana[id] = false
                g_bHammer[id] = false
                g_bTurbulent9[id] = false
                g_bBio[id] = false
                g_bSabers[id] = true
                g_bPlasma[id] = false
                g_bStorm[id] = false
                g_bLaevateinn[id] = false
                g_bWarHammer_Dark_Knight[id] = false
                g_bBalrog_Kosa[id] = false
                g_iUsedTimes[id]++
                /*rg_remove_item(id, "weapon_knife")
                rg_give_item(id, "weapon_knife", GT_APPEND)
                engclient_cmd(id, "weapon_knife")
                g_iUsedTimes[id]++
                emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
            
        }
        case 7: // Plasma
        {

                g_bCompat[id] = false
                g_bStrong[id] = false
                g_bKatana[id] = false
                g_bHammer[id] = false
                g_bTurbulent9[id] = false
                g_bBio[id] = false
                g_bSabers[id] = false
                g_bPlasma[id] = true
                g_bStorm[id] = false
                g_bLaevateinn[id] = false
                g_bWarHammer_Dark_Knight[id] = false
                g_bBalrog_Kosa[id] = false
                g_iUsedTimes[id]++
                /*rg_remove_item(id, "weapon_knife")
                rg_give_item(id, "weapon_knife", GT_APPEND)
                engclient_cmd(id, "weapon_knife")
                g_iUsedTimes[id]++
                emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
            
        }
        case 8: // Storm
        {

                g_bCompat[id] = false
                g_bStrong[id] = false
                g_bKatana[id] = false
                g_bHammer[id] = false
                g_bTurbulent9[id] = false
                g_bBio[id] = false
                g_bSabers[id] = false
                g_bPlasma[id] = false
                g_bStorm[id] = true
                g_bLaevateinn[id] = false
                g_bWarHammer_Dark_Knight[id] = false
                g_bBalrog_Kosa[id] = false
                g_iUsedTimes[id]++
                /*rg_remove_item(id, "weapon_knife")
                rg_give_item(id, "weapon_knife", GT_APPEND)
                engclient_cmd(id, "weapon_knife")
                g_iUsedTimes[id]++
                emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/

        }
        case 9: // Laevateinn
        {

                g_bCompat[id] = false
                g_bStrong[id] = false
                g_bKatana[id] = false
                g_bHammer[id] = false
                g_bTurbulent9[id] = false
                g_bBio[id] = false
                g_bSabers[id] = false
                g_bPlasma[id] = false
                g_bStorm[id] = false
                g_bLaevateinn[id] = true
                g_bWarHammer_Dark_Knight[id] = false
                g_bBalrog_Kosa[id] = false
                g_iUsedTimes[id]++
                /*rg_remove_item(id, "weapon_knife")
                rg_give_item(id, "weapon_knife", GT_APPEND)
                engclient_cmd(id, "weapon_knife")
                g_iUsedTimes[id]++
                emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/

        }
        case 10: // Warhammer Dark Night
        {

                g_bCompat[id] = false
                g_bStrong[id] = false
                g_bKatana[id] = false
                g_bHammer[id] = false
                g_bTurbulent9[id] = false
                g_bBio[id] = false
                g_bSabers[id] = false
                g_bPlasma[id] = false
                g_bStorm[id] = false
                g_bLaevateinn[id] = false
                g_bWarHammer_Dark_Knight[id] = true
                g_bBalrog_Kosa[id] = false
                g_iUsedTimes[id]++
                /*rg_remove_item(id, "weapon_knife")
                rg_give_item(id, "weapon_knife", GT_APPEND)
                engclient_cmd(id, "weapon_knife")
                g_iUsedTimes[id]++
                emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
       
        }
        case 11: // Balrog Kosa
        {

                g_bCompat[id] = false
                g_bStrong[id] = false
                g_bKatana[id] = false
                g_bHammer[id] = false
                g_bTurbulent9[id] = false
                g_bBio[id] = false
                g_bSabers[id] = false
                g_bPlasma[id] = false
                g_bStorm[id] = false
                g_bLaevateinn[id] = false
                g_bWarHammer_Dark_Knight[id] = false
                g_bBalrog_Kosa[id] = true
                g_iUsedTimes[id]++
                /*rg_remove_item(id, "weapon_knife")
                rg_give_item(id, "weapon_knife", GT_APPEND)
                engclient_cmd(id, "weapon_knife")
                g_iUsedTimes[id]++
                emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
            
        }
    }

    menu_destroy(iMenu)
    return PLUGIN_HANDLED
}
 
/*public fw_EmitSound(id, channel, const sound[])
{
    if(!is_user_alive(id) || ze_is_user_zombie(id))
        return FMRES_IGNORED
       
    new i
    for (i = 0; i <= charsmax(combat_sounds); i++)
    for (i = 0; i <= charsmax(strong_sounds); i++)
    for (i = 0; i <= charsmax(katana_sounds); i++)
    for (i = 0; i <= charsmax(hammer_sounds); i++)
    for (i = 0; i <= charsmax(turbulent9_sounds); i++)
    for (i = 0; i <= charsmax(bio_sounds); i++)
    for (i = 0; i <= charsmax(sabers_sounds); i++)
    for (i = 0; i <= charsmax(plasma_sounds); i++)
    for (i = 0; i <= charsmax(storm_sounds); i++)
    for (i = 0; i <= charsmax(laevateinn_sounds); i++)
    for (i = 0; i <= charsmax(warhammer_dark_knight_sounds); i++)
    for (i = 0; i <= charsmax(balrog_kosa_sounds); i++)
    {
        if(equal(sound, oldknife_sounds[i]))
        {
            if (g_bCompat[id])
            {
                emit_sound(id, channel, combat_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (g_bStrong[id])
            {
                emit_sound(id, channel, strong_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (g_bKatana[id])
            {
                emit_sound(id, channel, katana_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (g_bHammer[id])
            {
                emit_sound(id, channel, hammer_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if ((g_bTurbulent9[id]) && (ze_get_vip_flags(id) & VIP_A))
            {
                emit_sound(id, channel, turbulent9_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if ((g_bBio[id]) && (ze_get_vip_flags(id) & VIP_A))
            {
                emit_sound(id, channel, bio_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if ((g_bSabers[id]) && (ze_get_vip_flags(id) & VIP_B))
            {
                emit_sound(id, channel, sabers_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if ((g_bPlasma[id]) && (ze_get_vip_flags(id) & VIP_B))
            {
                emit_sound(id, channel, plasma_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if ((g_bStorm[id]) && (ze_get_vip_flags(id) & VIP_C))
            {
                emit_sound(id, channel, storm_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if ((g_bLaevateinn[id]) && (ze_get_vip_flags(id) & VIP_C))
            {
                emit_sound(id, channel, laevateinn_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if ((g_bWarHammer_Dark_Knight[id]) && (ze_get_vip_flags(id) & VIP_C))
            {
                emit_sound(id, channel, warhammer_dark_knight_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if ((g_bBalrog_Kosa[id]) && (ze_get_vip_flags(id) & VIP_C))
            {
                emit_sound(id, channel, balrog_kosa_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
            else if (!g_bCompat[id] || !g_bStrong[id] || !g_bKatana[id] || !g_bHammer[id] || !g_bTurbulent9[id] || !g_bBio[id] || !g_bSabers[id] || !g_bPlasma[id] || !g_bStorm[id] || !g_bLaevateinn[id] || !g_bWarHammer_Dark_Knight[id] || !g_bBalrog_Kosa[id])
            {
                emit_sound(id, channel, oldknife_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
                return FMRES_SUPERCEDE
            }
        }
    }
    return FMRES_IGNORED
}*/
 
/*public CurrentWeapon(id)
{
    if(!is_user_alive(id) || ze_is_user_zombie(id))
        return
       
    if(get_user_weapon(id) & CSW_KNIFE)
    {
        if(g_bCompat[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Compat_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Compat_Models[1])
        }
        else if(g_bStrong[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Strong_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Strong_Models[1])
        }
        else if(g_bKatana[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Katana_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Katana_Models[1])
        }
        else if(g_bHammer[id])
        {
            cs_set_player_view_model(id, CSW_KNIFE, Hammer_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Hammer_Models[1])
        }
        else if((g_bTurbulent9[id]) && (ze_get_vip_flags(id) & VIP_A))
        {
            cs_set_player_view_model(id, CSW_KNIFE, Turbulent9_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Turbulent9_Models[1])
        }
        else if((g_bBio[id]) && (ze_get_vip_flags(id) & VIP_A))
        {
            cs_set_player_view_model(id, CSW_KNIFE, Bio_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Bio_Models[1])
        }
        else if((g_bSabers[id]) && (ze_get_vip_flags(id) & VIP_B))
        {
            cs_set_player_view_model(id, CSW_KNIFE, Sabers_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Sabers_Models[1])
        }
        else if((g_bPlasma[id]) && (ze_get_vip_flags(id) & VIP_B))
        {
            cs_set_player_view_model(id, CSW_KNIFE, Plasma_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Plasma_Models[1])
        }
        else if((g_bStorm[id]) && (ze_get_vip_flags(id) & VIP_C))
        {
            cs_set_player_view_model(id, CSW_KNIFE, Storm_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Storm_Models[1])
        }
        else if((g_bLaevateinn[id]) && (ze_get_vip_flags(id) & VIP_C))
        {
            cs_set_player_view_model(id, CSW_KNIFE, Laevateinn_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Laevateinn_Models[1])
        }
        else if((g_bWarHammer_Dark_Knight[id]) && (ze_get_vip_flags(id) & VIP_C))
        {
            cs_set_player_view_model(id, CSW_KNIFE, WarHammer_Dark_Knight_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, WarHammer_Dark_Knight_Models[1])
        }
        else if((g_bBalrog_Kosa[id]) && (ze_get_vip_flags(id) & VIP_C))
        {
            cs_set_player_view_model(id, CSW_KNIFE, Balrog_Kosa_Models[0])
            cs_set_player_weap_model(id, CSW_KNIFE, Balrog_Kosa_Models[1])
        }
        else
        {
            cs_reset_player_view_model(id, CSW_KNIFE)
            cs_reset_player_weap_model(id, CSW_KNIFE)
        }
    }
}*/
 
public Fw_RestMaxSpeed_Post(id)
{
	set_task(0.1, "DelayLoad", id)
	
    return HC_CONTINUE
}
 
public DelayLoad(id)
{
    new iWpnId = get_user_weapon(id)
   
    if (iWpnId == CSW_KNIFE && g_bCompat[id])
    {
        if ((get_entvar(id, var_button) & IN_JUMP) && !(get_entvar(id, var_oldbuttons) & IN_JUMP))
        {
            new iFlags = get_entvar(id, var_flags);
            new iWaterlvl = get_entvar(id, var_waterlevel)
           
            if (!(iFlags & FL_ONGROUND))
                return HC_CONTINUE
 
            if (iFlags & FL_WATERJUMP)
                return HAM_IGNORED
 
            if (iWaterlvl > 1)
                return HAM_IGNORED
           
            new Float:flVelocity[3]
            get_entvar(id , var_velocity , flVelocity)
 
            flVelocity[2] += 325
 
            set_entvar(id , var_velocity , flVelocity)
 
            set_entvar(id, var_gaitsequence, 6)
        }
       
        set_entvar(id, var_maxspeed, get_pcvar_float(cvar_speed_compat))
    }
}
 
public DeathMsg(msg_id, msg_dest, id)
{
    static szTruncatedWeapon[33], iAttacker
    get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
    iAttacker = get_msg_arg_int(1)
   
    if(!is_user_alive(iAttacker) || iAttacker == get_msg_arg_int(2) || !is_user_alive(get_msg_arg_int(2))) // get_msg_arg_int(2) = iVictim
        return
   
    if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iAttacker) & CSW_KNIFE)
    {
        if(g_bCompat[id])
        {
            set_msg_arg_string(4, "Combat knife")
        }
        else if(g_bStrong[id])
        {
            set_msg_arg_string(4, "Strong knife")
        }
        else if(g_bKatana[id])
        {
            set_msg_arg_string(4, "Katana knife")
        }
        else if(g_bHammer[id])
        {
            set_msg_arg_string(4, "Ice knife")
        }
        else if(g_bTurbulent9[id])
        {
            set_msg_arg_string(4, "Turbulent9 knife")
        }
        else if(g_bBio[id])
        {
            set_msg_arg_string(4, "Biohazard knife")
        }
        else if(g_bSabers[id])
        {
            set_msg_arg_string(4, "Sabers knife")
        }
        else if(g_bPlasma[id])
        {
            set_msg_arg_string(4, "Plasma knife")
        }
        else if(g_bStorm[id])
        {
            set_msg_arg_string(4, "Storm knife")
        }
        else if(g_bLaevateinn[id])
        {
            set_msg_arg_string(4, "Laevateinn knife")
        }
        else if(g_bWarHammer_Dark_Knight[id])
        {
            set_msg_arg_string(4, "WarHammer Dark Knight knife")
        }
        else if(g_bBalrog_Kosa[id])
        {
            set_msg_arg_string(4, "Balrog Kosa Knife")
        }
    }
}
 
stock fm_set_user_maxspeed(index, Float:speed = -1.0)
{
        engfunc(EngFunc_SetClientMaxspeed, index, speed);
        set_pev(index, pev_maxspeed, speed);
 
        return 1;
}  
 
public native_ze_open_knife_menu(id)
{
    Show_Knife_Menu(id)
}
You don't know? Learn and you will know.

User avatar
Mark
Senior Member
Senior Member
United States of America
Posts: 258
Joined: 3 Months Ago
Location: Des Moines/USA
Donation: 1x donated in total €10.00
Has thanked: 6 times
Been thanked: 19 times
Age: 33
Contact:

#35

Post by Mark » 3 Months Ago

Raheem wrote:
3 Months Ago
Yes this approach working without problems, code i tested here:

Code: Select all

#include <zombie_escape>
#include <engine>
#include <fun>
 
// Models
new const Compat_Models[][] =
{
    "models/zombie_escape/v_combat_knife.mdl",
    "models/zombie_escape/p_combat_knife.mdl"
}
 
new const Strong_Models[][] =
{
    "models/zombie_escape/v_strong_knife.mdl",
    "models/zombie_escape/p_strong_knife.mdl"
}
 
new const Katana_Models[][] =
{
    "models/zombie_escape/v_katana_knife.mdl",
    "models/zombie_escape/p_katana_knife.mdl"
}
 
new const Hammer_Models[][] =
{
    "models/zombie_escape/v_hammer_knife.mdl",
    "models/zombie_escape/p_hammer_knife.mdl"
}
 
new const Turbulent9_Models[][] =
{
    "models/zombie_escape/v_turbulent9_knife.mdl",
    "models/zombie_escape/p_turbulent9_knife.mdl"
}
 
new const Bio_Models[][] =
{
    "models/zombie_escape/v_bio_knife.mdl",
    "models/zombie_escape/p_bio_knife.mdl"
}
 
new const Sabers_Models[][] =
{
    "models/zombie_escape/v_laser_knife.mdl",
    "models/zombie_escape/p_laser_knife.mdl"
}
 
new const Plasma_Models[][] =
{
    "models/zombie_escape/v_plasma_knife.mdl",
    "models/zombie_escape/p_plasma_knife.mdl"
}
 
new const Storm_Models[][] =
{
    "models/zombie_escape/v_storm_sword_knife.mdl",
    "models/zombie_escape/p_storm_sword_knife.mdl"
}
 
new const Laevateinn_Models[][] =
{
    "models/zombie_escape/v_laevateinn_knife.mdl",
    "models/zombie_escape/p_laevateinn_knife.mdl"
}
 
new const WarHammer_Dark_Knight_Models[][] =
{
    "models/zombie_escape/v_WarHammer_dark_knight_knife.mdl",
    "models/zombie_escape/p_WarHammer_dark_knight_knife.mdl"
}
 
new const Balrog_Kosa_Models[][] =
{
    "models/zombie_escape/v_balrog_kosa_knife.mdl",
    "models/zombie_escape/p_balrog_kosa_knife.mdl"
}
 
// Sounds
new const g_sound_knife[] = "items/gunpickup2.wav"
 
new const combat_sounds[][] =
{
    "zombie_escape/knife_menu/combat_deploy.wav",
    "zombie_escape/knife_menu/combat_hit.wav",
    "zombie_escape/knife_menu/combat_hit.wav",
    "zombie_escape/knife_menu/combat_hit.wav",
    "zombie_escape/knife_menu/combat_hit.wav",
    "zombie_escape/knife_menu/combat_hitwall.wav",
    "zombie_escape/knife_menu/combat_slash.wav",
    "zombie_escape/knife_menu/combat_slash.wav",
    "zombie_escape/knife_menu/combat_stab.wav"
}
 
new const strong_sounds[][] =
{
    "zombie_escape/knife_menu/strong_deploy.wav",
    "zombie_escape/knife_menu/strong_hit.wav",
    "zombie_escape/knife_menu/strong_hit.wav",
    "zombie_escape/knife_menu/strong_hit.wav",
    "zombie_escape/knife_menu/strong_hit.wav",
    "zombie_escape/knife_menu/strong_hitwall.wav",
    "zombie_escape/knife_menu/strong_slash.wav",
    "zombie_escape/knife_menu/strong_slash.wav",
    "zombie_escape/knife_menu/strong_stab.wav"
}
 
new const katana_sounds[][] =
{
    "zombie_escape/knife_menu/katana_deploy.wav",
    "zombie_escape/knife_menu/katana_hit.wav",
    "zombie_escape/knife_menu/katana_hit.wav",
    "zombie_escape/knife_menu/katana_hit.wav",
    "zombie_escape/knife_menu/katana_hit.wav",
    "zombie_escape/knife_menu/katana_hitwall.wav",
    "zombie_escape/knife_menu/katana_slash.wav",
    "zombie_escape/knife_menu/katana_slash.wav",
    "zombie_escape/knife_menu/katana_stab.wav"
}
 
new const hammer_sounds[][] =
{
    "zombie_escape/knife_menu/hammer_deploy.wav",
    "zombie_escape/knife_menu/hammer_hit.wav",
    "zombie_escape/knife_menu/hammer_hit.wav",
    "zombie_escape/knife_menu/hammer_hit.wav",
    "zombie_escape/knife_menu/hammer_hit.wav",
    "zombie_escape/knife_menu/hammer_hitwall.wav",
    "zombie_escape/knife_menu/hammer_slash.wav",
    "zombie_escape/knife_menu/hammer_slash.wav",
    "zombie_escape/knife_menu/hammer_stab.wav"
}
 
new const turbulent9_sounds[][] =
{
    "zombie_escape/knife_menu/turbulent9_deploy.wav",
    "zombie_escape/knife_menu/turbulent9_hit.wav",
    "zombie_escape/knife_menu/turbulent9_hit.wav",
    "zombie_escape/knife_menu/turbulent9_hit.wav",
    "zombie_escape/knife_menu/turbulent9_hit.wav",
    "zombie_escape/knife_menu/turbulent9_hitwall.wav",
    "zombie_escape/knife_menu/turbulent9_slash.wav",
    "zombie_escape/knife_menu/turbulent9_slash.wav",
    "zombie_escape/knife_menu/turbulent9_stab.wav"
}
 
new const bio_sounds[][] =
{
    "zombie_escape/knife_menu/bio_deploy.wav",
    "zombie_escape/knife_menu/bio_hit.wav",
    "zombie_escape/knife_menu/bio_hit.wav",
    "zombie_escape/knife_menu/bio_hit.wav",
    "zombie_escape/knife_menu/bio_hit.wav",
    "zombie_escape/knife_menu/bio_hitwall.wav",
    "zombie_escape/knife_menu/bio_slash.wav",
    "zombie_escape/knife_menu/bio_slash.wav",
    "zombie_escape/knife_menu/bio_stab.wav"
}
 
new const sabers_sounds[][] =
{
    "zombie_escape/knife_menu/laser_deploy.wav",
    "zombie_escape/knife_menu/laser_hit.wav",
    "zombie_escape/knife_menu/laser_hit.wav",
    "zombie_escape/knife_menu/laser_hit.wav",
    "zombie_escape/knife_menu/laser_hit.wav",
    "zombie_escape/knife_menu/laser_hitwall.wav",
    "zombie_escape/knife_menu/laser_slash1.wav",
    "zombie_escape/knife_menu/laser_slash2.wav",
    "zombie_escape/knife_menu/laser_stab.wav"
}
 
new const plasma_sounds[][] =
{
    "zombie_escape/knife_menu/plasma_deploy.wav",
    "zombie_escape/knife_menu/plasma_hit.wav",
    "zombie_escape/knife_menu/plasma_hit.wav",
    "zombie_escape/knife_menu/plasma_hit.wav",
    "zombie_escape/knife_menu/plasma_hit.wav",
    "zombie_escape/knife_menu/plasma_hitwall.wav",
    "zombie_escape/knife_menu/plasma_slash.wav",
    "zombie_escape/knife_menu/plasma_slash.wav",
    "zombie_escape/knife_menu/plasma_stab.wav"
}
 
new const storm_sounds[][] =
{
    "zombie_escape/knife_menu/storm_sword_deploy.wav",
    "zombie_escape/knife_menu/storm_sword_hit.wav",
    "zombie_escape/knife_menu/storm_sword_hit.wav",
    "zombie_escape/knife_menu/storm_sword_hit.wav",
    "zombie_escape/knife_menu/storm_sword_hit.wav",
    "zombie_escape/knife_menu/storm_sword_hitwall.wav",
    "zombie_escape/knife_menu/storm_sword_slash.wav",
    "zombie_escape/knife_menu/storm_sword_slash.wav",
    "zombie_escape/knife_menu/storm_sword_stab.wav"
}
 
new const laevateinn_sounds[][] =
{
    "zombie_escape/knife_menu/laevateinn_deploy.wav",
    "zombie_escape/knife_menu/laevateinn_hit.wav",
    "zombie_escape/knife_menu/laevateinn_hit.wav",
    "zombie_escape/knife_menu/laevateinn_hit.wav",
    "zombie_escape/knife_menu/laevateinn_hit.wav",
    "zombie_escape/knife_menu/laevateinn_hitwall.wav",
    "zombie_escape/knife_menu/laevateinn_slash.wav",
    "zombie_escape/knife_menu/laevateinn_slash.wav",
    "zombie_escape/knife_menu/laevateinn_stab.wav"
}
 
new const warhammer_dark_knight_sounds[][] =
{
    "zombie_escape/knife_menu/WarHammer_dark_knight_deploy.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hit.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_hitwall.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_slash.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_slash.wav",
    "zombie_escape/knife_menu/WarHammer_dark_knight_stab.wav"
}
 
new const balrog_kosa_sounds[][] =
{
    "zombie_escape/knife_menu/balrog_kosa_deploy.wav",
    "zombie_escape/knife_menu/balrog_kosa_hit.wav",
    "zombie_escape/knife_menu/balrog_kosa_hit.wav",
    "zombie_escape/knife_menu/balrog_kosa_hit.wav",
    "zombie_escape/knife_menu/balrog_kosa_hit.wav",
    "zombie_escape/knife_menu/balrog_kosa_hitwall.wav",
    "zombie_escape/knife_menu/balrog_kosa_slash.wav",
    "zombie_escape/knife_menu/balrog_kosa_slash.wav",
    "zombie_escape/knife_menu/balrog_kosa_stab.wav"
}
 
new const oldknife_sounds[][] =
{
    "weapons/knife_deploy1.wav",
    "weapons/knife_hit1.wav",
    "weapons/knife_hit2.wav",
    "weapons/knife_hit3.wav",
    "weapons/knife_hit4.wav",
    "weapons/knife_hitwall1.wav",
    "weapons/knife_slash1.wav",
    "weapons/knife_slash2.wav",
    "weapons/knife_stab.wav"
}
 
new bool:g_bCompat[33], bool:g_bStrong[33], bool:g_bKatana[33], bool:g_bHammer[33], bool:g_bTurbulent9[33], bool:g_bBio[33], bool:g_bSabers[33], bool:g_bPlasma[33],
bool:g_bStorm[33], bool:g_bLaevateinn[33], bool:g_bWarHammer_Dark_Knight[33], bool:g_bBalrog_Kosa[33], bool:g_bNoSpeed, g_iUsedTimes[33], g_pCvarUseTimes
 
new cvar_speed_compat
new cvar_speed_strong
new cvar_speed_katana
new cvar_speed_hammer
new cvar_speed_turb
new cvar_speed_bio
new cvar_speed_sabers
new cvar_speed_plasma
new cvar_speed_storm
new cvar_speed_laevat
new cvar_speed_darknight
new cvar_speed_kosa
 
/*public plugin_precache()
{
    new i
 
    for (i = 0; i <= charsmax(Compat_Models); i++)
        precache_model(Compat_Models[i])
 
    for (i = 0; i <= charsmax(Hammer_Models); i++)
        precache_model(Hammer_Models[i])
 
    for (i = 0; i <= charsmax(Katana_Models); i++)
        precache_model(Katana_Models[i])
 
    for (i = 0; i <= charsmax(Strong_Models); i++)
        precache_model(Strong_Models[i])
 
    for (i = 0; i <= charsmax(Turbulent9_Models); i++)
        precache_model(Turbulent9_Models[i])
 
    for (i = 0; i <= charsmax(Bio_Models); i++)
        precache_model(Bio_Models[i])
 
    for (i = 0; i <= charsmax(Sabers_Models); i++)
        precache_model(Sabers_Models[i])
 
    for (i = 0; i <= charsmax(Plasma_Models); i++)
        precache_model(Plasma_Models[i])
 
    for (i = 0; i <= charsmax(Storm_Models); i++)
        precache_model(Storm_Models[i])
 
    for (i = 0; i <= charsmax(Laevateinn_Models); i++)
        precache_model(Laevateinn_Models[i])
 
    for (i = 0; i <= charsmax(WarHammer_Dark_Knight_Models); i++)
        precache_model(WarHammer_Dark_Knight_Models[i])
 
    for (i = 0; i <= charsmax(Balrog_Kosa_Models); i++)
        precache_model(Balrog_Kosa_Models[i])
 
    for (i = 0; i <= charsmax(combat_sounds); i++)
        precache_sound(combat_sounds[i])
 
    for (i = 0; i <= charsmax(strong_sounds); i++)
        precache_sound(strong_sounds[i])
 
    for (i = 0; i <= charsmax(katana_sounds); i++)
        precache_sound(katana_sounds[i])
 
    for (i = 0; i <= charsmax(hammer_sounds); i++)
        precache_sound(hammer_sounds[i])
 
    for (i = 0; i <= charsmax(turbulent9_sounds); i++)
        precache_sound(turbulent9_sounds[i])
 
    for (i = 0; i <= charsmax(bio_sounds); i++)
        precache_sound(bio_sounds[i])
 
    for (i = 0; i <= charsmax(sabers_sounds); i++)
        precache_sound(sabers_sounds[i])
 
    for (i = 0; i <= charsmax(plasma_sounds); i++)
        precache_sound(plasma_sounds[i])
 
    for (i = 0; i <= charsmax(storm_sounds); i++)
        precache_sound(storm_sounds[i])
 
    for (i = 0; i <= charsmax(laevateinn_sounds); i++)
        precache_sound(laevateinn_sounds[i])
 
    for (i = 0; i <= charsmax(warhammer_dark_knight_sounds); i++)
        precache_sound(warhammer_dark_knight_sounds[i])
 
    for (i = 0; i <= charsmax(balrog_kosa_sounds); i++)
        precache_sound(balrog_kosa_sounds[i])
 
    precache_sound(g_sound_knife)
}*/
 
public plugin_natives()
{
    register_native("ze_open_knife_menu", "native_ze_open_knife_menu", 1)
}
 
public plugin_init()
{
    register_plugin("[ZE] Addon: Knife Menu", "1.2", "Jack GamePlay")
 
    //register_forward(FM_EmitSound, "fw_EmitSound")
    //register_forward(FM_PlayerPreThink, "fw_PlayerPreThink");
 
    //register_event("CurWeapon", "CurrentWeapon", "be", "1=1")
    RegisterHookChain(RG_CBasePlayer_ResetMaxSpeed, "Fw_RestMaxSpeed_Post", 1)
   
    g_pCvarUseTimes = register_cvar("ze_knife_menu_use_times", "1000")
 
    register_message(get_user_msgid("DeathMsg"), "DeathMsg")
 
    register_clcmd("say /k", "Show_Knife_Menu")
   
    cvar_speed_compat = register_cvar("ze_compat_speed", "400.0")
    cvar_speed_strong = register_cvar("ze_strong_speed", "270.0")
    cvar_speed_katana = register_cvar("ze_katana_speed", "270.0")
    cvar_speed_hammer = register_cvar("ze_hammer_speed", "270.0")
    cvar_speed_turb = register_cvar("ze_turb_speed", "275.0")    
    cvar_speed_bio = register_cvar("ze_bio_speed", "275.0")
    cvar_speed_sabers = register_cvar("ze_sabers_speed", "275.0")
    cvar_speed_plasma = register_cvar("ze_plasma_speed", "275.0")
    cvar_speed_storm = register_cvar("ze_storm_speed", "280.0")    
    cvar_speed_laevat = register_cvar("ze_laevat_speed", "280.0")  
    cvar_speed_darknight = register_cvar("ze_darknight_speed", "280.0")
    cvar_speed_kosa = register_cvar("ze_kosa_speed", "280.0")
}
 
public ze_user_humanized(id)
{
    g_iUsedTimes[id] = 0
}
 
public ze_user_infected(Victim)
{
    g_bCompat[Victim] = false
    g_bStrong[Victim] = false
    g_bKatana[Victim] = false
    g_bHammer[Victim] = false
    g_bTurbulent9[Victim] = false
    g_bBio[Victim] = false
    g_bSabers[Victim] = false
    g_bPlasma[Victim] = false
    g_bStorm[Victim] = false
    g_bLaevateinn[Victim] = false
    g_bWarHammer_Dark_Knight[Victim] = false
    g_bBalrog_Kosa[Victim] = false
    g_iUsedTimes[Victim] = 0
}
 
public client_putinserver(id)
{
    g_bCompat[id] = false
    g_bStrong[id] = false
    g_bKatana[id] = false
    g_bHammer[id] = false
    g_bTurbulent9[id] = false
    g_bBio[id] = false
    g_bSabers[id] = false
    g_bPlasma[id] = false
    g_bStorm[id] = false
    g_bLaevateinn[id] = false
    g_bWarHammer_Dark_Knight[id] = false
    g_bBalrog_Kosa[id] = false
    g_iUsedTimes[id] = 0
}
 
public client_disconnected(id)
{
    g_bCompat[id] = false
    g_bStrong[id] = false
    g_bKatana[id] = false
    g_bHammer[id] = false
    g_bTurbulent9[id] = false
    g_bBio[id] = false
    g_bSabers[id] = false
    g_bPlasma[id] = false
    g_bStorm[id] = false
    g_bLaevateinn[id] = false
    g_bWarHammer_Dark_Knight[id] = false
    g_bBalrog_Kosa[id] = false
    g_iUsedTimes[id] = 0
}
 
public Show_Knife_Menu(id)
{
    /*if (!is_user_connected(id))
        return PLUGIN_CONTINUE
 
    if (ze_is_user_zombie(id))
    {
        ze_colored_print(id, "!tZombies can't open knife menu!y.")
        return PLUGIN_HANDLED
    }
 
    if (g_iUsedTimes[id] >= get_pcvar_num(g_pCvarUseTimes))
    {
        ze_colored_print(id, "!tYou can only open knife menu !y[!g%dx!y] per round!", get_pcvar_num(g_pCvarUseTimes))
        return PLUGIN_HANDLED
    }
 
    if (!is_user_alive(id))
    {
        ze_colored_print(id, "!tDead can't open knife menu!y.")
        return PLUGIN_HANDLED
    }*/
 
    Knife_Menu(id)
    return PLUGIN_CONTINUE
}
 
public Knife_Menu(id)
{
    new iMenu = menu_create("\rChoose Your Knife\w:", "Menu_Handler")
    menu_additem(iMenu, "\yCombat", "", 0)
    menu_additem(iMenu, "\yStrong", "", 0)
    menu_additem(iMenu, "\yKatana", "", 0)
    menu_additem(iMenu, "\yHammer", "", 0)
 
	menu_additem(iMenu, "\yTurbulent9 \r[VIP]", "", 0)
	menu_additem(iMenu, "\yBio Hazard \r[VIP]", "", 0)


	menu_additem(iMenu, "\ySabers \r[VIP+]", "", 0)
	menu_additem(iMenu, "\yPlasma \r[VIP+]", "", 0)


	menu_additem(iMenu, "\yStorm \r[VIP++]", "", 0)
	menu_additem(iMenu, "\yLaevateinn \r[VIP++]", "", 0)
	menu_additem(iMenu, "\yWarHammer Dark Night \r[VIP++]", "", 0)
	menu_additem(iMenu, "\yBalrog Kosa \r[VIP++]", "", 0)

    menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
    menu_display(id, iMenu, 0)
}
 
public Menu_Handler(id, iMenu, iKey)
{
    if(!is_user_alive(id) || ze_is_user_zombie(id))
        return PLUGIN_HANDLED
       
    switch(iKey)
    {
        case 0: // Compat
        {
            g_bCompat[id] = true
            g_bStrong[id] = false
            g_bKatana[id] = false
            g_bHammer[id] = false
            g_bTurbulent9[id] = false
            g_bBio[id] = false
            g_bSabers[id] = false
            g_bPlasma[id] = false
            g_bStorm[id] = false
            g_bLaevateinn[id] = false
            g_bWarHammer_Dark_Knight[id] = false
            g_bBalrog_Kosa[id] = false
            g_iUsedTimes[id]++
            rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
			rg_reset_maxspeed(id)
            g_iUsedTimes[id]++
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
        case 1: // Strong
        {
            g_bCompat[id] = false
            g_bStrong[id] = true
            g_bKatana[id] = false
            g_bHammer[id] = false
            g_bTurbulent9[id] = false
            g_bBio[id] = false
            g_bSabers[id] = false
            g_bPlasma[id] = false
            g_bStorm[id] = false
            g_bLaevateinn[id] = false
            g_bWarHammer_Dark_Knight[id] = false
            g_bBalrog_Kosa[id] = false
            g_iUsedTimes[id]++
            rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            g_iUsedTimes[id]++
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
        }
        case 2: // Katana
        {
            g_bCompat[id] = false
            g_bStrong[id] = false
            g_bKatana[id] = true
            g_bHammer[id] = false
            g_bTurbulent9[id] = false
            g_bBio[id] = false
            g_bSabers[id] = false
            g_bPlasma[id] = false
            g_bStorm[id] = false
            g_bLaevateinn[id] = false
            g_bWarHammer_Dark_Knight[id] = false
            g_bBalrog_Kosa[id] = false
            g_iUsedTimes[id]++
            /*rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            g_iUsedTimes[id]++
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
        }
        case 3: // Hammer
        {
            g_bCompat[id] = false
            g_bStrong[id] = false
            g_bKatana[id] = false
            g_bHammer[id] = true
            g_bTurbulent9[id] = false
            g_bBio[id] = false
            g_bSabers[id] = false
            g_bPlasma[id] = false
            g_bStorm[id] = false
            g_bLaevateinn[id] = false
            g_bWarHammer_Dark_Knight[id] = false
            g_bBalrog_Kosa[id] = false
            g_iUsedTimes[id]++
            /*rg_remove_item(id, "weapon_knife")
            rg_give_item(id, "weapon_knife", GT_APPEND)
            engclient_cmd(id, "weapon_knife")
            g_iUsedTimes[id]++
            emit_sound(id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)*/
        }
        case 4: // Turbulent
        {

                g_bCompat[id] = false
                g_bStrong[id] = false
                g_bKatana[id] = false
                g_bHammer[id] = false
                g_bTurbulent9[id] = true
                g_bBio[id] = false
                g_bSabers[id] = false
                g_bPlasma[id] = false
                g_bStorm[id] = false
                g_bLaevateinn[id] = false
                g_bWarHammer_Dark_Knight[id] = false
                g_bBalrog_Kosa[id] = false
                g_iUsedTimes[id]++
                /*rg_remove_item(id, "w