Knife Menu With Lvl

Unpaid Requests, Public Plugins
Post Reply
User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 177
Joined: 6 years ago
Location: Egypt
Contact:

Knife Menu With Lvl

#1

Post by Luxurious » 3 years ago

Any one can make this knife level in menu not auto ??
  1. #include <zombie_escape>
  2. #include <ze_levels>
  3.  
  4. // Models
  5. new const g_szKnife1[][] =
  6. {
  7.     "models/dg/v_knife_griff.mdl",
  8.     "models/dg/p_knife_griff1.mdl"
  9. }
  10.  
  11. new const g_szKnife2[][] =
  12. {
  13.     "models/dg/v_flip_t.mdl",
  14.     "models/dg/p_flip_t.mdl"
  15. }
  16. new const g_szKnife3[][] =
  17. {
  18.     "models/dg/v_butterfly_knife.mdl",
  19.     "models/dg/p_butterfly_knife.mdl"
  20. }
  21. new const g_szKnife4[][] =
  22. {
  23.     "models/dg/v_bayonet.mdl",
  24.     "models/dg/p_bayonet.mdl"
  25. }
  26. new const g_szKnife5[][] =
  27. {
  28.     "models/dg/v_knife_karambit.mdl",
  29.     "models/dg/p_knife_karambit.mdl"
  30. }
  31. new const g_szKnife6[][] =
  32. {
  33.     "models/dg/v_knife_karambit.mdl",
  34.     "models/dg/p_knife_karambit.mdl"
  35. }
  36. new const g_szKnife7[][] =
  37. {
  38.     "models/dg/v_knifew.mdl",
  39.     "models/dg/p_knifew.mdl"
  40. }
  41. new const g_szKnife8[][] =
  42. {
  43.     "models/dg/v_knifew.mdl",
  44.     "models/dg/p_knifew.mdl"
  45. }
  46.  
  47. // Sounds
  48. new const g_szKnife1Sounds[][] =
  49. {
  50.     "weapons/knife_deploy1.wav",
  51.     "weapons/knife_hit1.wav",
  52.     "weapons/knife_hit2.wav",
  53.     "weapons/knife_hit3.wav",
  54.     "weapons/knife_hit4.wav",
  55.     "weapons/knife_hitwall1.wav",
  56.     "weapons/knife_slash1.wav",
  57.     "weapons/knife_slash2.wav",
  58.     "weapons/knife_stab.wav"
  59. }
  60.  
  61. new const g_szKnife2Sounds[][] =
  62. {
  63.     "weapons/knife_deploy1.wav",
  64.     "weapons/knife_hit1.wav",
  65.     "weapons/knife_hit2.wav",
  66.     "weapons/knife_hit3.wav",
  67.     "weapons/knife_hit4.wav",
  68.     "weapons/knife_hitwall1.wav",
  69.     "weapons/knife_slash1.wav",
  70.     "weapons/knife_slash2.wav",
  71.     "weapons/knife_stab.wav"
  72. }
  73.  
  74. new const g_szKnife3Sounds[][] =
  75. {
  76.     "weapons/knife_deploy1.wav",
  77.     "weapons/knife_hit1.wav",
  78.     "weapons/knife_hit2.wav",
  79.     "weapons/knife_hit3.wav",
  80.     "weapons/knife_hit4.wav",
  81.     "weapons/knife_hitwall1.wav",
  82.     "weapons/knife_slash1.wav",
  83.     "weapons/knife_slash2.wav",
  84.     "weapons/knife_stab.wav"
  85. }
  86.  
  87. new const g_szKnife4Sounds[][] =
  88. {
  89.     "weapons/knife_deploy1.wav",
  90.     "weapons/knife_hit1.wav",
  91.     "weapons/knife_hit2.wav",
  92.     "weapons/knife_hit3.wav",
  93.     "weapons/knife_hit4.wav",
  94.     "weapons/knife_hitwall1.wav",
  95.     "weapons/knife_slash1.wav",
  96.     "weapons/knife_slash2.wav",
  97.     "weapons/knife_stab.wav"
  98. }
  99.  
  100. new const g_szKnife5Sounds[][] =
  101. {
  102.     "weapons/knife_deploy1.wav",
  103.     "weapons/knife_hit1.wav",
  104.     "weapons/knife_hit2.wav",
  105.     "weapons/knife_hit3.wav",
  106.     "weapons/knife_hit4.wav",
  107.     "weapons/knife_hitwall1.wav",
  108.     "weapons/knife_slash1.wav",
  109.     "weapons/knife_slash2.wav",
  110.     "weapons/knife_stab.wav"
  111. }
  112.  
  113. new const g_szKnife6Sounds[][] =
  114. {
  115.     "weapons/knife_deploy1.wav",
  116.     "weapons/knife_hit1.wav",
  117.     "weapons/knife_hit2.wav",
  118.     "weapons/knife_hit3.wav",
  119.     "weapons/knife_hit4.wav",
  120.     "weapons/knife_hitwall1.wav",
  121.     "weapons/knife_slash1.wav",
  122.     "weapons/knife_slash2.wav",
  123.     "weapons/knife_stab.wav"
  124. }
  125.  
  126. new const g_szKnife7Sounds[][] =
  127. {
  128.     "weapons/knife_deploy1.wav",
  129.     "weapons/knife_hit1.wav",
  130.     "weapons/knife_hit2.wav",
  131.     "weapons/knife_hit3.wav",
  132.     "weapons/knife_hit4.wav",
  133.     "weapons/knife_hitwall1.wav",
  134.     "weapons/knife_slash1.wav",
  135.     "weapons/knife_slash2.wav",
  136.     "weapons/knife_stab.wav"
  137. }
  138.  
  139. new const g_szKnife8Sounds[][] =
  140. {
  141.     "weapons/knife_deploy1.wav",
  142.     "weapons/knife_hit1.wav",
  143.     "weapons/knife_hit2.wav",
  144.     "weapons/knife_hit3.wav",
  145.     "weapons/knife_hit4.wav",
  146.     "weapons/knife_hitwall1.wav",
  147.     "weapons/knife_slash1.wav",
  148.     "weapons/knife_slash2.wav",
  149.     "weapons/knife_stab.wav"
  150. }
  151.  
  152. new const g_szDefaultSounds[][] =
  153. {
  154.     "weapons/knife_deploy1.wav",
  155.     "weapons/knife_hit1.wav",
  156.     "weapons/knife_hit2.wav",
  157.     "weapons/knife_hit3.wav",
  158.     "weapons/knife_hit4.wav",
  159.     "weapons/knife_hitwall1.wav",
  160.     "weapons/knife_slash1.wav",
  161.     "weapons/knife_slash2.wav",
  162.     "weapons/knife_stab.wav"
  163. }
  164.  
  165. // Models indexes
  166. enum
  167. {
  168.     V_Model = 0,
  169.     P_Model
  170. }
  171.  
  172. public plugin_init()
  173. {
  174.     register_plugin("Knife Levels", "1.0", "lux")
  175.    
  176.     // Fakemeta
  177.     register_forward(FM_EmitSound, "Fw_EmitSound")
  178. }
  179.  
  180. public plugin_precache()
  181. {
  182.     new iIndex;
  183.    
  184.     // Prechace models
  185.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1); iIndex++)
  186.         precache_model(g_szKnife1[iIndex])
  187.    
  188.     for(iIndex = 0; iIndex <= charsmax(g_szKnife2); iIndex++)
  189.         precache_model(g_szKnife2[iIndex])
  190.  
  191.     for(iIndex = 0; iIndex <= charsmax(g_szKnife3); iIndex++)
  192.         precache_model(g_szKnife3[iIndex])
  193.  
  194.     for(iIndex = 0; iIndex <= charsmax(g_szKnife4); iIndex++)
  195.         precache_model(g_szKnife4[iIndex])
  196.  
  197.     for(iIndex = 0; iIndex <= charsmax(g_szKnife5); iIndex++)
  198.         precache_model(g_szKnife5[iIndex])
  199.  
  200.     for(iIndex = 0; iIndex <= charsmax(g_szKnife6); iIndex++)
  201.         precache_model(g_szKnife6[iIndex])
  202.  
  203.     for(iIndex = 0; iIndex <= charsmax(g_szKnife7); iIndex++)
  204.         precache_model(g_szKnife7[iIndex])
  205.  
  206.     for(iIndex = 0; iIndex <= charsmax(g_szKnife8); iIndex++)
  207.         precache_model(g_szKnife8[iIndex])
  208.    
  209.     // Prechace sounds
  210.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  211.         precache_sound(g_szKnife1Sounds[iIndex])
  212.  
  213.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  214.         precache_sound(g_szKnife1Sounds[iIndex])
  215. }
  216.  
  217. public ze_user_humanized(id)
  218. {
  219.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 4)
  220.     {
  221.         // Player level from 1 to 5 set him this knife
  222.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife1[V_Model])
  223.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife1[P_Model])
  224.        
  225.         ResetKnife(id)
  226.     }
  227.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  228.     {
  229.         // Player level from 5 to 8 set him this knife
  230.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife2[V_Model])
  231.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife2[P_Model])
  232.        
  233.         ResetKnife(id)
  234.     }
  235.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  236.     {
  237.         // Player level from 5 to 8 set him this knife
  238.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife3[V_Model])
  239.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife3[P_Model])
  240.        
  241.         ResetKnife(id)
  242.     }
  243.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 19)
  244.     {
  245.         // Player level from 5 to 8 set him this knife
  246.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife4[V_Model])
  247.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife4[P_Model])
  248.        
  249.         ResetKnife(id)
  250.     }
  251.     else if (ze_get_user_level(id) >= 20 && ze_get_user_level(id) < 24)
  252.     {
  253.         // Player level from 26 to 30 set him this knife
  254.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife5[V_Model])
  255.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife5[P_Model])
  256.        
  257.         ResetKnife(id)
  258.     }
  259.     else if (ze_get_user_level(id) >= 25 && ze_get_user_level(id) < 29)
  260.     {
  261.         // Player level from 26 to 30 set him this knife
  262.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife6[V_Model])
  263.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife6[P_Model])
  264.        
  265.         ResetKnife(id)
  266.     }
  267.     else if (ze_get_user_level(id) >= 30 && ze_get_user_level(id) < 50)
  268.     {
  269.         // Player level from 26 to 30 set him this knife
  270.         cs_set_player_view_model(id, CSW_KNIFE, g_szKnife7[V_Model])
  271.         cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife7[P_Model])
  272.        
  273.         ResetKnife(id)
  274.     }
  275.  
  276. }
  277.  
  278. public ResetKnife(id)
  279. {
  280.     rg_remove_item(id, "weapon_knife")
  281.     rg_give_item(id, "weapon_knife", GT_APPEND)
  282.     engclient_cmd(id, "weapon_knife")
  283.     emit_sound(id, CHAN_BODY, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  284. }
  285.  
  286. public Fw_EmitSound(id, iChannel, const szSound[])
  287. {
  288.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  289.         return FMRES_IGNORED
  290.    
  291.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 0)
  292.     {
  293.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  294.         {
  295.             if (equal(g_szDefaultSounds[iIndex], szSound))
  296.             {
  297.                 emit_sound(id, iChannel, g_szKnife1Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  298.                 return FMRES_SUPERCEDE
  299.             }
  300.         }
  301.     }
  302.     else if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 5)
  303.     {
  304.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  305.         {
  306.             if (equal(g_szDefaultSounds[iIndex], szSound))
  307.             {
  308.                 emit_sound(id, iChannel, g_szKnife2Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  309.                 return FMRES_SUPERCEDE
  310.             }
  311.         }
  312.     }
  313.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  314.     {
  315.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  316.         {
  317.             if (equal(g_szDefaultSounds[iIndex], szSound))
  318.             {
  319.                 emit_sound(id, iChannel, g_szKnife3Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  320.                 return FMRES_SUPERCEDE
  321.             }
  322.         }
  323.     }
  324.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  325.     {
  326.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  327.         {
  328.             if (equal(g_szDefaultSounds[iIndex], szSound))
  329.             {
  330.                 emit_sound(id, iChannel, g_szKnife4Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  331.                 return FMRES_SUPERCEDE
  332.             }
  333.         }
  334.     }
  335.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
  336.     {
  337.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  338.         {
  339.             if (equal(g_szDefaultSounds[iIndex], szSound))
  340.             {
  341.                 emit_sound(id, iChannel, g_szKnife5Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  342.                 return FMRES_SUPERCEDE
  343.             }
  344.         }
  345.     }
  346.     else if (ze_get_user_level(id) >= 21 && ze_get_user_level(id) < 30)
  347.     {
  348.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  349.         {
  350.             if (equal(g_szDefaultSounds[iIndex], szSound))
  351.             {
  352.                 emit_sound(id, iChannel, g_szKnife6Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  353.                 return FMRES_SUPERCEDE
  354.             }
  355.         }
  356.     }
  357.     else if (ze_get_user_level(id) >= 31 && ze_get_user_level(id) < 40)
  358.     {
  359.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  360.         {
  361.             if (equal(g_szDefaultSounds[iIndex], szSound))
  362.             {
  363.                 emit_sound(id, iChannel, g_szKnife7Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  364.                 return FMRES_SUPERCEDE
  365.             }
  366.         }
  367.     }
  368.     else if (ze_get_user_level(id) >= 49 && ze_get_user_level(id) < 50)
  369.     {
  370.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  371.         {
  372.             if (equal(g_szDefaultSounds[iIndex], szSound))
  373.             {
  374.                 emit_sound(id, iChannel, g_szKnife8Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  375.                 return FMRES_SUPERCEDE
  376.             }
  377.         }
  378.     }
  379.    
  380.     return FMRES_IGNORED
  381. }
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2213
Joined: 7 years ago
Contact:

#2

Post by Raheem » 3 years ago

  1. #include <zombie_escape>
  2. #include <ze_levels>
  3.  
  4. // Models
  5. new const g_szKnife1[][] =
  6. {
  7.     "models/dg/v_knife_griff.mdl",
  8.     "models/dg/p_knife_griff1.mdl"
  9. }
  10.  
  11. new const g_szKnife2[][] =
  12. {
  13.     "models/dg/v_flip_t.mdl",
  14.     "models/dg/p_flip_t.mdl"
  15. }
  16. new const g_szKnife3[][] =
  17. {
  18.     "models/dg/v_butterfly_knife.mdl",
  19.     "models/dg/p_butterfly_knife.mdl"
  20. }
  21. new const g_szKnife4[][] =
  22. {
  23.     "models/dg/v_bayonet.mdl",
  24.     "models/dg/p_bayonet.mdl"
  25. }
  26. new const g_szKnife5[][] =
  27. {
  28.     "models/dg/v_knife_karambit.mdl",
  29.     "models/dg/p_knife_karambit.mdl"
  30. }
  31. new const g_szKnife6[][] =
  32. {
  33.     "models/dg/v_knife_karambit.mdl",
  34.     "models/dg/p_knife_karambit.mdl"
  35. }
  36. new const g_szKnife7[][] =
  37. {
  38.     "models/dg/v_knifew.mdl",
  39.     "models/dg/p_knifew.mdl"
  40. }
  41. new const g_szKnife8[][] =
  42. {
  43.     "models/dg/v_knifew.mdl",
  44.     "models/dg/p_knifew.mdl"
  45. }
  46.  
  47. // Sounds
  48. new const g_szKnife1Sounds[][] =
  49. {
  50.     "weapons/knife_deploy1.wav",
  51.     "weapons/knife_hit1.wav",
  52.     "weapons/knife_hit2.wav",
  53.     "weapons/knife_hit3.wav",
  54.     "weapons/knife_hit4.wav",
  55.     "weapons/knife_hitwall1.wav",
  56.     "weapons/knife_slash1.wav",
  57.     "weapons/knife_slash2.wav",
  58.     "weapons/knife_stab.wav"
  59. }
  60.  
  61. new const g_szKnife2Sounds[][] =
  62. {
  63.     "weapons/knife_deploy1.wav",
  64.     "weapons/knife_hit1.wav",
  65.     "weapons/knife_hit2.wav",
  66.     "weapons/knife_hit3.wav",
  67.     "weapons/knife_hit4.wav",
  68.     "weapons/knife_hitwall1.wav",
  69.     "weapons/knife_slash1.wav",
  70.     "weapons/knife_slash2.wav",
  71.     "weapons/knife_stab.wav"
  72. }
  73.  
  74. new const g_szKnife3Sounds[][] =
  75. {
  76.     "weapons/knife_deploy1.wav",
  77.     "weapons/knife_hit1.wav",
  78.     "weapons/knife_hit2.wav",
  79.     "weapons/knife_hit3.wav",
  80.     "weapons/knife_hit4.wav",
  81.     "weapons/knife_hitwall1.wav",
  82.     "weapons/knife_slash1.wav",
  83.     "weapons/knife_slash2.wav",
  84.     "weapons/knife_stab.wav"
  85. }
  86.  
  87. new const g_szKnife4Sounds[][] =
  88. {
  89.     "weapons/knife_deploy1.wav",
  90.     "weapons/knife_hit1.wav",
  91.     "weapons/knife_hit2.wav",
  92.     "weapons/knife_hit3.wav",
  93.     "weapons/knife_hit4.wav",
  94.     "weapons/knife_hitwall1.wav",
  95.     "weapons/knife_slash1.wav",
  96.     "weapons/knife_slash2.wav",
  97.     "weapons/knife_stab.wav"
  98. }
  99.  
  100. new const g_szKnife5Sounds[][] =
  101. {
  102.     "weapons/knife_deploy1.wav",
  103.     "weapons/knife_hit1.wav",
  104.     "weapons/knife_hit2.wav",
  105.     "weapons/knife_hit3.wav",
  106.     "weapons/knife_hit4.wav",
  107.     "weapons/knife_hitwall1.wav",
  108.     "weapons/knife_slash1.wav",
  109.     "weapons/knife_slash2.wav",
  110.     "weapons/knife_stab.wav"
  111. }
  112.  
  113. new const g_szKnife6Sounds[][] =
  114. {
  115.     "weapons/knife_deploy1.wav",
  116.     "weapons/knife_hit1.wav",
  117.     "weapons/knife_hit2.wav",
  118.     "weapons/knife_hit3.wav",
  119.     "weapons/knife_hit4.wav",
  120.     "weapons/knife_hitwall1.wav",
  121.     "weapons/knife_slash1.wav",
  122.     "weapons/knife_slash2.wav",
  123.     "weapons/knife_stab.wav"
  124. }
  125.  
  126. new const g_szKnife7Sounds[][] =
  127. {
  128.     "weapons/knife_deploy1.wav",
  129.     "weapons/knife_hit1.wav",
  130.     "weapons/knife_hit2.wav",
  131.     "weapons/knife_hit3.wav",
  132.     "weapons/knife_hit4.wav",
  133.     "weapons/knife_hitwall1.wav",
  134.     "weapons/knife_slash1.wav",
  135.     "weapons/knife_slash2.wav",
  136.     "weapons/knife_stab.wav"
  137. }
  138.  
  139. new const g_szKnife8Sounds[][] =
  140. {
  141.     "weapons/knife_deploy1.wav",
  142.     "weapons/knife_hit1.wav",
  143.     "weapons/knife_hit2.wav",
  144.     "weapons/knife_hit3.wav",
  145.     "weapons/knife_hit4.wav",
  146.     "weapons/knife_hitwall1.wav",
  147.     "weapons/knife_slash1.wav",
  148.     "weapons/knife_slash2.wav",
  149.     "weapons/knife_stab.wav"
  150. }
  151.  
  152. new const g_szDefaultSounds[][] =
  153. {
  154.     "weapons/knife_deploy1.wav",
  155.     "weapons/knife_hit1.wav",
  156.     "weapons/knife_hit2.wav",
  157.     "weapons/knife_hit3.wav",
  158.     "weapons/knife_hit4.wav",
  159.     "weapons/knife_hitwall1.wav",
  160.     "weapons/knife_slash1.wav",
  161.     "weapons/knife_slash2.wav",
  162.     "weapons/knife_stab.wav"
  163. }
  164.  
  165. // Models indexes
  166. enum
  167. {
  168.     V_Model = 0,
  169.     P_Model
  170. }
  171.  
  172. public plugin_init()
  173. {
  174.     register_plugin("Knife Levels", "1.0", "lux")
  175.    
  176.     // Fakemeta
  177.     register_forward(FM_EmitSound, "Fw_EmitSound")
  178.    
  179.     // Commands
  180.     register_clcmd("say /knife", "KnifeCommandHandler")
  181. }
  182.  
  183. public plugin_precache()
  184. {
  185.     new iIndex;
  186.    
  187.     // Prechace models
  188.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1); iIndex++)
  189.         precache_model(g_szKnife1[iIndex])
  190.    
  191.     for(iIndex = 0; iIndex <= charsmax(g_szKnife2); iIndex++)
  192.         precache_model(g_szKnife2[iIndex])
  193.  
  194.     for(iIndex = 0; iIndex <= charsmax(g_szKnife3); iIndex++)
  195.         precache_model(g_szKnife3[iIndex])
  196.  
  197.     for(iIndex = 0; iIndex <= charsmax(g_szKnife4); iIndex++)
  198.         precache_model(g_szKnife4[iIndex])
  199.  
  200.     for(iIndex = 0; iIndex <= charsmax(g_szKnife5); iIndex++)
  201.         precache_model(g_szKnife5[iIndex])
  202.  
  203.     for(iIndex = 0; iIndex <= charsmax(g_szKnife6); iIndex++)
  204.         precache_model(g_szKnife6[iIndex])
  205.  
  206.     for(iIndex = 0; iIndex <= charsmax(g_szKnife7); iIndex++)
  207.         precache_model(g_szKnife7[iIndex])
  208.  
  209.     for(iIndex = 0; iIndex <= charsmax(g_szKnife8); iIndex++)
  210.         precache_model(g_szKnife8[iIndex])
  211.    
  212.     // Prechace sounds
  213.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  214.         precache_sound(g_szKnife1Sounds[iIndex])
  215.  
  216.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  217.         precache_sound(g_szKnife1Sounds[iIndex])
  218. }
  219.  
  220. public KnifeCommandHandler(id)
  221. {
  222.     new iMenu = menu_create("Knives Menu:", "KnifeMenuHandler")
  223.    
  224.     menu_additem(iMenu, "\rKnife 1", "", 0)
  225.     menu_additem(iMenu, "\rKnife 2", "", 0)
  226.     menu_additem(iMenu, "\rKnife 3", "", 0)
  227.     menu_additem(iMenu, "\rKnife 4", "", 0)
  228.     menu_additem(iMenu, "\rKnife 5", "", 0)
  229.     menu_additem(iMenu, "\rKnife 6", "", 0)
  230.     menu_additem(iMenu, "\rKnife 7", "", 0)
  231.    
  232.     menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  233.     menu_display(id, iMenu, 0)
  234.    
  235.     // No more replies needed from the server...
  236.     return PLUGIN_HANDLED
  237. }
  238.  
  239. public KnifeMenuHandler(id, iMenu, iItem)
  240. {
  241.     switch (iMenu)
  242.     {
  243.         case 0:
  244.         {
  245.             if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 4)
  246.             {
  247.                 // Player level from 1 to 5 set him this knife
  248.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife1[V_Model])
  249.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife1[P_Model])
  250.                
  251.                 ResetKnife(id)
  252.             }
  253.         }
  254.         case 1:
  255.         {
  256.             if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  257.             {
  258.                 // Player level from 5 to 8 set him this knife
  259.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife2[V_Model])
  260.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife2[P_Model])
  261.                
  262.                 ResetKnife(id)
  263.             }
  264.         }
  265.         case 2:
  266.         {
  267.             if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  268.             {
  269.                 // Player level from 5 to 8 set him this knife
  270.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife3[V_Model])
  271.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife3[P_Model])
  272.                
  273.                 ResetKnife(id)
  274.             }
  275.         }
  276.         case 3:
  277.         {
  278.             if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 19)
  279.             {
  280.                 // Player level from 5 to 8 set him this knife
  281.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife4[V_Model])
  282.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife4[P_Model])
  283.                
  284.                 ResetKnife(id)
  285.             }
  286.         }
  287.         case 4:
  288.         {
  289.             if (ze_get_user_level(id) >= 20 && ze_get_user_level(id) < 24)
  290.             {
  291.                 // Player level from 26 to 30 set him this knife
  292.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife5[V_Model])
  293.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife5[P_Model])
  294.                
  295.                 ResetKnife(id)
  296.             }
  297.         }
  298.         case 5:
  299.         {
  300.             if (ze_get_user_level(id) >= 25 && ze_get_user_level(id) < 29)
  301.             {
  302.                 // Player level from 26 to 30 set him this knife
  303.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife6[V_Model])
  304.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife6[P_Model])
  305.                
  306.                 ResetKnife(id)
  307.             }
  308.         }
  309.         case 6:
  310.         {
  311.             if (ze_get_user_level(id) >= 30 && ze_get_user_level(id) < 50)
  312.             {
  313.                 // Player level from 26 to 30 set him this knife
  314.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife7[V_Model])
  315.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife7[P_Model])
  316.                
  317.                 ResetKnife(id)
  318.             }
  319.         }
  320.     }
  321.    
  322.     return PLUGIN_HANDLED
  323. }
  324.  
  325. public ResetKnife(id)
  326. {
  327.     rg_remove_item(id, "weapon_knife")
  328.     rg_give_item(id, "weapon_knife", GT_APPEND)
  329.     engclient_cmd(id, "weapon_knife")
  330.     emit_sound(id, CHAN_BODY, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  331. }
  332.  
  333. public Fw_EmitSound(id, iChannel, const szSound[])
  334. {
  335.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  336.         return FMRES_IGNORED
  337.    
  338.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 0)
  339.     {
  340.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  341.         {
  342.             if (equal(g_szDefaultSounds[iIndex], szSound))
  343.             {
  344.                 emit_sound(id, iChannel, g_szKnife1Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  345.                 return FMRES_SUPERCEDE
  346.             }
  347.         }
  348.     }
  349.     else if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 5)
  350.     {
  351.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  352.         {
  353.             if (equal(g_szDefaultSounds[iIndex], szSound))
  354.             {
  355.                 emit_sound(id, iChannel, g_szKnife2Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  356.                 return FMRES_SUPERCEDE
  357.             }
  358.         }
  359.     }
  360.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  361.     {
  362.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  363.         {
  364.             if (equal(g_szDefaultSounds[iIndex], szSound))
  365.             {
  366.                 emit_sound(id, iChannel, g_szKnife3Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  367.                 return FMRES_SUPERCEDE
  368.             }
  369.         }
  370.     }
  371.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  372.     {
  373.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  374.         {
  375.             if (equal(g_szDefaultSounds[iIndex], szSound))
  376.             {
  377.                 emit_sound(id, iChannel, g_szKnife4Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  378.                 return FMRES_SUPERCEDE
  379.             }
  380.         }
  381.     }
  382.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
  383.     {
  384.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  385.         {
  386.             if (equal(g_szDefaultSounds[iIndex], szSound))
  387.             {
  388.                 emit_sound(id, iChannel, g_szKnife5Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  389.                 return FMRES_SUPERCEDE
  390.             }
  391.         }
  392.     }
  393.     else if (ze_get_user_level(id) >= 21 && ze_get_user_level(id) < 30)
  394.     {
  395.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  396.         {
  397.             if (equal(g_szDefaultSounds[iIndex], szSound))
  398.             {
  399.                 emit_sound(id, iChannel, g_szKnife6Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  400.                 return FMRES_SUPERCEDE
  401.             }
  402.         }
  403.     }
  404.     else if (ze_get_user_level(id) >= 31 && ze_get_user_level(id) < 40)
  405.     {
  406.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  407.         {
  408.             if (equal(g_szDefaultSounds[iIndex], szSound))
  409.             {
  410.                 emit_sound(id, iChannel, g_szKnife7Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  411.                 return FMRES_SUPERCEDE
  412.             }
  413.         }
  414.     }
  415.     else if (ze_get_user_level(id) >= 49 && ze_get_user_level(id) < 50)
  416.     {
  417.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  418.         {
  419.             if (equal(g_szDefaultSounds[iIndex], szSound))
  420.             {
  421.                 emit_sound(id, iChannel, g_szKnife8Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  422.                 return FMRES_SUPERCEDE
  423.             }
  424.         }
  425.     }
  426.    
  427.     return FMRES_IGNORED
  428. }
He who fails to plan is planning to fail

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 177
Joined: 6 years ago
Location: Egypt
Contact:

#3

Post by Luxurious » 3 years ago

No Knife vip in menu ?
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2213
Joined: 7 years ago
Contact:

#4

Post by Raheem » 3 years ago

What you mean?
He who fails to plan is planning to fail

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 177
Joined: 6 years ago
Location: Egypt
Contact:

#5

Post by Luxurious » 3 years ago

i mean to add knife [VIP] in menu

and the menu is working but when i choose some knife from menu i don`t get the knife
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2213
Joined: 7 years ago
Contact:

#6

Post by Raheem » 3 years ago

Still not understand what you mean VIP knife.
If your level between some of these you should get the knife.
He who fails to plan is planning to fail

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 177
Joined: 6 years ago
Location: Egypt
Contact:

#7

Post by Luxurious » 3 years ago

i gave my self level 50 and i tried to choose the knifes but it not work

i mean 1 knife with access
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2213
Joined: 7 years ago
Contact:

#8

Post by Raheem » 3 years ago

Problem in the main code itself:
  1. #include <zombie_escape>
  2. #include <ze_levels>
  3.  
  4. // Models
  5. new const g_szKnife1[][] =
  6. {
  7.     "models/dg/v_knife_griff.mdl",
  8.     "models/dg/p_knife_griff1.mdl"
  9. }
  10.  
  11. new const g_szKnife2[][] =
  12. {
  13.     "models/dg/v_flip_t.mdl",
  14.     "models/dg/p_flip_t.mdl"
  15. }
  16. new const g_szKnife3[][] =
  17. {
  18.     "models/dg/v_butterfly_knife.mdl",
  19.     "models/dg/p_butterfly_knife.mdl"
  20. }
  21. new const g_szKnife4[][] =
  22. {
  23.     "models/dg/v_bayonet.mdl",
  24.     "models/dg/p_bayonet.mdl"
  25. }
  26. new const g_szKnife5[][] =
  27. {
  28.     "models/dg/v_knife_karambit.mdl",
  29.     "models/dg/p_knife_karambit.mdl"
  30. }
  31. new const g_szKnife6[][] =
  32. {
  33.     "models/dg/v_knife_karambit.mdl",
  34.     "models/dg/p_knife_karambit.mdl"
  35. }
  36. new const g_szKnife7[][] =
  37. {
  38.     "models/dg/v_knifew.mdl",
  39.     "models/dg/p_knifew.mdl"
  40. }
  41. new const g_szKnife8[][] =
  42. {
  43.     "models/dg/v_knifew.mdl",
  44.     "models/dg/p_knifew.mdl"
  45. }
  46.  
  47. // Sounds
  48. new const g_szKnife1Sounds[][] =
  49. {
  50.     "weapons/knife_deploy1.wav",
  51.     "weapons/knife_hit1.wav",
  52.     "weapons/knife_hit2.wav",
  53.     "weapons/knife_hit3.wav",
  54.     "weapons/knife_hit4.wav",
  55.     "weapons/knife_hitwall1.wav",
  56.     "weapons/knife_slash1.wav",
  57.     "weapons/knife_slash2.wav",
  58.     "weapons/knife_stab.wav"
  59. }
  60.  
  61. new const g_szKnife2Sounds[][] =
  62. {
  63.     "weapons/knife_deploy1.wav",
  64.     "weapons/knife_hit1.wav",
  65.     "weapons/knife_hit2.wav",
  66.     "weapons/knife_hit3.wav",
  67.     "weapons/knife_hit4.wav",
  68.     "weapons/knife_hitwall1.wav",
  69.     "weapons/knife_slash1.wav",
  70.     "weapons/knife_slash2.wav",
  71.     "weapons/knife_stab.wav"
  72. }
  73.  
  74. new const g_szKnife3Sounds[][] =
  75. {
  76.     "weapons/knife_deploy1.wav",
  77.     "weapons/knife_hit1.wav",
  78.     "weapons/knife_hit2.wav",
  79.     "weapons/knife_hit3.wav",
  80.     "weapons/knife_hit4.wav",
  81.     "weapons/knife_hitwall1.wav",
  82.     "weapons/knife_slash1.wav",
  83.     "weapons/knife_slash2.wav",
  84.     "weapons/knife_stab.wav"
  85. }
  86.  
  87. new const g_szKnife4Sounds[][] =
  88. {
  89.     "weapons/knife_deploy1.wav",
  90.     "weapons/knife_hit1.wav",
  91.     "weapons/knife_hit2.wav",
  92.     "weapons/knife_hit3.wav",
  93.     "weapons/knife_hit4.wav",
  94.     "weapons/knife_hitwall1.wav",
  95.     "weapons/knife_slash1.wav",
  96.     "weapons/knife_slash2.wav",
  97.     "weapons/knife_stab.wav"
  98. }
  99.  
  100. new const g_szKnife5Sounds[][] =
  101. {
  102.     "weapons/knife_deploy1.wav",
  103.     "weapons/knife_hit1.wav",
  104.     "weapons/knife_hit2.wav",
  105.     "weapons/knife_hit3.wav",
  106.     "weapons/knife_hit4.wav",
  107.     "weapons/knife_hitwall1.wav",
  108.     "weapons/knife_slash1.wav",
  109.     "weapons/knife_slash2.wav",
  110.     "weapons/knife_stab.wav"
  111. }
  112.  
  113. new const g_szKnife6Sounds[][] =
  114. {
  115.     "weapons/knife_deploy1.wav",
  116.     "weapons/knife_hit1.wav",
  117.     "weapons/knife_hit2.wav",
  118.     "weapons/knife_hit3.wav",
  119.     "weapons/knife_hit4.wav",
  120.     "weapons/knife_hitwall1.wav",
  121.     "weapons/knife_slash1.wav",
  122.     "weapons/knife_slash2.wav",
  123.     "weapons/knife_stab.wav"
  124. }
  125.  
  126. new const g_szKnife7Sounds[][] =
  127. {
  128.     "weapons/knife_deploy1.wav",
  129.     "weapons/knife_hit1.wav",
  130.     "weapons/knife_hit2.wav",
  131.     "weapons/knife_hit3.wav",
  132.     "weapons/knife_hit4.wav",
  133.     "weapons/knife_hitwall1.wav",
  134.     "weapons/knife_slash1.wav",
  135.     "weapons/knife_slash2.wav",
  136.     "weapons/knife_stab.wav"
  137. }
  138.  
  139. new const g_szKnife8Sounds[][] =
  140. {
  141.     "weapons/knife_deploy1.wav",
  142.     "weapons/knife_hit1.wav",
  143.     "weapons/knife_hit2.wav",
  144.     "weapons/knife_hit3.wav",
  145.     "weapons/knife_hit4.wav",
  146.     "weapons/knife_hitwall1.wav",
  147.     "weapons/knife_slash1.wav",
  148.     "weapons/knife_slash2.wav",
  149.     "weapons/knife_stab.wav"
  150. }
  151.  
  152. new const g_szDefaultSounds[][] =
  153. {
  154.     "weapons/knife_deploy1.wav",
  155.     "weapons/knife_hit1.wav",
  156.     "weapons/knife_hit2.wav",
  157.     "weapons/knife_hit3.wav",
  158.     "weapons/knife_hit4.wav",
  159.     "weapons/knife_hitwall1.wav",
  160.     "weapons/knife_slash1.wav",
  161.     "weapons/knife_slash2.wav",
  162.     "weapons/knife_stab.wav"
  163. }
  164.  
  165. // Models indexes
  166. enum
  167. {
  168.     V_Model = 0,
  169.     P_Model
  170. }
  171.  
  172. public plugin_init()
  173. {
  174.     register_plugin("Knife Levels", "1.0", "lux")
  175.    
  176.     // Fakemeta
  177.     register_forward(FM_EmitSound, "Fw_EmitSound")
  178.    
  179.     // Commands
  180.     register_clcmd("say /knife", "KnifeCommandHandler")
  181. }
  182.  
  183. public plugin_precache()
  184. {
  185.     new iIndex;
  186.    
  187.     // Prechace models
  188.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1); iIndex++)
  189.         precache_model(g_szKnife1[iIndex])
  190.    
  191.     for(iIndex = 0; iIndex <= charsmax(g_szKnife2); iIndex++)
  192.         precache_model(g_szKnife2[iIndex])
  193.  
  194.     for(iIndex = 0; iIndex <= charsmax(g_szKnife3); iIndex++)
  195.         precache_model(g_szKnife3[iIndex])
  196.  
  197.     for(iIndex = 0; iIndex <= charsmax(g_szKnife4); iIndex++)
  198.         precache_model(g_szKnife4[iIndex])
  199.  
  200.     for(iIndex = 0; iIndex <= charsmax(g_szKnife5); iIndex++)
  201.         precache_model(g_szKnife5[iIndex])
  202.  
  203.     for(iIndex = 0; iIndex <= charsmax(g_szKnife6); iIndex++)
  204.         precache_model(g_szKnife6[iIndex])
  205.  
  206.     for(iIndex = 0; iIndex <= charsmax(g_szKnife7); iIndex++)
  207.         precache_model(g_szKnife7[iIndex])
  208.  
  209.     for(iIndex = 0; iIndex <= charsmax(g_szKnife8); iIndex++)
  210.         precache_model(g_szKnife8[iIndex])
  211.    
  212.     // Prechace sounds
  213.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  214.         precache_sound(g_szKnife1Sounds[iIndex])
  215.  
  216.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  217.         precache_sound(g_szKnife1Sounds[iIndex])
  218. }
  219.  
  220. public KnifeCommandHandler(id)
  221. {
  222.     new iMenu = menu_create("Knives Menu:", "KnifeMenuHandler")
  223.    
  224.     menu_additem(iMenu, "\rKnife 1", "", 0)
  225.     menu_additem(iMenu, "\rKnife 2", "", 0)
  226.     menu_additem(iMenu, "\rKnife 3", "", 0)
  227.     menu_additem(iMenu, "\rKnife 4", "", 0)
  228.     menu_additem(iMenu, "\rKnife 5", "", 0)
  229.     menu_additem(iMenu, "\rKnife 6", "", 0)
  230.     menu_additem(iMenu, "\rKnife 7", "", 0)
  231.    
  232.     menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  233.     menu_display(id, iMenu, 0)
  234.    
  235.     // No more replies needed from the server...
  236.     return PLUGIN_HANDLED
  237. }
  238.  
  239. public KnifeMenuHandler(id, iMenu, iItem)
  240. {
  241.     switch (iMenu)
  242.     {
  243.         case 0:
  244.         {
  245.             if (ze_get_user_level(id) >= 4)
  246.             {
  247.                 // Player level from 1 to 5 set him this knife
  248.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife1[V_Model])
  249.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife1[P_Model])
  250.                
  251.                 ResetKnife(id)
  252.             }
  253.         }
  254.         case 1:
  255.         {
  256.             if (ze_get_user_level(id) >= 9)
  257.             {
  258.                 // Player level from 5 to 8 set him this knife
  259.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife2[V_Model])
  260.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife2[P_Model])
  261.                
  262.                 ResetKnife(id)
  263.             }
  264.         }
  265.         case 2:
  266.         {
  267.             if (ze_get_user_level(id) >= 14)
  268.             {
  269.                 // Player level from 5 to 8 set him this knife
  270.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife3[V_Model])
  271.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife3[P_Model])
  272.                
  273.                 ResetKnife(id)
  274.             }
  275.         }
  276.         case 3:
  277.         {
  278.             if (ze_get_user_level(id) >= 19)
  279.             {
  280.                 // Player level from 5 to 8 set him this knife
  281.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife4[V_Model])
  282.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife4[P_Model])
  283.                
  284.                 ResetKnife(id)
  285.             }
  286.         }
  287.         case 4:
  288.         {
  289.             if (ze_get_user_level(id) >= 24)
  290.             {
  291.                 // Player level from 26 to 30 set him this knife
  292.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife5[V_Model])
  293.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife5[P_Model])
  294.                
  295.                 ResetKnife(id)
  296.             }
  297.         }
  298.         case 5:
  299.         {
  300.             if (ze_get_user_level(id) >= 29)
  301.             {
  302.                 // Player level from 26 to 30 set him this knife
  303.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife6[V_Model])
  304.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife6[P_Model])
  305.                
  306.                 ResetKnife(id)
  307.             }
  308.         }
  309.         case 6:
  310.         {
  311.             if (ze_get_user_level(id) >= 50)
  312.             {
  313.                 // Player level from 26 to 30 set him this knife
  314.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife7[V_Model])
  315.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife7[P_Model])
  316.                
  317.                 ResetKnife(id)
  318.             }
  319.         }
  320.     }
  321.    
  322.     return PLUGIN_HANDLED
  323. }
  324.  
  325. public ResetKnife(id)
  326. {
  327.     rg_remove_item(id, "weapon_knife")
  328.     rg_give_item(id, "weapon_knife", GT_APPEND)
  329.     engclient_cmd(id, "weapon_knife")
  330.     emit_sound(id, CHAN_BODY, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  331. }
  332.  
  333. public Fw_EmitSound(id, iChannel, const szSound[])
  334. {
  335.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  336.         return FMRES_IGNORED
  337.    
  338.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 0)
  339.     {
  340.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  341.         {
  342.             if (equal(g_szDefaultSounds[iIndex], szSound))
  343.             {
  344.                 emit_sound(id, iChannel, g_szKnife1Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  345.                 return FMRES_SUPERCEDE
  346.             }
  347.         }
  348.     }
  349.     else if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 5)
  350.     {
  351.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  352.         {
  353.             if (equal(g_szDefaultSounds[iIndex], szSound))
  354.             {
  355.                 emit_sound(id, iChannel, g_szKnife2Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  356.                 return FMRES_SUPERCEDE
  357.             }
  358.         }
  359.     }
  360.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  361.     {
  362.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  363.         {
  364.             if (equal(g_szDefaultSounds[iIndex], szSound))
  365.             {
  366.                 emit_sound(id, iChannel, g_szKnife3Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  367.                 return FMRES_SUPERCEDE
  368.             }
  369.         }
  370.     }
  371.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  372.     {
  373.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  374.         {
  375.             if (equal(g_szDefaultSounds[iIndex], szSound))
  376.             {
  377.                 emit_sound(id, iChannel, g_szKnife4Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  378.                 return FMRES_SUPERCEDE
  379.             }
  380.         }
  381.     }
  382.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
  383.     {
  384.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  385.         {
  386.             if (equal(g_szDefaultSounds[iIndex], szSound))
  387.             {
  388.                 emit_sound(id, iChannel, g_szKnife5Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  389.                 return FMRES_SUPERCEDE
  390.             }
  391.         }
  392.     }
  393.     else if (ze_get_user_level(id) >= 21 && ze_get_user_level(id) < 30)
  394.     {
  395.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  396.         {
  397.             if (equal(g_szDefaultSounds[iIndex], szSound))
  398.             {
  399.                 emit_sound(id, iChannel, g_szKnife6Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  400.                 return FMRES_SUPERCEDE
  401.             }
  402.         }
  403.     }
  404.     else if (ze_get_user_level(id) >= 31 && ze_get_user_level(id) < 40)
  405.     {
  406.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  407.         {
  408.             if (equal(g_szDefaultSounds[iIndex], szSound))
  409.             {
  410.                 emit_sound(id, iChannel, g_szKnife7Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  411.                 return FMRES_SUPERCEDE
  412.             }
  413.         }
  414.     }
  415.     else if (ze_get_user_level(id) >= 49 && ze_get_user_level(id) < 50)
  416.     {
  417.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  418.         {
  419.             if (equal(g_szDefaultSounds[iIndex], szSound))
  420.             {
  421.                 emit_sound(id, iChannel, g_szKnife8Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  422.                 return FMRES_SUPERCEDE
  423.             }
  424.         }
  425.     }
  426.    
  427.     return FMRES_IGNORED
  428. }

Also edit: To be same as what I did in:
He who fails to plan is planning to fail

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 177
Joined: 6 years ago
Location: Egypt
Contact:

#9

Post by Luxurious » 3 years ago

@Raheem
I got error
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2213
Joined: 7 years ago
Contact:

#10

Post by Raheem » 3 years ago

Post the code you get errors with.
He who fails to plan is planning to fail

User avatar
Luxurious
Mod Tester
Mod Tester
Egypt
Posts: 177
Joined: 6 years ago
Location: Egypt
Contact:

#11

Post by Luxurious » 3 years ago

Raheem wrote: 3 years ago Post the code you get errors with.
  1. #include <zombie_escape>
  2. #include <ze_levels>
  3.  
  4. // Models
  5. new const g_szKnife1[][] =
  6. {
  7.     "models/dg/v_knife_griff.mdl",
  8.     "models/dg/p_knife_griff1.mdl"
  9. }
  10.  
  11. new const g_szKnife2[][] =
  12. {
  13.     "models/dg/v_flip_t.mdl",
  14.     "models/dg/p_flip_t.mdl"
  15. }
  16. new const g_szKnife3[][] =
  17. {
  18.     "models/dg/v_butterfly_knife.mdl",
  19.     "models/dg/p_butterfly_knife.mdl"
  20. }
  21. new const g_szKnife4[][] =
  22. {
  23.     "models/dg/v_bayonet.mdl",
  24.     "models/dg/p_bayonet.mdl"
  25. }
  26. new const g_szKnife5[][] =
  27. {
  28.     "models/dg/v_knife_karambit.mdl",
  29.     "models/dg/p_knife_karambit.mdl"
  30. }
  31. new const g_szKnife6[][] =
  32. {
  33.     "models/dg/v_knife_karambit.mdl",
  34.     "models/dg/p_knife_karambit.mdl"
  35. }
  36. new const g_szKnife7[][] =
  37. {
  38.     "models/dg/v_knifew.mdl",
  39.     "models/dg/p_knifew.mdl"
  40. }
  41. new const g_szKnife8[][] =
  42. {
  43.     "models/dg/v_knifew.mdl",
  44.     "models/dg/p_knifew.mdl"
  45. }
  46.  
  47. // Sounds
  48. new const g_szKnife1Sounds[][] =
  49. {
  50.     "weapons/knife_deploy1.wav",
  51.     "weapons/knife_hit1.wav",
  52.     "weapons/knife_hit2.wav",
  53.     "weapons/knife_hit3.wav",
  54.     "weapons/knife_hit4.wav",
  55.     "weapons/knife_hitwall1.wav",
  56.     "weapons/knife_slash1.wav",
  57.     "weapons/knife_slash2.wav",
  58.     "weapons/knife_stab.wav"
  59. }
  60.  
  61. new const g_szKnife2Sounds[][] =
  62. {
  63.     "weapons/knife_deploy1.wav",
  64.     "weapons/knife_hit1.wav",
  65.     "weapons/knife_hit2.wav",
  66.     "weapons/knife_hit3.wav",
  67.     "weapons/knife_hit4.wav",
  68.     "weapons/knife_hitwall1.wav",
  69.     "weapons/knife_slash1.wav",
  70.     "weapons/knife_slash2.wav",
  71.     "weapons/knife_stab.wav"
  72. }
  73.  
  74. new const g_szKnife3Sounds[][] =
  75. {
  76.     "weapons/knife_deploy1.wav",
  77.     "weapons/knife_hit1.wav",
  78.     "weapons/knife_hit2.wav",
  79.     "weapons/knife_hit3.wav",
  80.     "weapons/knife_hit4.wav",
  81.     "weapons/knife_hitwall1.wav",
  82.     "weapons/knife_slash1.wav",
  83.     "weapons/knife_slash2.wav",
  84.     "weapons/knife_stab.wav"
  85. }
  86.  
  87. new const g_szKnife4Sounds[][] =
  88. {
  89.     "weapons/knife_deploy1.wav",
  90.     "weapons/knife_hit1.wav",
  91.     "weapons/knife_hit2.wav",
  92.     "weapons/knife_hit3.wav",
  93.     "weapons/knife_hit4.wav",
  94.     "weapons/knife_hitwall1.wav",
  95.     "weapons/knife_slash1.wav",
  96.     "weapons/knife_slash2.wav",
  97.     "weapons/knife_stab.wav"
  98. }
  99.  
  100. new const g_szKnife5Sounds[][] =
  101. {
  102.     "weapons/knife_deploy1.wav",
  103.     "weapons/knife_hit1.wav",
  104.     "weapons/knife_hit2.wav",
  105.     "weapons/knife_hit3.wav",
  106.     "weapons/knife_hit4.wav",
  107.     "weapons/knife_hitwall1.wav",
  108.     "weapons/knife_slash1.wav",
  109.     "weapons/knife_slash2.wav",
  110.     "weapons/knife_stab.wav"
  111. }
  112.  
  113. new const g_szKnife6Sounds[][] =
  114. {
  115.     "weapons/knife_deploy1.wav",
  116.     "weapons/knife_hit1.wav",
  117.     "weapons/knife_hit2.wav",
  118.     "weapons/knife_hit3.wav",
  119.     "weapons/knife_hit4.wav",
  120.     "weapons/knife_hitwall1.wav",
  121.     "weapons/knife_slash1.wav",
  122.     "weapons/knife_slash2.wav",
  123.     "weapons/knife_stab.wav"
  124. }
  125.  
  126. new const g_szKnife7Sounds[][] =
  127. {
  128.     "weapons/knife_deploy1.wav",
  129.     "weapons/knife_hit1.wav",
  130.     "weapons/knife_hit2.wav",
  131.     "weapons/knife_hit3.wav",
  132.     "weapons/knife_hit4.wav",
  133.     "weapons/knife_hitwall1.wav",
  134.     "weapons/knife_slash1.wav",
  135.     "weapons/knife_slash2.wav",
  136.     "weapons/knife_stab.wav"
  137. }
  138.  
  139. new const g_szKnife8Sounds[][] =
  140. {
  141.     "weapons/knife_deploy1.wav",
  142.     "weapons/knife_hit1.wav",
  143.     "weapons/knife_hit2.wav",
  144.     "weapons/knife_hit3.wav",
  145.     "weapons/knife_hit4.wav",
  146.     "weapons/knife_hitwall1.wav",
  147.     "weapons/knife_slash1.wav",
  148.     "weapons/knife_slash2.wav",
  149.     "weapons/knife_stab.wav"
  150. }
  151.  
  152. new const g_szDefaultSounds[][] =
  153. {
  154.     "weapons/knife_deploy1.wav",
  155.     "weapons/knife_hit1.wav",
  156.     "weapons/knife_hit2.wav",
  157.     "weapons/knife_hit3.wav",
  158.     "weapons/knife_hit4.wav",
  159.     "weapons/knife_hitwall1.wav",
  160.     "weapons/knife_slash1.wav",
  161.     "weapons/knife_slash2.wav",
  162.     "weapons/knife_stab.wav"
  163. }
  164.  
  165. // Models indexes
  166. enum
  167. {
  168.     V_Model = 0,
  169.     P_Model
  170. }
  171.  
  172. public plugin_init()
  173. {
  174.     register_plugin("Knife Levels", "1.0", "lux")
  175.    
  176.     // Fakemeta
  177.     register_forward(Fw_KnifeMenuHandler, "Fw_KnifeMenuHandler")
  178.    
  179.     // Commands
  180.     register_clcmd("say /knife", "KnifeCommandHandler")
  181. }
  182.  
  183. public plugin_precache()
  184. {
  185.     new iIndex;
  186.    
  187.     // Prechace models
  188.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1); iIndex++)
  189.         precache_model(g_szKnife1[iIndex])
  190.    
  191.     for(iIndex = 0; iIndex <= charsmax(g_szKnife2); iIndex++)
  192.         precache_model(g_szKnife2[iIndex])
  193.  
  194.     for(iIndex = 0; iIndex <= charsmax(g_szKnife3); iIndex++)
  195.         precache_model(g_szKnife3[iIndex])
  196.  
  197.     for(iIndex = 0; iIndex <= charsmax(g_szKnife4); iIndex++)
  198.         precache_model(g_szKnife4[iIndex])
  199.  
  200.     for(iIndex = 0; iIndex <= charsmax(g_szKnife5); iIndex++)
  201.         precache_model(g_szKnife5[iIndex])
  202.  
  203.     for(iIndex = 0; iIndex <= charsmax(g_szKnife6); iIndex++)
  204.         precache_model(g_szKnife6[iIndex])
  205.  
  206.     for(iIndex = 0; iIndex <= charsmax(g_szKnife7); iIndex++)
  207.         precache_model(g_szKnife7[iIndex])
  208.  
  209.     for(iIndex = 0; iIndex <= charsmax(g_szKnife8); iIndex++)
  210.         precache_model(g_szKnife8[iIndex])
  211.    
  212.     // Prechace sounds
  213.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  214.         precache_sound(g_szKnife1Sounds[iIndex])
  215.  
  216.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  217.         precache_sound(g_szKnife1Sounds[iIndex])
  218. }
  219.  
  220. public KnifeCommandHandler(id)
  221. {
  222.     new iMenu = menu_create("Knives Menu:", "KnifeMenuHandler")
  223.    
  224.     menu_additem(iMenu, "\rKnife 1", "", 0)
  225.     menu_additem(iMenu, "\rKnife 2", "", 0)
  226.     menu_additem(iMenu, "\rKnife 3", "", 0)
  227.     menu_additem(iMenu, "\rKnife 4", "", 0)
  228.     menu_additem(iMenu, "\rKnife 5", "", 0)
  229.     menu_additem(iMenu, "\rKnife 6", "", 0)
  230.     menu_additem(iMenu, "\rKnife 7", "", 0)
  231.    
  232.     menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  233.     menu_display(id, iMenu, 0)
  234.    
  235.     // No more replies needed from the server...
  236.     return PLUGIN_HANDLED
  237. }
  238.  
  239. public KnifeMenuHandler(id, iMenu, iItem)
  240. {
  241.     switch (iMenu)
  242.     {
  243.         case 0:
  244.         {
  245.             if (ze_get_user_level(id) >= 4)
  246.             {
  247.                 // Player level from 1 to 5 set him this knife
  248.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife1[V_Model])
  249.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife1[P_Model])
  250.                
  251.                 ResetKnife(id)
  252.             }
  253.         }
  254.         case 1:
  255.         {
  256.             if (ze_get_user_level(id) >= 9)
  257.             {
  258.                 // Player level from 5 to 8 set him this knife
  259.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife2[V_Model])
  260.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife2[P_Model])
  261.                
  262.                 ResetKnife(id)
  263.             }
  264.         }
  265.         case 2:
  266.         {
  267.             if (ze_get_user_level(id) >= 14)
  268.             {
  269.                 // Player level from 5 to 8 set him this knife
  270.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife3[V_Model])
  271.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife3[P_Model])
  272.                
  273.                 ResetKnife(id)
  274.             }
  275.         }
  276.         case 3:
  277.         {
  278.             if (ze_get_user_level(id) >= 19)
  279.             {
  280.                 // Player level from 5 to 8 set him this knife
  281.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife4[V_Model])
  282.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife4[P_Model])
  283.                
  284.                 ResetKnife(id)
  285.             }
  286.         }
  287.         case 4:
  288.         {
  289.             if (ze_get_user_level(id) >= 24)
  290.             {
  291.                 // Player level from 26 to 30 set him this knife
  292.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife5[V_Model])
  293.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife5[P_Model])
  294.                
  295.                 ResetKnife(id)
  296.             }
  297.         }
  298.         case 5:
  299.         {
  300.             if (ze_get_user_level(id) >= 29)
  301.             {
  302.                 // Player level from 26 to 30 set him this knife
  303.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife6[V_Model])
  304.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife6[P_Model])
  305.                
  306.                 ResetKnife(id)
  307.             }
  308.         }
  309.         case 6:
  310.         {
  311.             if (ze_get_user_level(id) >= 50)
  312.             {
  313.                 // Player level from 26 to 30 set him this knife
  314.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife7[V_Model])
  315.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife7[P_Model])
  316.                
  317.                 ResetKnife(id)
  318.             }
  319.         }
  320.     }
  321.    
  322.     return PLUGIN_HANDLED
  323. }
  324.  
  325. public ResetKnife(id)
  326. {
  327.     rg_remove_item(id, "weapon_knife")
  328.     rg_give_item(id, "weapon_knife", GT_APPEND)
  329.     engclient_cmd(id, "weapon_knife")
  330.     KnifeMenuHandler(id, CHAN_BODY, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  331. }
  332.  
  333. public KnifeMenuHandler(id, iMenu, iItem)
  334. {
  335.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  336.         return FMRES_IGNORED
  337.    
  338.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 0)
  339.     {
  340.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  341.         {
  342.             if (equal(g_szDefaultSounds[iIndex], szSound))
  343.             {
  344.                 KnifeMenuHandler(id, iMenu, g_szKnife1Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  345.                 return FMRES_SUPERCEDE
  346.             }
  347.         }
  348.     }
  349.     else if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 5)
  350.     {
  351.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  352.         {
  353.             if (equal(g_szDefaultSounds[iIndex], szSound))
  354.             {
  355.                 KnifeMenuHandler(id, iMenu, g_szKnife2Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  356.                 return FMRES_SUPERCEDE
  357.             }
  358.         }
  359.     }
  360.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  361.     {
  362.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  363.         {
  364.             if (equal(g_szDefaultSounds[iIndex], szSound))
  365.             {
  366.                 KnifeMenuHandler(id, iMenu, g_szKnife3Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  367.                 return FMRES_SUPERCEDE
  368.             }
  369.         }
  370.     }
  371.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  372.     {
  373.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  374.         {
  375.             if (equal(g_szDefaultSounds[iIndex], szSound))
  376.             {
  377.                 KnifeMenuHandler(id, iMenu, g_szKnife4Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  378.                 return FMRES_SUPERCEDE
  379.             }
  380.         }
  381.     }
  382.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
  383.     {
  384.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  385.         {
  386.             if (equal(g_szDefaultSounds[iIndex], szSound))
  387.             {
  388.                 KnifeMenuHandler(id, iMenu, g_szKnife5Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  389.                 return FMRES_SUPERCEDE
  390.             }
  391.         }
  392.     }
  393.     else if (ze_get_user_level(id) >= 21 && ze_get_user_level(id) < 30)
  394.     {
  395.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  396.         {
  397.             if (equal(g_szDefaultSounds[iIndex], szSound))
  398.             {
  399.                 KnifeMenuHandler(id, iMenu, g_szKnife6Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  400.                 return FMRES_SUPERCEDE
  401.             }
  402.         }
  403.     }
  404.     else if (ze_get_user_level(id) >= 31 && ze_get_user_level(id) < 40)
  405.     {
  406.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  407.         {
  408.             if (equal(g_szDefaultSounds[iIndex], szSound))
  409.             {
  410.                 KnifeMenuHandler(id, iMenu, g_szKnife7Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  411.                 return FMRES_SUPERCEDE
  412.             }
  413.         }
  414.     }
  415.     else if (ze_get_user_level(id) >= 49 && ze_get_user_level(id) < 50)
  416.     {
  417.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  418.         {
  419.             if (equal(g_szDefaultSounds[iIndex], szSound))
  420.             {
  421.                 KnifeMenuHandler(id, iMenu, g_szKnife8Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  422.                 return FMRES_SUPERCEDE
  423.             }
  424.         }
  425.     }
  426.    
  427.     return FMRES_IGNORED
  428. }
DRK Zombie-Escape V1.6
IP : 81.169.153.129:27015

User avatar
Evillious Energy
Member
Member
Nepal
Posts: 22
Joined: 4 years ago
Contact:

#12

Post by Evillious Energy » 3 years ago

Luxurious wrote: 3 years ago
Raheem wrote: 3 years ago Post the code you get errors with.
  1. #include <zombie_escape>
  2. #include <ze_levels>
  3.  
  4. // Models
  5. new const g_szKnife1[][] =
  6. {
  7.     "models/dg/v_knife_griff.mdl",
  8.     "models/dg/p_knife_griff1.mdl"
  9. }
  10.  
  11. new const g_szKnife2[][] =
  12. {
  13.     "models/dg/v_flip_t.mdl",
  14.     "models/dg/p_flip_t.mdl"
  15. }
  16. new const g_szKnife3[][] =
  17. {
  18.     "models/dg/v_butterfly_knife.mdl",
  19.     "models/dg/p_butterfly_knife.mdl"
  20. }
  21. new const g_szKnife4[][] =
  22. {
  23.     "models/dg/v_bayonet.mdl",
  24.     "models/dg/p_bayonet.mdl"
  25. }
  26. new const g_szKnife5[][] =
  27. {
  28.     "models/dg/v_knife_karambit.mdl",
  29.     "models/dg/p_knife_karambit.mdl"
  30. }
  31. new const g_szKnife6[][] =
  32. {
  33.     "models/dg/v_knife_karambit.mdl",
  34.     "models/dg/p_knife_karambit.mdl"
  35. }
  36. new const g_szKnife7[][] =
  37. {
  38.     "models/dg/v_knifew.mdl",
  39.     "models/dg/p_knifew.mdl"
  40. }
  41. new const g_szKnife8[][] =
  42. {
  43.     "models/dg/v_knifew.mdl",
  44.     "models/dg/p_knifew.mdl"
  45. }
  46.  
  47. // Sounds
  48. new const g_szKnife1Sounds[][] =
  49. {
  50.     "weapons/knife_deploy1.wav",
  51.     "weapons/knife_hit1.wav",
  52.     "weapons/knife_hit2.wav",
  53.     "weapons/knife_hit3.wav",
  54.     "weapons/knife_hit4.wav",
  55.     "weapons/knife_hitwall1.wav",
  56.     "weapons/knife_slash1.wav",
  57.     "weapons/knife_slash2.wav",
  58.     "weapons/knife_stab.wav"
  59. }
  60.  
  61. new const g_szKnife2Sounds[][] =
  62. {
  63.     "weapons/knife_deploy1.wav",
  64.     "weapons/knife_hit1.wav",
  65.     "weapons/knife_hit2.wav",
  66.     "weapons/knife_hit3.wav",
  67.     "weapons/knife_hit4.wav",
  68.     "weapons/knife_hitwall1.wav",
  69.     "weapons/knife_slash1.wav",
  70.     "weapons/knife_slash2.wav",
  71.     "weapons/knife_stab.wav"
  72. }
  73.  
  74. new const g_szKnife3Sounds[][] =
  75. {
  76.     "weapons/knife_deploy1.wav",
  77.     "weapons/knife_hit1.wav",
  78.     "weapons/knife_hit2.wav",
  79.     "weapons/knife_hit3.wav",
  80.     "weapons/knife_hit4.wav",
  81.     "weapons/knife_hitwall1.wav",
  82.     "weapons/knife_slash1.wav",
  83.     "weapons/knife_slash2.wav",
  84.     "weapons/knife_stab.wav"
  85. }
  86.  
  87. new const g_szKnife4Sounds[][] =
  88. {
  89.     "weapons/knife_deploy1.wav",
  90.     "weapons/knife_hit1.wav",
  91.     "weapons/knife_hit2.wav",
  92.     "weapons/knife_hit3.wav",
  93.     "weapons/knife_hit4.wav",
  94.     "weapons/knife_hitwall1.wav",
  95.     "weapons/knife_slash1.wav",
  96.     "weapons/knife_slash2.wav",
  97.     "weapons/knife_stab.wav"
  98. }
  99.  
  100. new const g_szKnife5Sounds[][] =
  101. {
  102.     "weapons/knife_deploy1.wav",
  103.     "weapons/knife_hit1.wav",
  104.     "weapons/knife_hit2.wav",
  105.     "weapons/knife_hit3.wav",
  106.     "weapons/knife_hit4.wav",
  107.     "weapons/knife_hitwall1.wav",
  108.     "weapons/knife_slash1.wav",
  109.     "weapons/knife_slash2.wav",
  110.     "weapons/knife_stab.wav"
  111. }
  112.  
  113. new const g_szKnife6Sounds[][] =
  114. {
  115.     "weapons/knife_deploy1.wav",
  116.     "weapons/knife_hit1.wav",
  117.     "weapons/knife_hit2.wav",
  118.     "weapons/knife_hit3.wav",
  119.     "weapons/knife_hit4.wav",
  120.     "weapons/knife_hitwall1.wav",
  121.     "weapons/knife_slash1.wav",
  122.     "weapons/knife_slash2.wav",
  123.     "weapons/knife_stab.wav"
  124. }
  125.  
  126. new const g_szKnife7Sounds[][] =
  127. {
  128.     "weapons/knife_deploy1.wav",
  129.     "weapons/knife_hit1.wav",
  130.     "weapons/knife_hit2.wav",
  131.     "weapons/knife_hit3.wav",
  132.     "weapons/knife_hit4.wav",
  133.     "weapons/knife_hitwall1.wav",
  134.     "weapons/knife_slash1.wav",
  135.     "weapons/knife_slash2.wav",
  136.     "weapons/knife_stab.wav"
  137. }
  138.  
  139. new const g_szKnife8Sounds[][] =
  140. {
  141.     "weapons/knife_deploy1.wav",
  142.     "weapons/knife_hit1.wav",
  143.     "weapons/knife_hit2.wav",
  144.     "weapons/knife_hit3.wav",
  145.     "weapons/knife_hit4.wav",
  146.     "weapons/knife_hitwall1.wav",
  147.     "weapons/knife_slash1.wav",
  148.     "weapons/knife_slash2.wav",
  149.     "weapons/knife_stab.wav"
  150. }
  151.  
  152. new const g_szDefaultSounds[][] =
  153. {
  154.     "weapons/knife_deploy1.wav",
  155.     "weapons/knife_hit1.wav",
  156.     "weapons/knife_hit2.wav",
  157.     "weapons/knife_hit3.wav",
  158.     "weapons/knife_hit4.wav",
  159.     "weapons/knife_hitwall1.wav",
  160.     "weapons/knife_slash1.wav",
  161.     "weapons/knife_slash2.wav",
  162.     "weapons/knife_stab.wav"
  163. }
  164.  
  165. // Models indexes
  166. enum
  167. {
  168.     V_Model = 0,
  169.     P_Model
  170. }
  171.  
  172. public plugin_init()
  173. {
  174.     register_plugin("Knife Levels", "1.0", "lux")
  175.    
  176.     // Fakemeta
  177.     register_forward(Fw_KnifeMenuHandler, "Fw_KnifeMenuHandler")
  178.    
  179.     // Commands
  180.     register_clcmd("say /knife", "KnifeCommandHandler")
  181. }
  182.  
  183. public plugin_precache()
  184. {
  185.     new iIndex;
  186.    
  187.     // Prechace models
  188.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1); iIndex++)
  189.         precache_model(g_szKnife1[iIndex])
  190.    
  191.     for(iIndex = 0; iIndex <= charsmax(g_szKnife2); iIndex++)
  192.         precache_model(g_szKnife2[iIndex])
  193.  
  194.     for(iIndex = 0; iIndex <= charsmax(g_szKnife3); iIndex++)
  195.         precache_model(g_szKnife3[iIndex])
  196.  
  197.     for(iIndex = 0; iIndex <= charsmax(g_szKnife4); iIndex++)
  198.         precache_model(g_szKnife4[iIndex])
  199.  
  200.     for(iIndex = 0; iIndex <= charsmax(g_szKnife5); iIndex++)
  201.         precache_model(g_szKnife5[iIndex])
  202.  
  203.     for(iIndex = 0; iIndex <= charsmax(g_szKnife6); iIndex++)
  204.         precache_model(g_szKnife6[iIndex])
  205.  
  206.     for(iIndex = 0; iIndex <= charsmax(g_szKnife7); iIndex++)
  207.         precache_model(g_szKnife7[iIndex])
  208.  
  209.     for(iIndex = 0; iIndex <= charsmax(g_szKnife8); iIndex++)
  210.         precache_model(g_szKnife8[iIndex])
  211.    
  212.     // Prechace sounds
  213.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  214.         precache_sound(g_szKnife1Sounds[iIndex])
  215.  
  216.     for(iIndex = 0; iIndex <= charsmax(g_szKnife1Sounds); iIndex++)
  217.         precache_sound(g_szKnife1Sounds[iIndex])
  218. }
  219.  
  220. public KnifeCommandHandler(id)
  221. {
  222.     new iMenu = menu_create("Knives Menu:", "KnifeMenuHandler")
  223.    
  224.     menu_additem(iMenu, "\rKnife 1", "", 0)
  225.     menu_additem(iMenu, "\rKnife 2", "", 0)
  226.     menu_additem(iMenu, "\rKnife 3", "", 0)
  227.     menu_additem(iMenu, "\rKnife 4", "", 0)
  228.     menu_additem(iMenu, "\rKnife 5", "", 0)
  229.     menu_additem(iMenu, "\rKnife 6", "", 0)
  230.     menu_additem(iMenu, "\rKnife 7", "", 0)
  231.    
  232.     menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL)
  233.     menu_display(id, iMenu, 0)
  234.    
  235.     // No more replies needed from the server...
  236.     return PLUGIN_HANDLED
  237. }
  238.  
  239. public KnifeMenuHandler(id, iMenu, iItem)
  240. {
  241.     switch (iMenu)
  242.     {
  243.         case 0:
  244.         {
  245.             if (ze_get_user_level(id) >= 4)
  246.             {
  247.                 // Player level from 1 to 5 set him this knife
  248.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife1[V_Model])
  249.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife1[P_Model])
  250.                
  251.                 ResetKnife(id)
  252.             }
  253.         }
  254.         case 1:
  255.         {
  256.             if (ze_get_user_level(id) >= 9)
  257.             {
  258.                 // Player level from 5 to 8 set him this knife
  259.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife2[V_Model])
  260.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife2[P_Model])
  261.                
  262.                 ResetKnife(id)
  263.             }
  264.         }
  265.         case 2:
  266.         {
  267.             if (ze_get_user_level(id) >= 14)
  268.             {
  269.                 // Player level from 5 to 8 set him this knife
  270.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife3[V_Model])
  271.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife3[P_Model])
  272.                
  273.                 ResetKnife(id)
  274.             }
  275.         }
  276.         case 3:
  277.         {
  278.             if (ze_get_user_level(id) >= 19)
  279.             {
  280.                 // Player level from 5 to 8 set him this knife
  281.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife4[V_Model])
  282.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife4[P_Model])
  283.                
  284.                 ResetKnife(id)
  285.             }
  286.         }
  287.         case 4:
  288.         {
  289.             if (ze_get_user_level(id) >= 24)
  290.             {
  291.                 // Player level from 26 to 30 set him this knife
  292.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife5[V_Model])
  293.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife5[P_Model])
  294.                
  295.                 ResetKnife(id)
  296.             }
  297.         }
  298.         case 5:
  299.         {
  300.             if (ze_get_user_level(id) >= 29)
  301.             {
  302.                 // Player level from 26 to 30 set him this knife
  303.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife6[V_Model])
  304.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife6[P_Model])
  305.                
  306.                 ResetKnife(id)
  307.             }
  308.         }
  309.         case 6:
  310.         {
  311.             if (ze_get_user_level(id) >= 50)
  312.             {
  313.                 // Player level from 26 to 30 set him this knife
  314.                 cs_set_player_view_model(id, CSW_KNIFE, g_szKnife7[V_Model])
  315.                 cs_set_player_weap_model(id, CSW_KNIFE, g_szKnife7[P_Model])
  316.                
  317.                 ResetKnife(id)
  318.             }
  319.         }
  320.     }
  321.    
  322.     return PLUGIN_HANDLED
  323. }
  324.  
  325. public ResetKnife(id)
  326. {
  327.     rg_remove_item(id, "weapon_knife")
  328.     rg_give_item(id, "weapon_knife", GT_APPEND)
  329.     engclient_cmd(id, "weapon_knife")
  330.     KnifeMenuHandler(id, CHAN_BODY, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
  331. }
  332.  
  333. public KnifeMenuHandler(id, iMenu, iItem)
  334. {
  335.     if(!is_user_alive(id) || ze_is_user_zombie(id))
  336.         return FMRES_IGNORED
  337.    
  338.     if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 0)
  339.     {
  340.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  341.         {
  342.             if (equal(g_szDefaultSounds[iIndex], szSound))
  343.             {
  344.                 KnifeMenuHandler(id, iMenu, g_szKnife1Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  345.                 return FMRES_SUPERCEDE
  346.             }
  347.         }
  348.     }
  349.     else if (ze_get_user_level(id) >= 0 && ze_get_user_level(id) < 5)
  350.     {
  351.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  352.         {
  353.             if (equal(g_szDefaultSounds[iIndex], szSound))
  354.             {
  355.                 KnifeMenuHandler(id, iMenu, g_szKnife2Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  356.                 return FMRES_SUPERCEDE
  357.             }
  358.         }
  359.     }
  360.     else if (ze_get_user_level(id) >= 5 && ze_get_user_level(id) < 9)
  361.     {
  362.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  363.         {
  364.             if (equal(g_szDefaultSounds[iIndex], szSound))
  365.             {
  366.                 KnifeMenuHandler(id, iMenu, g_szKnife3Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  367.                 return FMRES_SUPERCEDE
  368.             }
  369.         }
  370.     }
  371.     else if (ze_get_user_level(id) >= 10 && ze_get_user_level(id) < 14)
  372.     {
  373.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  374.         {
  375.             if (equal(g_szDefaultSounds[iIndex], szSound))
  376.             {
  377.                 KnifeMenuHandler(id, iMenu, g_szKnife4Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  378.                 return FMRES_SUPERCEDE
  379.             }
  380.         }
  381.     }
  382.     else if (ze_get_user_level(id) >= 15 && ze_get_user_level(id) < 20)
  383.     {
  384.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  385.         {
  386.             if (equal(g_szDefaultSounds[iIndex], szSound))
  387.             {
  388.                 KnifeMenuHandler(id, iMenu, g_szKnife5Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  389.                 return FMRES_SUPERCEDE
  390.             }
  391.         }
  392.     }
  393.     else if (ze_get_user_level(id) >= 21 && ze_get_user_level(id) < 30)
  394.     {
  395.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  396.         {
  397.             if (equal(g_szDefaultSounds[iIndex], szSound))
  398.             {
  399.                 KnifeMenuHandler(id, iMenu, g_szKnife6Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  400.                 return FMRES_SUPERCEDE
  401.             }
  402.         }
  403.     }
  404.     else if (ze_get_user_level(id) >= 31 && ze_get_user_level(id) < 40)
  405.     {
  406.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  407.         {
  408.             if (equal(g_szDefaultSounds[iIndex], szSound))
  409.             {
  410.                 KnifeMenuHandler(id, iMenu, g_szKnife7Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  411.                 return FMRES_SUPERCEDE
  412.             }
  413.         }
  414.     }
  415.     else if (ze_get_user_level(id) >= 49 && ze_get_user_level(id) < 50)
  416.     {
  417.         for(new iIndex = 0; iIndex <= charsmax(g_szDefaultSounds); iIndex++)
  418.         {
  419.             if (equal(g_szDefaultSounds[iIndex], szSound))
  420.             {
  421.                 KnifeMenuHandler(id, iMenu, g_szKnife8Sounds[iIndex], 1.0, ATTN_NORM, 0, PITCH_NORM)
  422.                 return FMRES_SUPERCEDE
  423.             }
  424.         }
  425.     }
  426.    
  427.     return FMRES_IGNORED
  428. }

Well i have good knife menu that we have converted if any one wants u can pm me :v
51.79.157.106:27017

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 1 guest